2020-03-05 12:41:52

by Cao jin

[permalink] [raw]
Subject: Is this code chunk in init_apic_mappings() superfluous?

Hi,

I am trying to figure the following code chunk out:

if (x2apic_mode) {
boot_cpu_physical_apicid = read_apic_id();
return;
}

As my understanding, even in x2APIC mode, boot_cpu_physical_apicid is
also got via early_acpi_process_madt --> ... --> register_lapic_address,
so, is it for any corner case I am not aware?
--
Sincerely,
Cao jin



2020-03-07 11:29:18

by Thomas Gleixner

[permalink] [raw]
Subject: Re: Is this code chunk in init_apic_mappings() superfluous?

Cao jin <[email protected]> writes:
> Hi,
>
> I am trying to figure the following code chunk out:
>
> if (x2apic_mode) {
> boot_cpu_physical_apicid = read_apic_id();
> return;
> }
>
> As my understanding, even in x2APIC mode, boot_cpu_physical_apicid is
> also got via early_acpi_process_madt --> ... --> register_lapic_address,
> so, is it for any corner case I am not aware?

The case when there are neither ACPI nor valid mptables. Unlikely, but
possible in theory.

Thanks,

tglx

2020-03-11 12:41:07

by Cao jin

[permalink] [raw]
Subject: Re: Is this code chunk in init_apic_mappings() superfluous?

On 3/7/20 7:27 PM, Thomas Gleixner wrote:
> Cao jin <[email protected]> writes:
>> Hi,
>>
>> I am trying to figure the following code chunk out:
>>
>> if (x2apic_mode) {
>> boot_cpu_physical_apicid = read_apic_id();
>> return;
>> }
>>
>> As my understanding, even in x2APIC mode, boot_cpu_physical_apicid is
>> also got via early_acpi_process_madt --> ... --> register_lapic_address,
>> so, is it for any corner case I am not aware?
>
> The case when there are neither ACPI nor valid mptables. Unlikely, but
> possible in theory.
>

I noticed this case in its calling comments, but failed to associate it
with a x2APIC...

So init_apic_mapping() is for 2 corner cases that doesn't map APIC
register before: one you mentioned here, and MP default configuration
the other.

Thanks Thomas.

--
Sincerely,
Cao jin