[PATCH 04/16] x86/reboot: Assert that IRQs are disabled when turning off virtualization
From: Sean Christopherson
Date: Thu Dec 01 2022 - 18:27:26 EST
Assert that IRQs are disabled when turning off virtualization in an
emergency. KVM enables hardware via on_each_cpu(), i.e. could re-enable
hardware if a pending IPI were delivered after disabling virtualization.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kernel/reboot.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 78182b2969db..40ea16ecb3b8 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -838,6 +838,8 @@ int crashing_cpu = -1;
*/
void cpu_emergency_disable_virtualization(void)
{
+ lockdep_assert_irqs_disabled();
+
#if IS_ENABLED(CONFIG_KVM_INTEL)
cpu_crash_vmclear_loaded_vmcss();
#endif
--
2.39.0.rc0.267.gcb52ba06e7-goog