Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3047714rwb; Mon, 7 Aug 2023 07:31:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqA8qQjqvM7X8UPHyoJGpx66Aa60F8XckhWvKQegK5sWBICwuF6FUAGKQxFL6RsSYNcz7X X-Received: by 2002:a05:6a20:8e19:b0:135:38b5:7e63 with SMTP id y25-20020a056a208e1900b0013538b57e63mr10629257pzj.46.1691418688078; Mon, 07 Aug 2023 07:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691418688; cv=none; d=google.com; s=arc-20160816; b=rnoq2agvnfJHiuhi9muZKuEmJt3YqsZhZiK2Egdw97kE6rGVHfLPjA5W8z2wFqNYBM Z19zR2JDg/OXH2G2S4B1cAuc71bdGMy5L6uweqhkYGK0Poggo1rYSOK2gBmP9ywjb0BH jwIkMThTIUZ24JOGfmSnoFpFqD3j0JTNJX2J8q6ftmG3oEFAQSFd0NdYRS9nLfm5If8g PwqXjHRfeeaJpTLX4YLIoq5nR+WPOvppnwaHkHxWVXyo4magZMCg6J9AD3lSbmD0Bfqy nu87xf4ginFOwFyQfrYOEl50zP9EiwrhowOQNm23cMAwA1qv6XU7/HpyMKrRq//zZh5+ NDkA== 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 header.s=2020e; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63610a000000b00563571a8d0esi5542570pgb.858.2023.08.07.07.31.16; Mon, 07 Aug 2023 07:31:28 -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 header.s=2020e; 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 S234489AbjHGNwo (ORCPT + 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 ); 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 ; 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 To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko 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: X-Mailing-List: linux-kernel@vger.kernel.org Detect all possible combinations of mismatch right in the CPUID evaluation code. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/common.c | 15 ++------------- arch/x86/kernel/cpu/topology_common.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) --- 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;