From: Yazen Ghannam <Yazen.Ghannam@amd.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
<x86@kernel.org>
Cc: <bp@suse.de>, <linux-kernel@vger.kernel.org>,
Yazen Ghannam <Yazen.Ghannam@amd.com>
Subject: [PATCH v2] x86/AMD: Fix Socket ID for LLC topology for AMD Fam17h systems
Date: Fri, 2 Sep 2016 20:40:48 -0500 [thread overview]
Message-ID: <1472866848-1706-1-git-send-email-Yazen.Ghannam@amd.com> (raw)
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
reply other threads:[~2016-09-03 1:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472866848-1706-1-git-send-email-Yazen.Ghannam@amd.com \
--to=yazen.ghannam@amd.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®