Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935240AbdGTIrz (ORCPT ); Thu, 20 Jul 2017 04:47:55 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38638 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934847AbdGTIrv (ORCPT ); Thu, 20 Jul 2017 04:47:51 -0400 Date: Thu, 20 Jul 2017 10:47:47 +0200 From: Ingo Molnar To: Borislav Petkov Cc: Suravee Suthikulpanit , linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, peterz@infradead.org, Yazen.Ghannam@amd.com Subject: Re: [PATCH] x86/amd: Fixup cpu_core_id for family17h downcore configuration Message-ID: <20170720084747.iffsxvuvbtmf3vr4@gmail.com> References: <1500539368-4236-1-git-send-email-suravee.suthikulpanit@amd.com> <20170720083523.GA18515@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170720083523.GA18515@nazgul.tnic> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1498 Lines: 37 * Borislav Petkov wrote: > On Thu, Jul 20, 2017 at 03:29:28AM -0500, Suravee Suthikulpanit wrote: > > For family17h, current cpu_core_id is directly taken from the value > > CPUID_Fn8000001E_EBX[7:0] (CoreId), which is the physical ID of the > > core within a die. However, on system with downcore configuration > > (where not all physical cores within a die are available), > > this could result in the case where cpu_core_id > (cores_per_node - 1). > > > > Fix up the cpu_core_id by breaking down the bitfields of CoreId, > > and calculate relative ID using available topology information. > > > > Signed-off-by: Suravee Suthikulpanit > > --- > > arch/x86/kernel/cpu/amd.c | 61 ++++++++++++++++++++++++++++++++++------------- > > 1 file changed, 45 insertions(+), 16 deletions(-) > > > > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c > > index bb5abe8..e7de105 100644 > > --- a/arch/x86/kernel/cpu/amd.c > > +++ b/arch/x86/kernel/cpu/amd.c > > @@ -310,38 +310,67 @@ static void amd_get_topology(struct cpuinfo_x86 *c) > > > > /* get information required for multi-node processors */ > > if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { > > Please carve this whole TOPOEXT-specific logic out, into a separate > function, say __get_topoext() or so, for better readability/easier > review. Also please do the factoring out in a separate preparatory cleanup patch, so that we can see the two changes isolated. Thanks, Ingo