mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Yazen Ghannam <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, bp@suse.de, torvalds@linux-foundation.org,
	Yazen.Ghannam@amd.com, linux-kernel@vger.kernel.org,
	peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org
Subject: [tip:x86/urgent] x86/CPU/AMD: Fix Zen SMT topology
Date: Sun, 5 Feb 2017 03:32:19 -0800	[thread overview]
Message-ID: <tip-08b259631b5a1d912af4832847b5642f377d9101@git.kernel.org> (raw)
In-Reply-To: <20170205105022.8705-2-bp@alien8.de>

Commit-ID:  08b259631b5a1d912af4832847b5642f377d9101
Gitweb:     http://git.kernel.org/tip/08b259631b5a1d912af4832847b5642f377d9101
Author:     Yazen Ghannam <Yazen.Ghannam@amd.com>
AuthorDate: Sun, 5 Feb 2017 11:50:22 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sun, 5 Feb 2017 12:18:45 +0100

x86/CPU/AMD: Fix Zen SMT topology

After:

  a33d331761bc ("x86/CPU/AMD: Fix Bulldozer topology")

our  SMT scheduling topology for Fam17h systems is broken, because
the ThreadId is included in the ApicId when SMT is enabled.

So, without further decoding cpu_core_id is unique for each thread
rather than the same for threads on the same core. This didn't affect
systems with SMT disabled. Make cpu_core_id be what it is defined to be.

Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org> # 4.9
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170205105022.8705-2-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/amd.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 20dc44d..2b4cf04 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -319,6 +319,13 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
 		if (c->x86 == 0x15)
 			c->cu_id = ebx & 0xff;
 
+		if (c->x86 >= 0x17) {
+			c->cpu_core_id = ebx & 0xff;
+
+			if (smp_num_siblings > 1)
+				c->x86_max_cores /= smp_num_siblings;
+		}
+
 		/*
 		 * We may have multiple LLCs if L3 caches exist, so check if we
 		 * have an L3 cache by looking at the L3 cache CPUID leaf.

  reply	other threads:[~2017-02-05 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 10:50 [PATCH 1/2] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov
2017-02-05 10:50 ` [PATCH 2/2] x86/CPU/AMD: Fix Zen SMT topology Borislav Petkov
2017-02-05 11:32   ` tip-bot for Yazen Ghannam [this message]
2017-02-05 11:31 ` [tip:x86/urgent] x86/CPU/AMD: Bring back Compute Unit ID tip-bot for Borislav Petkov

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=tip-08b259631b5a1d912af4832847b5642f377d9101@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=Yazen.Ghannam@amd.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

Powered by JetHome