Re: [GIT PULL] KVM/x86 changes for Linux 6.12
From: Linus Torvalds
Date: Sun Sep 29 2024 - 13:36:29 EST
On Sat, 28 Sept 2024 at 08:33, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> Apologize for the late pull request; all the traveling made things a
> bit messy. Also, we have a known regression here on ancient processors
> and will fix it next week.
.. actually, much worse than that, you have a build error.
arch/x86/kvm/x86.c: In function ‘kvm_arch_enable_virtualization’:
arch/x86/kvm/x86.c:12517:9: error: implicit declaration of function
‘cpu_emergency_register_virt_callback’
[-Wimplicit-function-declaration]
12517 |
cpu_emergency_register_virt_callback(kvm_x86_ops.emergency_disable_virtualization_cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/x86.c: In function ‘kvm_arch_disable_virtualization’:
arch/x86/kvm/x86.c:12522:9: error: implicit declaration of function
‘cpu_emergency_unregister_virt_callback’
[-Wimplicit-function-declaration]
12522 |
cpu_emergency_unregister_virt_callback(kvm_x86_ops.emergency_disable_virtualization_cpu);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
which I hadn't noticed before, because I did just allmodconfig builds.
But with a smaller config, the above error happens.
The culprit is commit 590b09b1d88e ("KVM: x86: Register "emergency
disable" callbacks when virt is enabled"), and the reason seems to be
this:
#if IS_ENABLED(CONFIG_KVM_INTEL) || IS_ENABLED(CONFIG_KVM_AMD)
void cpu_emergency_register_virt_callback(cpu_emergency_virt_cb *callback);
...
ie if you have a config with KVM enabled, but neither KVM_INTEL nor
KVM_AMD set, you don't get that callback thing.
The fix may be something like the attached.
Linus
arch/x86/include/asm/reboot.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h
index d0ef2a678d66..c02183d3cdd7 100644
--- a/arch/x86/include/asm/reboot.h
+++ b/arch/x86/include/asm/reboot.h
@@ -31,6 +31,8 @@ void cpu_emergency_register_virt_callback(cpu_emergency_virt_cb *callback);
void cpu_emergency_unregister_virt_callback(cpu_emergency_virt_cb *callback);
void cpu_emergency_disable_virtualization(void);
#else
+static inline void cpu_emergency_register_virt_callback(cpu_emergency_virt_cb *callback) {}
+static inline void cpu_emergency_unregister_virt_callback(cpu_emergency_virt_cb *callback) {}
static inline void cpu_emergency_disable_virtualization(void) {}
#endif /* CONFIG_KVM_INTEL || CONFIG_KVM_AMD */