* [PATCH v2] x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems
@ 2016-09-03 1:40 Yazen Ghannam
0 siblings, 0 replies; only message in thread
From: Yazen Ghannam @ 2016-09-03 1:40 UTC (permalink / raw)
To: tglx, mingo, hpa, x86; +Cc: bp, linux-kernel, Yazen Ghannam
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.
Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
---
Link:
http://lkml.kernel.org/r/1472674900-60688-1-git-send-email-Yazen.Ghannam@amd.com
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(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index f3d8a92..793bc23 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -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;
--
1.9.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-03 1:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-03 1:40 [PATCH v2] x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems Yazen Ghannam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®