x86: Fix sibling map with NumaChip
PATCH RESEND 1/1 x86: Fix sibling map with NumaChip
On NumaChip systems, the physical processor ID assignment wasn't accounting for the number of nodes in AMD multi-module processors, giving an incorrect sibling map:
$ cd /sys/devices/system/cpu/cpu29/topology $ grep . * core_id:5 core_siblings:00000000,ff000000 core_siblings_list:24-31 physical_package_id:3 thread_siblings:00000000,30000000 thread_siblings_list:28-29
After fixing:
core_id:5
core_siblings:00000000,ffff0000
core_siblings_list:16-31
physical_package_id:1
thread_siblings:00000000,30000000
thread_siblings_list:28-29
Candidate for stable.
Signed-off-by Daniel J Blueman <[email protected]>
--- arch/x86/kernel/apic/apic_numachip.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
arch/x86/kernel/apic/apic_numachip.c +9 -5
@@ -180,11 +180,15 @@ static int __init numachip_probe(void)static void fixup_cpu_id (struct cpuinfo_x86 *c,int node) { - -if (c->phys_proc_id != node) { - c->phys_proc_id = node; -per_cpu (cpu_llc_id,smp_processor_id ()) = node; - } +u64 val; +u32 nodes; + +per_cpu (cpu_llc_id,smp_processor_id ()) = node; + +/* Account for nodes per socket in multi-core-module processors */ +rdmsrl (MSR_FAM10H_NODE_ID , val); + nodes = ((val >>3 ) &7 ) +1 ; + c->phys_proc_id = node / nodes; }static int parse_oemn (struct acpi_table_header *table)
Signature · 1 line
2.1.0
Borislav Petkov
maintainerQuoted 6 lines · Daniel J Blueman
arch/x86/kernel/apic/apic_numachip.c +0
-2@@ -180,11 +180,15 @@ static int __init numachip_probe(void)static void fixup_cpu_id (struct cpuinfo_x86 *c,int node) { - -if (c->phys_proc_id != node) {
arch/x86/kernel/apic/apic_numachip.c static int __init numachip_probe(void) · line 189
Quoted 10 lines
arch/x86/kernel/apic/apic_numachip.c +7
-3- c->phys_proc_id = node; -per_cpu (cpu_llc_id,smp_processor_id ()) = node; - } +u64 val; +u32 nodes; + +per_cpu (cpu_llc_id,smp_processor_id ()) = node; + +/* Account for nodes per socket in multi-core-module processors */ +rdmsrl (MSR_FAM10H_NODE_ID , val);
You need to check a CPUID bit before accessing that MSR, see amd_get_topology(). get_apic_id() in apic_numachip.c should be corrected too.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--