Message ID | 20230807135026.528433010@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1526139vqr; Mon, 7 Aug 2023 08:25:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgeXRlSYuAY+owDdsxXMZnftZyyXpLbHmaJZFAW580pX8nYdqmxqIKOBeXtPLr0gsAxUkO X-Received: by 2002:a17:903:41c7:b0:1b8:ae8c:7bfb with SMTP id u7-20020a17090341c700b001b8ae8c7bfbmr11403451ple.17.1691421896089; Mon, 07 Aug 2023 08:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691421896; cv=none; d=google.com; s=arc-20160816; b=W4V6hN7DVwcDgalgXbJJU6dKnDdGHUGOh9JCvDn1kpUTh/T3aHQtfUbeiEM63VbzZ/ pnvcLOx2zFf3DUZvP7GQ0Yw8Wp9EG/IDRI+f+clTRgmhqVSdviOfYaC6OadWrWXJIub7 Fz/qf5J96d1BtO6kCmIugflSYwzbcnL+7OS1pUAbOpARFqrblVM1VSz/17PF6PUIZx02 bv54fkdxiYpRPlvVl1IYcn5AJoVd1tIJQKPjUHFz+QNfnlLg2c6mpQlE74Xyzp+jTKhZ hMnfn7EeS9ANvGneSl+Uyj3RFOogZATZB+2ngg5Gkt2YcCCwnPdRhJ8UvCaNE/DS0fTg NQrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=WJi6X1yIC43zDH6zaMpRD9ZckoH8t1jG0FLDTsc9drE=; fh=/92WVKYrcN3rA268QXyKzVtm/UtxHeI2lnbU295XDiQ=; b=TvLxdQ7PAHXf7dqhYyKAnujcbQT1Rbn1qIhY3IxyTNNQ5CHDkSegsnt1yo3RCn3Wnc 9VdUty/QtF6sBJCEQKjGmvozNbK7oR0YQQwBahQpZWXP633lsWEsUYfylWYWuzc993af lW4tI3qOofQ/S+/7JX7Fv0BdkNd8dVoIBjO/R0yUQiIHh/GxX4gjsBNm3XvkKO+3EC/g sWAB7nJmQE6Nd0wSj9HSMGHPzTloYzl+/JZoFeitc7RZGDPfnyYypClK3z91sRaGegXM /0OhxI1dCrV41Gc0VcYIq4wcWF2G+6mBt5+POzY0g7DvUMghBWXoRc/0o4oAVTJZYyDa bqhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vo8ZSYrG; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a170903404300b001b8a998c2ebsi5528217pla.363.2023.08.07.08.24.42; Mon, 07 Aug 2023 08:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vo8ZSYrG; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234490AbjHGNwo (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 09:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234474AbjHGNwj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 09:52:39 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C51092 for <linux-kernel@vger.kernel.org>; Mon, 7 Aug 2023 06:52:38 -0700 (PDT) Message-ID: <20230807135026.528433010@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691416356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=WJi6X1yIC43zDH6zaMpRD9ZckoH8t1jG0FLDTsc9drE=; b=vo8ZSYrGigDW+lveybRcUyoE0yAeso3KJgDMtkzOSoevZeD5daxgFasvS4bc6pCVEqppTr VteiTr5e90OtQrLsi7jNkfxlmZDyBNXISJFX7RBpB2r5mhMYoYppkaPkNzaUeJPO2Clb6A E/VEXGrCELg2Ml6T/A20LUvB3cTV3RY+cpm4/28ewHz0D3GZFk7pagLSTq3qPRhmu1pEtA I9RgA6vM2ykefyTF9enJ6VPnbXlNwnunhfxTZ3j3SMjrHCOPr58gIxKd5gNmLUuh14LAfi UDi3FRmtYSksJBHdm4BNuNN+NJckBX/yiuPfP22/PxKs5ihH8zSPBNAVWMh5LQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691416356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=WJi6X1yIC43zDH6zaMpRD9ZckoH8t1jG0FLDTsc9drE=; b=WiPf0GwyvOudYS7HOskUAYOK5noAXwaKrsCmKYnyR9v5PzbkCyCsNziXLWouPJiLHSPYiG gUwxUfmw3Pe9DnBQ== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Tom Lendacky <thomas.lendacky@amd.com>, Andrew Cooper <andrew.cooper3@citrix.com>, Arjan van de Ven <arjan@linux.intel.com>, Huang Rui <ray.huang@amd.com>, Juergen Gross <jgross@suse.com>, Dimitri Sivanich <dimitri.sivanich@hpe.com>, Michael Kelley <mikelley@microsoft.com>, Sohil Mehta <sohil.mehta@intel.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Kan Liang <kan.liang@linux.intel.com>, Zhang Rui <rui.zhang@intel.com>, "Paul E. McKenney" <paulmck@kernel.org>, Feng Tang <feng.tang@intel.com>, Andy Shevchenko <andy@infradead.org> Subject: [patch 02/53] x86/cpu/topology: Make the APIC mismatch warnings complete References: <20230807130108.853357011@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 7 Aug 2023 15:52:36 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773582896008520201 X-GMAIL-MSGID: 1773584405866273788 |
Series |
x86/topology: The final installment
|
|
Commit Message
Thomas Gleixner
Aug. 7, 2023, 1:52 p.m. UTC
Detect all possible combinations of mismatch right in the CPUID evaluation
code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/cpu/common.c | 15 ++-------------
arch/x86/kernel/cpu/topology_common.c | 10 ++++++++++
2 files changed, 12 insertions(+), 13 deletions(-)
Comments
On Mon, Aug 07 2023 at 07:28, Arjan van de Ven wrote: > On 8/7/2023 6:52 AM, T >> >> --- a/arch/x86/kernel/cpu/topology_common.c >> +++ b/arch/x86/kernel/cpu/topology_common.c >> @@ -176,6 +176,16 @@ void cpu_parse_topology(struct cpuinfo_x >> >> parse_topology(&tscan, false); >> >> + if (c->topo.initial_apicid != c->topo.apicid) { >> + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. CPUID: 0x%04x APIC: 0x%04x\n", >> + cpu, c->topo.initial_apicid, c->topo.apicid); >> + } >> + >> + if (c->topo.apicid != cpuid_to_apicid[cpu]) { >> + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. Firmware: 0x%04x APIC: 0x%04x\n", >> + cpu, cpuid_to_apicid[cpu], c->topo.apicid); >> + } >> + > > while these messages are basically the same as current ones they are short one key thing for the user > ... which one of the two will be used. Yes one can look up in the source code where the message comes from > and reverse engineer that... or we can just add this to these pr_err() messages > > > like > > pr_err(FW_BUG "CPU%4u: APIC ID mismatch. CPUID: 0x%04x APIC: 0x%04x. APIC value will be used.\n", > cpu, c->topo.initial_apicid, c->topo.apicid); Good point.
--- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1676,22 +1676,11 @@ static void generic_identify(struct cpui #endif } -/* - * Validate that ACPI/mptables have the same information about the - * effective APIC id and update the package map. - */ -static void validate_apic_and_package_id(struct cpuinfo_x86 *c) +static void update_package_map(struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP unsigned int cpu = smp_processor_id(); - u32 apicid; - apicid = apic->cpu_present_to_apicid(cpu); - - if (apicid != c->topo.apicid) { - pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n", - cpu, apicid, c->topo.initial_apicid); - } BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu)); BUG_ON(topology_update_die_map(c->topo.die_id, cpu)); #else @@ -1876,7 +1865,7 @@ void identify_secondary_cpu(struct cpuin #ifdef CONFIG_X86_32 enable_sep_cpu(); #endif - validate_apic_and_package_id(c); + update_package_map(c); x86_spec_ctrl_setup_ap(); update_srbds_msr(); --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -176,6 +176,16 @@ void cpu_parse_topology(struct cpuinfo_x parse_topology(&tscan, false); + if (c->topo.initial_apicid != c->topo.apicid) { + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. CPUID: 0x%04x APIC: 0x%04x\n", + cpu, c->topo.initial_apicid, c->topo.apicid); + } + + if (c->topo.apicid != cpuid_to_apicid[cpu]) { + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. Firmware: 0x%04x APIC: 0x%04x\n", + cpu, cpuid_to_apicid[cpu], c->topo.apicid); + } + for (dom = TOPO_SMT_DOMAIN; dom < TOPO_MAX_DOMAIN; dom++) { if (tscan.dom_shifts[dom] == x86_topo_system.dom_shifts[dom]) continue;