From patchwork Tue Feb 13 21:05:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 200633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp813015dyb; Tue, 13 Feb 2024 13:16:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXL5X10AGq382sNptNaDR/PEiLjxhvtwzXVy3gi+RNSAKpIn7UPRvujc36Jz1hm8tQXWw/l8AgMPY9LcFlwfW8sWPBAYA== X-Google-Smtp-Source: AGHT+IE/V1QPQv1Q6AZSNfR6ZMRPRPMNpDiFB8ErDUPQ5ww+qAlmxw4Au9Usyofk+7tsay2lNp2R X-Received: by 2002:a05:6512:33d6:b0:511:87eb:8dc4 with SMTP id d22-20020a05651233d600b0051187eb8dc4mr618549lfg.32.1707858986315; Tue, 13 Feb 2024 13:16:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858986; cv=pass; d=google.com; s=arc-20160816; b=UFhOiBnTVf9ZoDAnkXH5j+JsLXDHb8rijXNYU3Fc37ubJPj5nWI2ezoasVV+Ns+E8D dOVAUcOPrJ59aiHtntlP+23rc7JcO7tTqL6TSHHIFc/z7+wnZ9bO3JXPGWHpeMK7agCw Mt3XaJWYUBQKv2jEVVMMUt41PWr5YjEjtcC4mc3PJuuCaN+kXwvGGlQU5LoJNiOLAHkR MCI/4TeCu5gz4Q03WmOrh/6D7fhg6eDwqj6YZ+ttrtepnSOI2U2uO2W4AZ9ipvNoCzIl hkkSCwyazRcRraN2pC9XDG2sb3t0OjILPUnZvygbQs7lRAcvYFSD/nhnVqTpr4l1vojT yfEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=QKxEGyGg+k5hdg4U9ew42w42evdPmIVY0idUHE//9Eo=; fh=JB95d/uWUqIkeG5Pv3NL3aBZWdiFn70NEBQNsKF2jAA=; b=cnymZosB7Mjrhgf465Nd5HLc2vvgwaGhMKPDgC6rOms4AMnzZk/UlVEYPaNHShAG8q VDSNcNHlcWERzMO7vmyh8sd+UAH8R/0TsS5xtPQ9Ly+L+NoIwb72mEhvR0q2t9sqB3k/ MrGKi6OOzd6eD/wGBK7VhCnzxc87pMbzDRdG9pdIkaam5FkKLqeg7Yc5oZhbKNvGNNP+ XUDRdkIsS3OFPZeU7zcz6ubI48W0k2xfHJwGZZR6XuKdXhcpOQTS3ZrjOmytpxDFjqkx G1gBJzOKWCnLB86LbeilAif7l4gx3yK3b9JKn1kRKpdb7YOMzTQjqk2P0rJHkcSMoSwa Q4zQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PmjxtYAv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-64291-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64291-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCXr9hN4JJ66vecpc/iXX34kvTRnfv15H7fvuG5YmOkFcOsSd9+B92Nqz55Ejt6Lo1dbCbATVmT1dTTG/bO6cm/RxyXj/w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a7-20020a170906684700b00a3d39bbd2e4si49047ejs.622.2024.02.13.13.16.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:16:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64291-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PmjxtYAv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-64291-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64291-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E53511F217D9 for ; Tue, 13 Feb 2024 21:16:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24DA97D40C; Tue, 13 Feb 2024 21:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PmjxtYAv"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="of649M5e" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 026C17C09E for ; Tue, 13 Feb 2024 21:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858345; cv=none; b=bMcaWqVNuV41pt2XWg0if/9CBHoCFm5VorTyRYG9xizvF9JVp005L/TzvDlJlacj15VeomIybp1eZN9ua1OEovHrlYpQh+yqV6gqcMxReOK7vFbVsWI/evgkpU+voHj8miOngx3LpLuFNc90o/lwdMFoWaAFIAdC7QkMACwO2X8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858345; c=relaxed/simple; bh=2f2NQCXjq+Qw8tOS36sojhoEEm2F5eey1xvfWfOcfQA=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=jCNC318lNlRCWYc1ROWVRUnoZB0drAB/N35RLtf7JpM3SaeYWa50c/T3IXmyrh5W9edWJ8PNjVwgVHHMYwFWnI+MQrwdQEnuKAjWgYr1qKWmwi93VUGC5+0+43ifdFv0VKryWY4MR48foZ7UtXukwrW5znR/6+ziPe6ZI4EPhK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PmjxtYAv; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=of649M5e; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240213210251.830955273@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707858342; 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=QKxEGyGg+k5hdg4U9ew42w42evdPmIVY0idUHE//9Eo=; b=PmjxtYAv/KDE7FBsI2oGtSa/LXG7fn32Z0EncKnxIjzchDGpDv8SvNcpgg2Dn22KGvvSZY ZY65lMjWRx1CoEwScUSRVRGnTxeCTYbxy0WLxenC7Pwu2fG0CI19GtNA5hWW+XfO/DHBRk WfZny675wTx6m4CL+nMBOdRQSJG0/j+CVuzUsdWX5ZmxTyWLuEKZzivGFu3A5fqEdeSN6c 5iUGY1bS22MFJTNyW1F+IYFSooyfhLummo57bn4q8AnFmVBJznFlN0/XO2XpNCQa/cmX// i4naTJok4iWC24E8zKkL9vritlJfqjFxDUA7oKj0WSzCXgZvpQcRHlPCz77iUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707858342; 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=QKxEGyGg+k5hdg4U9ew42w42evdPmIVY0idUHE//9Eo=; b=of649M5eUBoq4aB75ZUOHpRFlz8D3kS17KTcuLtDTpVBmcyrQs4OHxaw85lThZhXODeuXD oOiwq5eU5mMKJJDg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" Subject: [patch 06/30] x86/mpparse: Use new APIC registration function References: <20240213205415.307029033@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 13 Feb 2024 22:05:42 +0100 (CET) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790819944430827660 X-GMAIL-MSGID: 1790819944430827660 From: Thomas Gleixner Aside of switching over to the new interface, record the number of registered CPUs locally, which allows to make num_processors and disabled_cpus confined to the topology code. No functional change intended. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/mpspec.h | 2 -- arch/x86/kernel/cpu/topology.c | 2 +- arch/x86/kernel/mpparse.c | 17 +++++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) --- --- a/arch/x86/include/asm/mpspec.h +++ b/arch/x86/include/asm/mpspec.h @@ -61,8 +61,6 @@ static inline void e820__memblock_alloc_ #define mpparse_parse_smp_config x86_init_noop #endif -int generic_processor_info(int apicid); - extern DECLARE_BITMAP(phys_cpu_present_map, MAX_LOCAL_APIC); static inline void reset_phys_cpu_present_map(u32 apicid) --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -133,7 +133,7 @@ static void cpu_update_apic(int cpu, u32 cpu_mark_primary_thread(cpu, apicid); } -int generic_processor_info(int apicid) +static int generic_processor_info(int apicid) { int cpu, max = nr_cpu_ids; --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -36,6 +36,8 @@ * Checksum an MP configuration block. */ +static unsigned int num_procs __initdata; + static int __init mpf_checksum(unsigned char *mp, int len) { int sum = 0; @@ -50,16 +52,15 @@ static void __init MP_processor_info(str { char *bootup_cpu = ""; - if (!(m->cpuflag & CPU_ENABLED)) { - disabled_cpus++; + topology_register_apic(m->apicid, CPU_ACPIID_INVALID, m->cpuflag & CPU_ENABLED); + if (!(m->cpuflag & CPU_ENABLED)) return; - } if (m->cpuflag & CPU_BOOTPROCESSOR) bootup_cpu = " (Bootup-CPU)"; pr_info("Processor #%d%s\n", m->apicid, bootup_cpu); - generic_processor_info(m->apicid); + num_procs++; } #ifdef CONFIG_X86_IO_APIC @@ -236,9 +237,9 @@ static int __init smp_read_mpc(struct mp } } - if (!num_processors) + if (!num_procs && !acpi_lapic) pr_err("MPTABLE: no processors registered!\n"); - return num_processors; + return num_procs || acpi_lapic; } #ifdef CONFIG_X86_IO_APIC @@ -529,8 +530,8 @@ static __init void mpparse_get_smp_confi } else BUG(); - if (!early) - pr_info("Processors: %d\n", num_processors); + if (!early && !acpi_lapic) + pr_info("Processors: %d\n", num_procs); /* * Only use the first configuration found. */