[PATCH v5] x86: call smp vmxoff in smp stop

From: Paolo Bonzini
Date: Wed Apr 19 2017 - 12:19:01 EST


From: Tiantian Feng <fengtiantian@xxxxxxxxxx>

A CPU in VMX root mode will ignore INIT signals and fail to bring
up the APs after reboot. Therefore, on a panic we disable VMX on all
CPUs before rebooting or triggering kdump.

Do this when halting the machine as well, in case a firmware-level reboot
does not perform a cold reset for all processors. Without doing this,
rebooting the host may hang.

Signed-off-by: Tiantian Feng <fengtiantian@xxxxxxxxxx>
Signed-off-by: Xishi Qiu <qiuxishi@xxxxxxxxxx>
[Rewritten commit message. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
arch/x86/kernel/smp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index d3c66a15bbde..9d7223cad389 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -33,6 +33,7 @@
#include <asm/mce.h>
#include <asm/trace/irq_vectors.h>
#include <asm/kexec.h>
+#include <asm/virtext.h>

/*
* Some notes on x86 processor bugs affecting SMP operation:
@@ -162,6 +163,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
if (raw_smp_processor_id() == atomic_read(&stopping_cpu))
return NMI_HANDLED;

+ cpu_emergency_vmxoff();
stop_this_cpu(NULL);

return NMI_HANDLED;
@@ -174,6 +176,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
asmlinkage __visible void smp_reboot_interrupt(void)
{
ipi_entering_ack_irq();
+ cpu_emergency_vmxoff();
stop_this_cpu(NULL);
irq_exit();
}
--
2.9.3