x86/smp: Don't send INIT to non-present and non-booted CPUs
authorThomas Gleixner <tglx@linutronix.de>
Wed, 9 Aug 2023 18:52:20 +0000 (20:52 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 4 Sep 2023 13:41:42 +0000 (15:41 +0200)
commit3f874c9b2aae8e30463efc1872bea4baa9ed25dc
treeda39cdc37e055ec152a12f750cb222f683c8f9bd
parent6ea7bb00c1ba180f8bf8320b8d59b532501c5271
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: 45e34c8af58f ("x86/smp: Put CPUs into INIT on shutdown if possible")
Reported-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/87cyzwjbff.ffs@tglx
arch/x86/kernel/smpboot.c