[PATCH v1 2/2] x86, apic: Disable BSP if boot cpu is AP
Eric W. Biederman
ebiederm at xmission.com
Mon Oct 22 16:04:18 EDT 2012
HATAYAMA Daisuke <d.hatayama at jp.fujitsu.com> writes:
> We disable BSP if boot cpu is AP.
> INIT-INIT-SIPI sequence, a protocal to initiate AP, cannot be used for
> BSP since it causes BSP jump to BIOS init code; typical visible
> behaviour is hang or immediate reset, depending on the BIOS init code.
> INIT can be used to reset AP in a fatal system error state as
> described in MP spec 3.7.3 Processor-specific INIT. In contrast, there
> is no processor-specific INIT for BSP to initilize from a fatal system
> error. It might be possible to do so by NMI plus any hand-crafted
> reset code that is carefully designed, but at least I have no idea in
> this direction now.
Has anyone looked at clearing bit 8 of the IA32_APIC_BASE_MSR (0x1B) on
the bootstrap processor? Bit 8 being the bit that indicates we are a
If we can clear that bit INIT will always place the processor in
wait-for-startup-ipi mode and we won't have this problem.
That would also solve the hotunplug the bootstrap processor without
using an NMI as well.
If clearing bit 8 doesn't work and we have to go with a variant of
magically detecting the bootstrap processor. I would make the logic.
1. Test bit 8 to see if we are on the bootstrap processor.
2. If we are not on the bootstrap processor and we don't have a table
that will tell us guess that the bootstrap processor has apic id 0.
It is so overwhelmingly common that the bootstrap processor has apic
id 0 that any other assumption is silly.
More important is testing to see if we are on the bootstrap processor
and if we are not disabling any cpus in that case. As that will
guarantee that introducing code to not start the bootstrap processor
won't cause a regression outside of the kexec on panic case.
More information about the kexec