[Devel] [PATCH RH9 17/22] x86/cpuid_fault: Increase max count of cpuid overrides

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 7 13:57:41 MSK 2021


From: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>

Due to implementation of cpu pools task, a maximum of 16 cpuid overrides
has become too small. Increase it to 128.

Also as the amount of records has now grown, the maximum write size has
also grown, so get_free_page has been changed to get_free_pages with
order 1.

Also the ratelimited logging now might skip some of the lines written to
cpuid_override file and it would be hard to debug if the parsing has
been performed correctly.

https://jira.sw.ru/browse/PSBM-126172
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>

(cherry picked from vz8 commit 47786157f07498a7e079486988574378940c482f)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 arch/x86/kernel/cpuid_fault.c  | 4 ++--
 include/linux/cpuid_override.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpuid_fault.c b/arch/x86/kernel/cpuid_fault.c
index ca54ba4..e48ebe2 100644
--- a/arch/x86/kernel/cpuid_fault.c
+++ b/arch/x86/kernel/cpuid_fault.c
@@ -141,7 +141,7 @@ static ssize_t cpuid_override_write(struct file *file, const char __user *buf,
 	if (!t)
 		goto out;
 
-	page = (void *)__get_free_page(GFP_KERNEL);
+	page = (void *)__get_free_pages(GFP_KERNEL, 1);
 	if (!page)
 		goto out;
 
@@ -166,7 +166,7 @@ static ssize_t cpuid_override_write(struct file *file, const char __user *buf,
 	}
 	err = 0;
 out:
-	free_page((unsigned long)page);
+	free_pages((unsigned long)page, 1);
 
 	if (!err)
 		cpuid_override_update(t);
diff --git a/include/linux/cpuid_override.h b/include/linux/cpuid_override.h
index be74f28..1f522372 100644
--- a/include/linux/cpuid_override.h
+++ b/include/linux/cpuid_override.h
@@ -21,7 +21,7 @@ struct cpuid_override_entry {
 	unsigned int edx;
 };
 
-#define MAX_CPUID_OVERRIDE_ENTRIES	16
+#define MAX_CPUID_OVERRIDE_ENTRIES	128
 
 struct cpuid_override_table {
 	struct rcu_head rcu_head;
-- 
1.8.3.1



More information about the Devel mailing list