[Devel] [PATCH RHEL10 COMMIT] fixup! arch/x86: introduce cpuid override
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 5 21:32:04 MSK 2026
The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.29.vz10
------>
commit 8cd5cd3bc3da7260caababb0bf2e501159372ad8
Author: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
Date: Tue Jun 2 21:10:29 2026 +0000
fixup! arch/x86: introduce cpuid override
arch/x86/kernel/cpuid_fault.c:275:52: error: 'proc_vz_dir' undeclared
275 | proc = proc_create("cpuid_override", 0644, proc_vz_dir,
| ^~~~~~~~~~~
We have no proc_vz_dir without CONFIG_VE. For minimal logic change
cover all the code in cpuid_fault.c except do_cpuid_fault
with #ifdef CONFIG_VE.
When CONFIG_VE is disabled, the behavior will be as if
cpuid_override list is empty.
https://virtuozzo.atlassian.net/browse/VSTOR-130116
Feature: !CONFIG_VE build
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
arch/x86/kernel/cpuid_fault.c | 64 +++++++++++++++++++++++++++----------------
1 file changed, 40 insertions(+), 24 deletions(-)
diff --git a/arch/x86/kernel/cpuid_fault.c b/arch/x86/kernel/cpuid_fault.c
index ed5349b955f82..b50e52012a52b 100644
--- a/arch/x86/kernel/cpuid_fault.c
+++ b/arch/x86/kernel/cpuid_fault.c
@@ -20,6 +20,45 @@
#include <asm/uaccess.h>
#include <asm/traps.h>
+#ifdef CONFIG_VE
+static bool cpuid_override_match(unsigned int op, unsigned int count,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx);
+
+#else
+static inline bool cpuid_override_match(unsigned int op, unsigned int count,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ return false;
+}
+#endif
+
+void __do_cpuid_fault(unsigned int op, unsigned int count,
+ unsigned int *eax, unsigned int *ebx,
+ unsigned int *ecx, unsigned int *edx)
+{
+ /* check if op is overridden */
+ if (cpuid_override_match(op, count, eax, ebx, ecx, edx))
+ return;
+
+ /* fallback to real cpuid */
+ cpuid_count(op, count, eax, ebx, ecx, edx);
+}
+
+void do_cpuid_fault(struct pt_regs *regs)
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ __do_cpuid_fault(regs->ax, regs->cx, &eax, &ebx, &ecx, &edx);
+
+ regs->ax = eax;
+ regs->bx = ebx;
+ regs->cx = ecx;
+ regs->dx = edx;
+}
+
+#ifdef CONFIG_VE
struct cpuid_override_table __rcu *cpuid_override __read_mostly;
static DEFINE_SPINLOCK(cpuid_override_lock);
@@ -98,30 +137,6 @@ static bool cpuid_override_match(unsigned int op, unsigned int count,
return ret;
}
-void __do_cpuid_fault(unsigned int op, unsigned int count,
- unsigned int *eax, unsigned int *ebx,
- unsigned int *ecx, unsigned int *edx)
-{
- /* check if op is overridden */
- if (cpuid_override_match(op, count, eax, ebx, ecx, edx))
- return;
-
- /* fallback to real cpuid */
- cpuid_count(op, count, eax, ebx, ecx, edx);
-}
-
-void do_cpuid_fault(struct pt_regs *regs)
-{
- unsigned int eax, ebx, ecx, edx;
-
- __do_cpuid_fault(regs->ax, regs->cx, &eax, &ebx, &ecx, &edx);
-
- regs->ax = eax;
- regs->bx = ebx;
- regs->cx = ecx;
- regs->dx = edx;
-}
-
/*
* CPUID override entry format:
*
@@ -280,3 +295,4 @@ static int __init cpuid_fault_init(void)
return 0;
}
module_init(cpuid_fault_init);
+#endif /* CONFIG_VE */
More information about the Devel
mailing list