public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] x86: Fix sibling map with NumaChip
@ 2015-03-03 15:18 Daniel J Blueman
  2015-03-03 16:29 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel J Blueman @ 2015-03-03 15:18 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin
  Cc: x86, linux-kernel, Steffen Persvold, Daniel J Blueman

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 <daniel@numascale.com>
---
 arch/x86/kernel/apic/apic_numachip.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 19f893f..a59768b 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -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)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] x86: Fix sibling map with NumaChip
  2015-03-03 15:18 [PATCH RESEND] x86: Fix sibling map with NumaChip Daniel J Blueman
@ 2015-03-03 16:29 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2015-03-03 16:29 UTC (permalink / raw)
  To: Daniel J Blueman
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, x86, linux-kernel,
	Steffen Persvold

On Tue, Mar 03, 2015 at 11:18:13PM +0800, Daniel J Blueman wrote:
> @@ -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);

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.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-03 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 15:18 [PATCH RESEND] x86: Fix sibling map with NumaChip Daniel J Blueman
2015-03-03 16:29 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox