[PATCH v5 1/3] x86, apic: add bsp_physical_apicid
HATAYAMA Daisuke
d.hatayama at jp.fujitsu.com
Thu Nov 14 06:16:44 EST 2013
Hello HPA,
I have another question relevant to http://lkml.org/lkml/2013/11/12/311.
(2013/11/12 18:51), HATAYAMA Daisuke wrote:
<cut>
> @@ -2589,3 +2593,14 @@ static int __init lapic_insert_resource(void)
> * that is using request_resource
> */
> late_initcall(lapic_insert_resource);
> +
> +void __init bsp_physical_apicid_init(void)
> +{
> + u32 l, h;
> +
> + if (boot_cpu_data.x86 >= 6 && cpu_has_apic) {
> + rdmsr(MSR_IA32_APICBASE, l, h);
> + if (!(l & MSR_IA32_APICBASE_BSP))
> + bsp_physical_apicid = boot_cpu_data.initial_apicid;
> + }
> +}
So, rigrously, we should not use rdmsr for MSR_IA32_APICBASE here since this can
return wrong value on some clustered system?
At least all the mpparse.c, amdtopology.c and visws_quirks.c has referred to
MP table only, so there's no issue by simply dropping this code.
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 2793d1f..28bea2c 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -681,7 +681,7 @@ static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
> /*
> * Do minimum CPU detection early.
> * Fields really needed: vendor, cpuid_level, family, model, mask,
> - * cache alignment.
> + * cache alignment, initial_apicid.
> * The others are not touched to avoid unwanted side effects.
> *
> * WARNING: this function is only called on the BP. Don't add code here
> @@ -725,6 +725,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
> this_cpu->c_bsp_init(c);
>
> setup_force_cpu_cap(X86_FEATURE_ALWAYS);
> +
> + if (c->cpuid_level >= 0x00000001)
> + c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF;
> }
Can the initial APID IDs obtained in this way using cpuid duplicate on some
clustered system?
Can we consider each apic->get_apic_id() method return *initial* APIC ID?
According to 8.4 Multiple-Processor (MP) Initialization, Intel System Programming
Guide, the APID IDs written into MADT and MP table are the initial ones.
So, APID IDs to be compared with these must be the initial ones.
--
Thanks.
HATAYAMA, Daisuke
More information about the kexec
mailing list