x86/cstart: Delete "local" version of save_id() to fix x2APIC SMP bug
Sean Christopherson
reviewerPATCH 1/1 x86/cstart: Delete "local" version of save_id() to fix x2APIC SMP bug
Delete cstart.S's version of save_id() to play nice with 32-bit SMP tests on CPUs that support x2APIC. The local version assumes xAPIC mode and so depending on the underlying "hardware" (e.g. AVIC vs. APICv vs. emulated, and with or without KVM_X86_QUIRK_LAPIC_MMIO_HOLE), may mark the wrong CPU as being online.
--- x86/cstart.S | 7 ------- 1 file changed, 7 deletions(-)
x86/cstart.S +0 -7
@@ -84,13 +84,6 @@ prepare_32: smp_stacktop: .long stacktop - per_cpu_size -save_id: - movl $(APIC_DEFAULT_PHYS_BASE + APIC_ID), %eax - movl (%eax), %eax - shrl $24, %eax - lock btsl %eax, online_cpus - retl - ap_start32: setup_segments mov $-per_cpu_size, %esp
base-commit: 31d91f5c9b7546471b729491664b05c933d64a7a
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
Quoted 10 lines · On Thu, 18 Dec 2025 15:26:18 -0800 Sean Christopherson <[email protected]>…
Delete cstart.S's version of
save_id()to play nice with 32-bit SMP tests on CPUs that support x2APIC. The local version assumes xAPIC mode and so depending on the underlying "hardware" (e.g. AVIC vs. APICv vs. emulated, and with or withoutKVM_X86_QUIRK_LAPIC_MMIO_HOLE), may mark the wrong CPU as being online.Fixes 0991c0ea ("x86: fix APs with APIC ID more that 255 not showing in id_map")Cc Igor Mammedov <[email protected]>Cc Peter Xu <[email protected]>Signed-off-by Sean Christopherson <[email protected]>
Quoted 24 lines
--- x86/cstart.S | 7 ------- 1 file changed, 7 deletions(-)x86/cstart.S +0
-7@@ -84,13 +84,6 @@ prepare_32: smp_stacktop: .long stacktop - per_cpu_size -save_id: - movl $(APIC_DEFAULT_PHYS_BASE + APIC_ID), %eax - movl (%eax), %eax - shrl $24, %eax - lock btsl %eax, online_cpus - retl - ap_start32: setup_segments mov $-per_cpu_size, %espbase-commit:
31d91f5c9b7546471b729491664b05c933d64a7a
Quoted 8 lines · Sean Christopherson
Delete cstart.S's version of
save_id()to play nice with 32-bit SMP tests on CPUs that support x2APIC. The local version assumes xAPIC mode and so depending on the underlying "hardware" (e.g. AVIC vs. APICv vs. emulated, and with or withoutKVM_X86_QUIRK_LAPIC_MMIO_HOLE), may mark the wrong CPU as being online.[...]
Applied to kvm-x86 next, thanks!
[1/1] x86/cstart: Delete "local" version of save_id() to fix x2APIC SMP bug
https://github.com/kvm-x86/kvm-unit-tests/commit/d0052ffe48da