Skip to contentSkip to conversation

x86/CPU/AMD: Fix Bulldozer topology

PATCH New Borislav Petkov 2 participants 2 messages Jan 5, 2017 – Jan 6, 2017 x86

lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/CPU/AMD: Fix Bulldozer topology

From: Borislav Petkov <[email protected]>

8196dab4fc15 ("x86/cpu: Get rid of compute_unit_id") broke the initial strategy for Bulldozer-based cores' topology, where we consider each thread of a compute unit a standalone core and not a HT or SMT thread.

Revert to the firmware-supplied core_id numbering and do not make them thread siblings as we don't consider them for such even if they technically are, more or less.

Reported-and-tested-by Brice Goglin <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc <[email protected]> # v4.6..
Fixes 8196dab4fc15 ("x86/cpu: Get rid of compute_unit_id")
---
 arch/x86/kernel/cpu/amd.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -8
index 71cae73a5076..1d3167269a67 100644
@@ -309,15 +309,8 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
 
 	/* get information required for multi-node processors */
 	if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {
-		u32 eax, ebx, ecx, edx;
 
-		cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
-		node_id = ecx & 7;
-
-		/* get compute unit information */
-		smp_num_siblings = ((ebx >> 8) & 3) + 1;
-		c->x86_max_cores /= smp_num_siblings;
-		c->cpu_core_id = ebx & 0xff;
+		node_id = cpuid_ecx(0x8000001e) & 7;
 
 		/*
 		 * We may have multiple LLCs if L3 caches exist, so check if we
Signature · 1 line
2.11.0
#1 lore raw
x86/CPU/AMD: Fix Bulldozer topology
Commit-ID:  a33d331761bc5dd330499ca5ceceb67f0640a8e6
Gitweb:     http://git.kernel.org/tip/a33d331761bc5dd330499ca5ceceb67f0640a8e6
Author:     Borislav Petkov <[email protected]>
AuthorDate: Thu, 5 Jan 2017 10:26:38 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 6 Jan 2017 08:37:41 +0100

x86/CPU/AMD: Fix Bulldozer topology

The following commit:

8196dab4fc15 ("x86/cpu: Get rid of compute_unit_id")

... broke the initial strategy for Bulldozer-based cores' topology, where we consider each thread of a compute unit a standalone core and not a HT or SMT thread.

Revert to the firmware-supplied core_id numbering and do not make them thread siblings as we don't consider them for such even if they technically are, more or less.

Reported-and-tested-by Brice Goglin <[email protected]>
Cc <[email protected]> # v4.6+
Cc Andy Lutomirski <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes 8196dab4fc15 ("x86/cpu: Get rid of compute_unit_id")
---
 arch/x86/kernel/cpu/amd.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -8
index 71cae73..1d31672 100644
@@ -309,15 +309,8 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
 
 	/* get information required for multi-node processors */
 	if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {
-		u32 eax, ebx, ecx, edx;
 
-		cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
-		node_id = ecx & 7;
-
-		/* get compute unit information */
-		smp_num_siblings = ((ebx >> 8) & 3) + 1;
-		c->x86_max_cores /= smp_num_siblings;
-		c->cpu_core_id = ebx & 0xff;
+		node_id = cpuid_ecx(0x8000001e) & 7;
 
 		/*
 		 * We may have multiple LLCs if L3 caches exist, so check if we