From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbdBELds (ORCPT ); Sun, 5 Feb 2017 06:33:48 -0500 Received: from terminus.zytor.com ([65.50.211.136]:55740 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdBELdq (ORCPT ); Sun, 5 Feb 2017 06:33:46 -0500 Date: Sun, 5 Feb 2017 03:32:19 -0800 From: tip-bot for Yazen Ghannam Message-ID: 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 Reply-To: torvalds@linux-foundation.org, bp@suse.de, hpa@zytor.com, Yazen.Ghannam@amd.com, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@kernel.org In-Reply-To: <20170205105022.8705-2-bp@alien8.de> References: <20170205105022.8705-2-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/CPU/AMD: Fix Zen SMT topology Git-Commit-ID: 08b259631b5a1d912af4832847b5642f377d9101 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 08b259631b5a1d912af4832847b5642f377d9101 Gitweb: http://git.kernel.org/tip/08b259631b5a1d912af4832847b5642f377d9101 Author: Yazen Ghannam AuthorDate: Sun, 5 Feb 2017 11:50:22 +0100 Committer: Ingo Molnar 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 Signed-off-by: Borislav Petkov Cc: # 4.9 Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20170205105022.8705-2-bp@alien8.de Signed-off-by: Ingo Molnar --- 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.