Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572032

Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID
Date 2017-02-01 23:50 +0100
Message-ID <t6bSW-3Oo-13@gated-at.bofh.it> (permalink)
References <t69o6-26I-21@gated-at.bofh.it> <t6aNc-37z-17@gated-at.bofh.it> <t6aWR-3dV-9@gated-at.bofh.it> <t6b6y-3hm-13@gated-at.bofh.it> <t6bzA-3Hx-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-01 21:10 +0100
  RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-02-01 22:40 +0100
    Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-01 22:50 +0100
      RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-02-01 23:00 +0100
        Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-01 23:30 +0100
          Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-01 23:50 +0100
            Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-02 13:20 +0100
              Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-02 16:50 +0100
                Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Ingo Molnar <mingo@kernel.org> - 2017-02-02 17:20 +0100
                Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-02 18:10 +0100
                Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Borislav Petkov <bp@alien8.de> - 2017-02-02 19:20 +0100
                RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-02-02 21:50 +0100
              RE: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-02-02 17:20 +0100
                Re: [RFC PATCH] x86/CPU/AMD: Bring back Compute Unit ID Ingo Molnar <mingo@kernel.org> - 2017-02-02 17:30 +0100

csiph-web