From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756053AbcK2Tje (ORCPT ); Tue, 29 Nov 2016 14:39:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:38938 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbcK2Tj0 (ORCPT ); Tue, 29 Nov 2016 14:39:26 -0500 Date: Tue, 29 Nov 2016 20:39:23 +0100 From: Borislav Petkov To: Brice Goglin Cc: LKML , Thomas Gleixner Subject: Re: AMD Bulldozer topology regression since 4.6 Message-ID: <20161129193923.x2i6hctkdwalzfn5@pd.tnic> References: <583D2833.4030508@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <583D2833.4030508@inria.fr> User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2016 at 08:03:15AM +0100, Brice Goglin wrote: > This causes user-space tools (at least all that rely on hwloc for > topology discovery) to think the processor has dual-threaded cores > instead of dual-core compute-unit modules. > > The cause is likely this patch, which seems to assume both cores of a > same compute-unit have the same ID, which is wrong? Does that fix it? Patch is against latest tip/master because we have some more changes in that area. --- diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 4daad1e39352..a070d7b0a133 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -305,15 +305,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) /* get information required for multi-node processors */ if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { - u32 eax, ebx, ecx, edx; - - cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); - node_id = ecx & 7; - - /* get compute unit information */ - smp_num_siblings = ((ebx >> 8) & 3) + 1; - c->x86_max_cores /= smp_num_siblings; - c->cpu_core_id = ebx & 0xff; + node_id = cpuid_ecx(0x8000001e) & 7; /* * We may have multiple LLCs if L3 caches exist, so check if we --- Just in case, I have one against Linus' master too: --- diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 1e81a37c034e..19f50a9d6b42 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -305,15 +305,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c) /* get information required for multi-node processors */ if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { - u32 eax, ebx, ecx, edx; - - cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); - node_id = ecx & 7; - - /* get compute unit information */ - smp_num_siblings = ((ebx >> 8) & 3) + 1; - c->x86_max_cores /= smp_num_siblings; - c->cpu_core_id = ebx & 0xff; + node_id = cpuid_ecx(0x8000001e) & 7; } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { u64 value; --- -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --