Skip to content

Commit 3f874c9

Browse files
committed
x86/smp: Don't send INIT to non-present and non-booted CPUs
Vasant reported that kexec() can hang or reset the machine when it tries to park CPUs via INIT. This happens when the kernel is using extended APIC, but the present mask has APIC IDs >= 0x100 enumerated. As extended APIC can only handle 8 bit of APIC ID sending INIT to APIC ID 0x100 sends INIT to APIC ID 0x0. That's the boot CPU which is special on x86 and INIT causes the system to hang or resets the machine. Prevent this by sending INIT only to those CPUs which have been booted once. Fixes: 45e34c8 ("x86/smp: Put CPUs into INIT on shutdown if possible") Reported-by: Dheeraj Kumar Srivastava <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Vasant Hegde <[email protected]> Link: https://lore.kernel.org/r/87cyzwjbff.ffs@tglx
1 parent 6ea7bb0 commit 3f874c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ bool smp_park_other_cpus_in_init(void)
12501250
if (this_cpu)
12511251
return false;
12521252

1253-
for_each_present_cpu(cpu) {
1253+
for_each_cpu_and(cpu, &cpus_booted_once_mask, cpu_present_mask) {
12541254
if (cpu == this_cpu)
12551255
continue;
12561256
apicid = apic->cpu_present_to_apicid(cpu);

0 commit comments

Comments
 (0)