Re: [patch 37/53] x86/cpu: Detect real BSP on crash kernels

From: Thomas Gleixner
Date: Wed Jan 10 2024 - 09:20:31 EST


On Tue, Jan 09 2024 at 01:54, Zhang, Rui wrote:
> On Mon, 2024-01-08 at 17:13 +0100, Thomas Gleixner wrote:
>> > > Unfortunately this causes a regression on Intel Meteorlake
>> > > platform,
>> > > where the BSP APIC ID is NOT the lowest numbered APIC ID
>> > > (instead,
>> > > CPU12, the first Ecore CPU, has APIC ID 0).
>> >
>> > Bah. Let me think about that.
>>
>> In which order are the APICs/CPUs enumerated by ACPI?
>
>
> This is the order in MADT,
> $ cat apic.dsl | grep x2Apic
> [030h 0048 4] Processor x2Apic ID : 00000010
> [040h 0064 4] Processor x2Apic ID : 00000011
> [050h 0080 4] Processor x2Apic ID : 00000018
> [060h 0096 4] Processor x2Apic ID : 00000019
> [070h 0112 4] Processor x2Apic ID : 00000020
> [080h 0128 4] Processor x2Apic ID : 00000021
> [090h 0144 4] Processor x2Apic ID : 00000028
> [0A0h 0160 4] Processor x2Apic ID : 00000029
> [0B0h 0176 4] Processor x2Apic ID : 00000030
> [0C0h 0192 4] Processor x2Apic ID : 00000031
> [0D0h 0208 4] Processor x2Apic ID : 00000038
> [0E0h 0224 4] Processor x2Apic ID : 00000039
> [0F0h 0240 4] Processor x2Apic ID : 00000000
> [100h 0256 4] Processor x2Apic ID : 00000002
> [110h 0272 4] Processor x2Apic ID : 00000004
> [120h 0288 4] Processor x2Apic ID : 00000006
> [130h 0304 4] Processor x2Apic ID : 00000008
> [140h 0320 4] Processor x2Apic ID : 0000000A
> [150h 0336 4] Processor x2Apic ID : 0000000C
> [160h 0352 4] Processor x2Apic ID : 0000000E
> [170h 0368 4] Processor x2Apic ID : 00000040
> [180h 0384 4] Processor x2Apic ID : 00000042
>
> and this is the order in Linux (from CPU0 to CPUN)
> x2APIC ID of logical processor = 0x20 (32)
> x2APIC ID of logical processor = 0x10 (16)
> x2APIC ID of logical processor = 0x11 (17)
> x2APIC ID of logical processor = 0x18 (24)
> x2APIC ID of logical processor = 0x19 (25)
> x2APIC ID of logical processor = 0x21 (33)
> x2APIC ID of logical processor = 0x28 (40)
> x2APIC ID of logical processor = 0x29 (41)
> x2APIC ID of logical processor = 0x30 (48)
> x2APIC ID of logical processor = 0x31 (49)
> x2APIC ID of logical processor = 0x38 (56)
> x2APIC ID of logical processor = 0x39 (57)
> x2APIC ID of logical processor = 0x0 (0)
> x2APIC ID of logical processor = 0x2 (2)
> x2APIC ID of logical processor = 0x4 (4)
> x2APIC ID of logical processor = 0x6 (6)
> x2APIC ID of logical processor = 0x8 (8)
> x2APIC ID of logical processor = 0xa (10)
> x2APIC ID of logical processor = 0xc (12)
> x2APIC ID of logical processor = 0xe (14)
> x2APIC ID of logical processor = 0x40 (64)
> x2APIC ID of logical processor = 0x42 (66)

What a mess...