Skip to contentSkip to conversation

x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems

PATCH New Yazen Ghannam 1 participant 1 message Sep 3, 2016 x86

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems

Socket ID is an unsigned value and starts at 0. Subtracting 1 from it is incorrect and the result will underflow if socket_id=0.

Remove substraction when extracting socket_id from c->apicid.

---
Link:
http://lkml.kernel.org/r/[email protected]

v1->v2:
* Don't do logical AND so as to not restrict # of sockets to 2.

 arch/x86/kernel/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +1 -1
index f3d8a92..793bc23 100644
@@ -365,7 +365,7 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
 	 if (c->x86 != 0x17 || !cpuid_edx(0x80000006))
 		return;
 
-	socket_id	= (c->apicid >> bits) - 1;
+	socket_id	= c->apicid >> bits;
 	core_complex_id	= (c->apicid & ((1 << bits) - 1)) >> 3;
 
 	per_cpu(cpu_llc_id, cpu) = (socket_id << 3) | core_complex_id;
Signature · 1 line
1.9.1