Skip to contentSkip to conversation

x86: call smp vmxoff in smp stop

RFC PATCH Superseded Xishi Qiu 4 participants 15 messages Jan 4, 2017 – Apr 19, 2017 x86

lore
Share & tools
lore

Xishi Qiu

author
#0 lore raw

RFC PATCH 1/1 x86: call smp vmxoff in smp stop

From: f00186668 <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/smp.c +2 -0
index 68f8cc2..6b64c6b 100644
@@ -162,6 +162,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 +175,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();
 }
Signature · 1 line
1.8.3.1 
author
#1 lore raw

RFC PATCH v2 1/1 x86: call smp vmxoff in smp stop

From: f00186668 <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 7 lines · Xishi Qiu

From: f00186668 <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Looks good, but you need to put your colleague's real name (Tiantian Feng?) in the Signed-off-by line, and you need another Signed-off-by line for yourself.

Thanks,

Paolo

Quoted 33 lines
---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
author
#12 lore raw

PATCH 1/1 x86: call smp vmxoff in smp stop

In reply to Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/smp.c +2 -0
index 68f8cc2..6b64c6b 100644
@@ -162,6 +162,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 +175,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();
 }
Signature · 1 line
1.8.3.1 . 
author
#13 lore raw
Quoted 8 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---

Sorry, I missed something, please ignore this one, thanks.

Quoted 23 lines
 arch/x86/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/smp.c +2 -0
index 68f8cc2..6b64c6b 100644
@@ -162,6 +162,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 +175,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();
 }
author
#3 lore raw

PATCH v3 1/1 x86: call smp vmxoff in smp stop

In reply to Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
Signature · 1 line
1.8.3.1 
#14 lore raw
In reply to Xishi Qiu
url: https://github.com/0day-ci/linux/commits/Xishi-Qiu/x86-call-smp-vmxoff-in-smp-stop/20170115-075446 config: x86_64-randconfig-x017-201703 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3)…

Hi Tiantian,

[auto build test ERROR on tip/auto-latest]
[also build test ERROR on v4.10-rc3 next-20170113]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Xishi-Qiu/x86-call-smp-vmxoff-in-smp-stop/20170115-075446
config: x86_64-randconfig-x017-201703 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

arch/x86/kernel/smp.c: In function 'smp_stop_nmi_callback':

>> arch/x86/kernel/smp.c:165:2: error: implicit declaration of function 'cpu_emergency_vmxoff' [-Werror=implicit-function-declaration]
     cpu_emergency_vmxoff();
     ^~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/cpu_emergency_vmxoff +165 arch/x86/kernel/smp.c

159 static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
160 {
161 /* We are registered on stopping cpu too, avoid spurious NMI */
162 if (raw_smp_processor_id() == atomic_read(&stopping_cpu))
163 return NMI_HANDLED;
164

 > 165		cpu_emergency_vmxoff();

166 stop_this_cpu(NULL);
167
168 return NMI_HANDLED;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw
In reply to Xishi Qiu
Quoted 7 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Xishi,

it's still missing your Signed-off-by.

Paolo

Quoted 33 lines
---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
author
#5 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 6 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Quoted 6 lines
Quoted 1 line

Xishi,

it's still missing your Signed-off-by.

Hi Paolo,

This patch is from fengtiantian, and I just send it for him, so still should add my SOB?

Thanks,
Xishi Qiu

Quoted 38 lines

Paolo

Quoted 26 lines
---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +2 -0
index 68f8cc2..b574d55 100644
@@ -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;

arch/x86/kernel/smp.c static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) · line 182

Quoted 7 lines
arch/x86/kernel/smp.c +1 -0
@@ -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();
 }

.

#6 lore raw
Quoted 15 lines · Xishi Qiu
Quoted 13 lines · Paolo Bonzini
Quoted 7 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Xishi,

Quoted 7 lines
Quoted 2 lines

it's still missing your Signed-off-by.

Hi Paolo,

This patch is from fengtiantian, and I just send it for him, so still should add my SOB?

Yes, both of them should be there. The "signed-off-by" is a sequence of all people that managed the patch---so that would be Tiantian first, then you, then an x86 maintainer.

Paolo

Quoted 44 lines

Thanks,
Xishi Qiu

Quoted 38 lines

Paolo

Quoted 26 lines
---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +2 -0
index 68f8cc2..b574d55 100644
@@ -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;

arch/x86/kernel/smp.c static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) · line 182

Quoted 7 lines
arch/x86/kernel/smp.c +1 -0
@@ -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();
 }

.

author
#7 lore raw

PATCH v4 1/1 x86: call smp vmxoff in smp stop

In reply to Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
Signature · 3 lines
1.8.3.1 

. 
#8 lore raw

Ingo, can you put this in tip?

Thanks,

Paolo

Quoted 41 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

---
 arch/x86/kernel/smp.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/smp.c +3 -0
index 68f8cc2..b574d55 100644
@@ -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();
 }
#9 lore raw
Quoted 12 lines · Paolo Bonzini

Ingo, can you put this in tip?

Thanks,

Paolo

Quoted 5 lines · Xishi Qiu

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Yes, but the changelog is atrcious:

- title should describe the purpose, not the implementation

- CPU is spelled 'CPU' once, then 'cpu' _in the same sentence_!

- typos

- spelling

- the last sentence doesn't even parse ...

Still it's already at V4 and comes with two signoffs and what amounts to a maintainer Ack??

Thanks,

Ingo

#10 lore raw
Quoted 14 lines
Quoted 7 lines · Xishi Qiu
Quoted 5 lines

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Yes, but the changelog is atrcious:

- title should describe the purpose, not the implementation

- CPU is spelled 'CPU' once, then 'cpu' _in the same sentence_!

Quoted 8 lines

- typos

- spelling

- the last sentence doesn't even parse ...

Still it's already at V4 and comes with two signoffs and what amounts to a maintainer Ack??

Well, the v2-v4 were really just about getting the signoffs right. At some point you just get desensitized about the changelog. :(

I'll post v5 with a rewritten commit message.

Paolo

#11 lore raw
Quoted 20 lines · Paolo Bonzini
Quoted 20 lines
Quoted 7 lines · Xishi Qiu
Quoted 5 lines

From: Tiantian Feng <[email protected]>

We need to disable VMX on all CPUs before stop cpu when OS panic, otherwisewe risk hanging up the machine, because the CPU ignore INIT signals when VMX is enabled. In kernel mainline this issue existence.

Yes, but the changelog is atrcious:

- title should describe the purpose, not the implementation

- CPU is spelled 'CPU' once, then 'cpu' _in the same sentence_!

- typos

- spelling

- the last sentence doesn't even parse ...

Quoted 7 lines
Quoted 2 lines

Still it's already at V4 and comes with two signoffs and what amounts to a maintainer Ack??

Well, the v2-v4 were really just about getting the signoffs right. At some point you just get desensitized about the changelog. :(

I'll post v5 with a rewritten commit message.

Thanks!

Ingo