x86: use hard_smp_processor_id to get apic id in identify_cpu
PATCH 1/1 x86: use hard_smp_processor_id to get apic id in identify_cpu
and leave phys_proc_id to use initial apic id.
otherwise, system with apci id lifting will have wrong apicid in /proc/cpuinfo
for 2.6.31 ?
--- arch/x86/kernel/cpu/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +2 -2
@@ -715,7 +715,7 @@ static void __cpuinit generic_identify(s c->initial_apicid = (cpuid_ebx (1 ) >>24 ) &0xFF ;#ifdef CONFIG_X86_32 # ifdef CONFIG_X86_HT - c->apicid = apic->phys_pkg_id (c->initial_apicid,0 ); + c->apicid =hard_smp_processor_id ();# else c->apicid = c->initial_apicid;# endif
@@ -772,7 +772,7 @@ static void __cpuinit identify_cpu(struc }#ifdef CONFIG_X86_64 - c->apicid = apic->phys_pkg_id (c->initial_apicid,0 ); + c->apicid =hard_smp_processor_id ();#endif /*
PATCH 1/1 x86: use c->apicid directly in srat_detect_node
need applied after
| [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu
don't need to read it again, just use stored value.
--- arch/x86/kernel/cpu/amd.c | 2 +- arch/x86/kernel/cpu/intel.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -1
@@ -277,7 +277,7 @@ static void __cpuinit srat_detect_node(s#if defined(CONFIG_NUMA ) && defined(CONFIG_X86_64 )int cpu =smp_processor_id ();int node; -unsigned apicid = cpu_has_apic ?hard_smp_processor_id () : c->apicid; +unsigned apicid = c->apicid; node = c->phys_proc_id;if (apicid_to_node[apicid] !=NUMA_NO_NODE )
arch/x86/kernel/cpu/intel.c +1 -1
@@ -258,7 +258,7 @@ static void __cpuinit srat_detect_node(s#if defined(CONFIG_NUMA ) && defined(CONFIG_X86_64 )unsigned node;int cpu =smp_processor_id (); -int apicid = cpu_has_apic ?hard_smp_processor_id () : c->apicid; +int apicid = c->apicid;/* Don't do the funky fallback heuristics the AMD version employs for now. */
PATCH 1/1 x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
In reply to Yinghai Luand leave phys_proc_id to use initial apic id.
otherwise, system with apci id lifting will have wrong apicid in /proc/cpuinfo
-v2: update the one in detect_extended_topology too.
--- arch/x86/kernel/cpu/addon_cpuid_features.c | 4 ++-- arch/x86/kernel/cpu/common.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +2 -2
@@ -715,7 +715,7 @@ static void __cpuinit generic_identify(s c->initial_apicid = (cpuid_ebx (1 ) >>24 ) &0xFF ;#ifdef CONFIG_X86_32 # ifdef CONFIG_X86_HT - c->apicid = apic->phys_pkg_id (c->initial_apicid,0 ); + c->apicid =hard_smp_processor_id ();# else c->apicid = c->initial_apicid;# endif
@@ -772,7 +772,7 @@ static void __cpuinit identify_cpu(struc }#ifdef CONFIG_X86_64 - c->apicid = apic->phys_pkg_id (c->initial_apicid,0 ); + c->apicid =hard_smp_processor_id ();#endif /*
arch/x86/kernel/cpu/addon_cpuid_features.c +2 -2
@@ -121,9 +121,9 @@ void __cpuinit detect_extended_topology( & core_select_mask; c->phys_proc_id = apic->phys_pkg_id (c->initial_apicid, core_plus_mask_width);/* -* Reinit the apicid, now that we have extended initial_apicid. +* Reinit the apicid, now that we have extended apicid ? */ - c->apicid = apic->phys_pkg_id (c->initial_apicid,0 ); + c->apicid =hard_smp_processor_id (); c->x86_max_cores = (core_level_siblings / smp_num_siblings);
Re: [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
Quoted 2 lines · Yinghai Lu
and leave
phys_proc_idto use initial apic id.
No. We need to be consistent for both phys_proc_id and apicid computations.
i.e., if the bios changes the apic id's and those updated apic id's are not reflected in the initial apic id, then we need to use hard_smp_processor_id() for both phys_proc_id and apicid computations.
On the other platforms (default option) we need to use initial apic id (returned by cpuid).
Quoted 1 line
-v2: update the one in
detect_extended_topologytoo.
This is not required. On these platforms, initial_apicid will be updated (along with the physical apicid) if there are any bios modifications.
Instead of this patch, what we need to do is: Just like the vsmp change, we need to override the phys_pkg_id routine for the platforms where the bios will modify apic id's and where cpuid doesn't reflect the bios modification (for example IBM x445 system etc)
thanks,
suresh
Re: [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
Quoted 9 lines · Suresh Siddha
Quoted 1 line · Yinghai Lu
and leave
phys_proc_idto use initial apic id.No. We need to be consistent for both
phys_proc_idand apicid computations.i.e., if the bios changes the apic id's and those updated apic id's are not reflected in the initial apic id, then we need to use
hard_smp_processor_id()for bothphys_proc_idand apicid computations.
then you may get wrong phys_proc_id for amd system with apic id lifting.
Quoted 6 lines
On the other platforms (default option) we need to use initial apic id (returned by cpuid).
Quoted 1 line
-v2: update the one in
detect_extended_topologytoo.
Quoted 7 lines
This is not required. On these platforms,
initial_apicidwill be updated (along with the physical apicid) if there are any bios modifications.Instead of this patch, what we need to do is: Just like the vsmp change, we need to override the
phys_pkg_idroutine for the platforms where the bios will modify apic id's and where cpuid doesn't reflect the bios modification (for example IBM x445 system etc)
A: phys_pkg_id:
Default option:
use cpu id to get initial apic id, and then use initial apic id to get phys_pkg_id.
exception:
vsmp: need to use apic id to get phys_pkg_id, and apic id and initial apic id is not consistent.
for AMD system with apic id lifting, initial apic id and apic is not consistent. but we should use initial apic id to get phys_pkg_id. and that is consistent to Default option.
B: c->apicid for real apic id?
we already have c->initial_apicid, and c->apicid.
1. for amd system with apicid lifting, should use hard_smp_processor_id to get c->apicid.
2. for intel system (other than vsmp, and x445), c->apicid c->initial_apicid is the same, so could use hard_smp_processor_id
3. for vsmp, and x445, do you want to have c->apicid to have real apic id or the same as initial apic_id?
this patch is trying to make c->apicid to have real apic_id.
YH
Re: [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
Quoted 4 lines · Yinghai Lu
Quoted 3 lines · Suresh Siddha
Quoted 1 line · Yinghai Lu
and leave
phys_proc_idto use initial apic id.
Quoted 8 lines
Quoted 6 lines
No. We need to be consistent for both
phys_proc_idand apicid computations.i.e., if the bios changes the apic id's and those updated apic id's are not reflected in the initial apic id, then we need to use
hard_smp_processor_id()for bothphys_proc_idand apicid computations.then you may get wrong
phys_proc_idfor amd system with apic id lifting.
Then we should add an exception for AMD systems too. And not change generic code.
Quoted 7 lines
A:
phys_pkg_id:
Default option:
use cpu id to get initial apic id, and then use initial apic id to getphys_pkg_id.exception:
vsmp: need to use apic id to getphys_pkg_id, and apic id and initial apic id is not consistent.
Quoted 7 lines
for AMD system with apic id lifting, initial apic id and apic is not consistent. but we should use initial apic id to get
phys_pkg_id. and that is consistent to Default option.B:
c->apicidfor real apic id?
we already havec->initial_apicid, andc->apicid.
1. for amd system with apicid lifting, should usehard_smp_processor_idto getc->apicid.
2. for intel system (other than vsmp, and x445),c->apicidc->initial_apicidis the same, so could usehard_smp_processor_id
On the platforms which don't support cpuid leaf 0xb, apicid and initial apicid might be potentially different if the bios changes the apicid. And we don't want to depend on the bios to get the things correct. So where it is not needed, we don't want to depend on the hard_smp_processor_id() for topology detection.
In short, on all the platforms we want to use initial apic id for apicid and phys_proc_id. And only on the required platforms like x445, vsmp, some AMD platforms, we can have their own mechanisms.
Quoted 1 line
3. for vsmp, and x445, do you want to have
c->apicidto have real apic id or the same as initialapic_id?
On these platforms, c->apicid should be based on their real apic id.
Quoted 2 lines
this patch is trying to make
c->apicidto have realapic_id.
Can you please modify the patch so that we can have exceptions for needed platforms only?
thanks,
suresh
Re: [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
Quoted 5 lines · Suresh Siddha
In short, on all the platforms we want to use initial apic id for apicid and
phys_proc_id. And only on the required platforms like x445, vsmp, some AMD platforms, we can have their own mechanisms.
Quoted 9 lines
Quoted 1 line
3. for vsmp, and x445, do you want to have
c->apicidto have real apic id or the same as initialapic_id?On these platforms,
c->apicidshould be based on their real apic id.Quoted 1 line
this patch is trying to make
c->apicidto have realapic_id.Can you please modify the patch so that we can have exceptions for needed platforms only?
please check this one
[PATCH] x86: use hard_smp_processor_id to get apic id for amd k8 cpus
otherwise, system with apci id lifting will have wrong apicid in /proc/cpuinfo
and use that in srat_detect_node
--- arch/x86/kernel/cpu/amd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +4 -1
@@ -277,7 +277,7 @@ static void __cpuinit srat_detect_node(s#if defined(CONFIG_NUMA ) && defined(CONFIG_X86_64 )int cpu =smp_processor_id ();int node; -unsigned apicid = cpu_has_apic ?hard_smp_processor_id () : c->apicid; +unsigned apicid = c->apicid; node = c->phys_proc_id;if (apicid_to_node[apicid] !=NUMA_NO_NODE )
@@ -437,6 +437,9 @@ static void __cpuinit init_amd(struct cp }if (c->x86 ==0x10 || c->x86 ==0x11 )set_cpu_cap (c,X86_FEATURE_REP_GOOD ); + +/* get apicid instead of initial apic id from cpuid */ + c->apicid =hard_smp_processor_id ();#else /*
Re: [PATCH] x86: use hard_smp_processor_id to get apic id in identify_cpu -v2
Quoted 18 lines · Yinghai Lu
Quoted 5 lines · Suresh Siddha
In short, on all the platforms we want to use initial apic id for apicid and
phys_proc_id. And only on the required platforms like x445, vsmp, some AMD platforms, we can have their own mechanisms.Quoted 9 lines
Quoted 1 line
3. for vsmp, and x445, do you want to have
c->apicidto have real apic id or the same as initialapic_id?On these platforms,
c->apicidshould be based on their real apic id.Quoted 1 line
this patch is trying to make
c->apicidto have realapic_id.Can you please modify the patch so that we can have exceptions for needed platforms only?
please check this one
Quoted 9 lines
[PATCH] x86: use
hard_smp_processor_idto get apic id for amd k8 cpusotherwise, system with apci id lifting will have wrong apicid in
/proc/cpuinfoand use that in
srat_detect_nodeSigned-off-by Yinghai Lu <[email protected]>
Looks better.
PATCH 1/1 x86: use hard_smp_processor_id to get apic id for amd k8 cpus
otherwise, system with apci id lifting will have wrong apicid in /proc/cpuinfo
and use that in srat_detect_node
--- arch/x86/kernel/cpu/amd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +4 -1
@@ -277,7 +277,7 @@ static void __cpuinit srat_detect_node(s#if defined(CONFIG_NUMA ) && defined(CONFIG_X86_64 )int cpu =smp_processor_id ();int node; -unsigned apicid = cpu_has_apic ?hard_smp_processor_id () : c->apicid; +unsigned apicid = c->apicid; node = c->phys_proc_id;if (apicid_to_node[apicid] !=NUMA_NO_NODE )
@@ -437,6 +437,9 @@ static void __cpuinit init_amd(struct cp }if (c->x86 ==0x10 || c->x86 ==0x11 )set_cpu_cap (c,X86_FEATURE_REP_GOOD ); + +/* get apicid instead of initial apic id from cpuid */ + c->apicid =hard_smp_processor_id ();#else /*
[tip:x86/cpu] x86: Use hard_smp_processor_id() to get apic id for AMD K8 cpus
Commit-ID: 0d96b9ff748b5f57d6f1d6d21209f5745245aadc Gitweb: http://git.kernel.org/tip/0d96b9ff748b5f57d6f1d6d21209f5745245aadc Author: Yinghai Lu <[email protected]> AuthorDate: Sat, 29 Aug 2009 13:17:14 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 4 Sep 2009 09:55:29 +0200
x86: Use hard_smp_processor_id() to get apic id for AMD K8 cpus
Otherwise, system with apci id lifting will have wrong apicid in /proc/cpuinfo.
and use that in srat_detect_node().
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/amd.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/amd.c +4 -1
@@ -336,7 +336,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)#if defined(CONFIG_NUMA ) && defined(CONFIG_X86_64 )int cpu =smp_processor_id ();int node; -unsigned apicid = cpu_has_apic ?hard_smp_processor_id () : c->apicid; +unsigned apicid = c->apicid; node =per_cpu (cpu_llc_id, cpu);
@@ -481,6 +481,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) }if (c->x86 ==0x10 || c->x86 ==0x11 )set_cpu_cap (c,X86_FEATURE_REP_GOOD ); + +/* get apicid instead of initial apic id from cpuid */ + c->apicid =hard_smp_processor_id ();#else /*