Skip to content

Commit b1472a6

Browse files
committed
x86/smp: Don't send INIT to boot CPU
Parking CPUs in INIT works well, except for the crash case when the CPU which invokes smp_park_other_cpus_in_init() is not the boot CPU. Sending INIT to the boot CPU resets the whole machine. Prevent this by validating that this runs on the boot CPU. If not fall back and let CPUs hang in HLT. Fixes: 45e34c8 ("x86/smp: Put CPUs into INIT on shutdown if possible") Reported-by: Baokun Li <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Baokun Li <[email protected]> Link: https://lore.kernel.org/r/87ttui91jo.ffs@tglx
1 parent 45e34c8 commit b1472a6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,14 @@ bool smp_park_other_cpus_in_init(void)
14731473
if (apic->wakeup_secondary_cpu_64 || apic->wakeup_secondary_cpu)
14741474
return false;
14751475

1476+
/*
1477+
* If this is a crash stop which does not execute on the boot CPU,
1478+
* then this cannot use the INIT mechanism because INIT to the boot
1479+
* CPU will reset the machine.
1480+
*/
1481+
if (this_cpu)
1482+
return false;
1483+
14761484
for_each_present_cpu(cpu) {
14771485
if (cpu == this_cpu)
14781486
continue;

0 commit comments

Comments
 (0)