linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
Cc: x86-ml <x86@kernel.org>, Yves Dionne <yves.dionne@gmail.com>,
	Brice Goglin <Brice.Goglin@inria.fr>,
	Peter Zijlstra <peterz@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID
Date: Wed, 1 Feb 2017 23:41:50 +0100	[thread overview]
Message-ID: <20170201224150.ohb7f7jvbttnikkz@pd.tnic> (raw)
In-Reply-To: <20170201222507.qvcn6dsxucn6fqcv@pd.tnic>

On Wed, Feb 01, 2017 at 11:25:07PM +0100, Borislav Petkov wrote:
> On Wed, Feb 01, 2017 at 09:55:44PM +0000, Ghannam, Yazen wrote:
> > Okay, in that case I would prefer to define a synthetic bit. I think it'll be a lot
> > more clear.
> 
> No need - it is ok this way too. Now let me apply your changes ontop.
> I'd like to have two separate patches for this.

Ok, here are your changes ontop of the first patch. We can still avoid
the division on SMT-off systems.

More playing with this tomorrow. It is late here and brain wants to
sleep now.

---
>From 4b3b9626ef8a535df304aaa017b61436a3b37922 Mon Sep 17 00:00:00 2001
From: Yazen Ghannam <Yazen.Ghannam@amd.com>
Date: Wed, 1 Feb 2017 23:33:16 +0100
Subject: [PATCH] x86/CPU/AMD: Fix Zen SMT topology

After a33d331761bc ("x86/CPU/AMD: Fix Bulldozer topology"), 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>
---
 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 e7158afb322b..349b7d9baf3f 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.
-- 
2.11.0

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

  reply	other threads:[~2017-02-01 22:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 20:02 [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov
2017-02-01 21:37 ` Ghannam, Yazen
2017-02-01 21:44   ` Borislav Petkov
2017-02-01 21:55     ` Ghannam, Yazen
2017-02-01 22:25       ` Borislav Petkov
2017-02-01 22:41         ` Borislav Petkov [this message]
2017-02-02 12:10           ` Borislav Petkov
2017-02-02 15:43             ` Borislav Petkov
2017-02-02 16:09               ` Ingo Molnar
2017-02-02 17:04                 ` Borislav Petkov
2017-02-02 18:10                   ` Borislav Petkov
2017-02-02 20:45                     ` Ghannam, Yazen
2017-02-02 16:14             ` Ghannam, Yazen
2017-02-02 16:29               ` Ingo Molnar

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=20170201224150.ohb7f7jvbttnikkz@pd.tnic \
    --to=bp@alien8.de \
    --cc=Brice.Goglin@inria.fr \
    --cc=Yazen.Ghannam@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=yves.dionne@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).