From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 E5B603E3D95 for ; Tue, 3 Mar 2026 11:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772535921; cv=none; b=OtCRIIwfeLNlPHGTrs51hwTBcXgcecPAWu2CMkaioU09c7w0+m9+qHFX4uLL3aXi/Eqr4FGy+6tK7wLehvwFfIeuArKigsueMrBfpPcVELibEnXeNcbGoyQEa3xVkpUT0SldOKWVHc1lu8hebV8m4BmPTarmfPdX/kQ6KesTkgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772535921; c=relaxed/simple; bh=F8R+y6/EylwzWzyaxwcTjz6H8iyIl+UOEqaIjVMxc54=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ABYGPEdmt/Og1XldnF5gWpfTYMhdbG0NPV7C1mpa7dZBL6yKjSuQLUClGyxuOmVConnmHgN5oNu572NC/wL9/oNtIDUP9COoKoPJ73+umqyz7u4LmCMleN8DiIZi2oZMCBh7fE/9A68GkRcOS/RclP12Q081a1XgDo3hlhU7DvM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=o48TG1Yq; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="o48TG1Yq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=ci91p6pqwet/SKAUe2Pma4oELxRY3XGsVVRNOVEh4+g=; b=o48TG1YqzY0K1NGkrW+ZLGuXAf 7rPLLQIqQdpIKT7DHidX4xM20AD7R9KisWVoDby7WBguu+nHzedvyCfIcCBjorktrJnp5E3d21IIj GYRxowpw24sWmOzeyat2DFjE1X3gNmx5XuuVc38iIB9+IQGh0sOR7XDiGhPK8+hcDJRsN3Pjfr5cR Zr7w0IrfLEEPJEUudQjoXvC3DA/JueJtoAWRXqGNke0MakyIzV2wT8NWhEyMF3w+GCJ+PBZg7bJAj s62KUlDPOMph4MjnxZPcaWHNulpdaYqFV9uSX58vz4oMuKJnr5p9Ze3LvWdkAisPQ25Jbhg7o2DSR y1KHoPZQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vxNYu-00000002Bz3-19j0; Tue, 03 Mar 2026 11:05:12 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id 2E1DB3031E9; Tue, 03 Mar 2026 12:05:09 +0100 (CET) Message-ID: <20260303110100.123701837@infradead.org> User-Agent: quilt/0.68 Date: Tue, 03 Mar 2026 11:55:42 +0100 From: Peter Zijlstra To: x86@kernel.org, tglx@kernel.org Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, tim.c.chen@linux.intel.com, yu.c.chen@intel.com, kyle.meyer@hpe.com, vinicius.gomes@intel.com, brgerst@gmail.com, hpa@zytor.com, kprateek.nayak@amd.com, patryk.wlazlyn@linux.intel.com, rafael.j.wysocki@intel.com, russ.anderson@hpe.com, zhao1.liu@intel.com, tony.luck@intel.com, Zhang Rui Subject: [PATCH v2 3/5] x86/topo: Replace x86_has_numa_in_package References: <20260303105539.428037056@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 .. with the brand spanking new topology_num_nodes_per_package(). Having the topology setup determine this value during MADT/SRAT parsing before SMP bringup avoids having to detect this situation when building the SMP topology masks. Signed-off-by: Peter Zijlstra (Intel) Tested-by: Tony Luck Tested-by: K Prateek Nayak Tested-by: Zhang Rui Tested-by: Chen Yu Tested-by: Kyle Meyer --- arch/x86/kernel/smpboot.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -468,13 +468,6 @@ static int x86_cluster_flags(void) } #endif -/* - * Set if a package/die has multiple NUMA nodes inside. - * AMD Magny-Cours, Intel Cluster-on-Die, and Intel - * Sub-NUMA Clustering have this. - */ -static bool x86_has_numa_in_package; - static struct sched_domain_topology_level x86_topology[] = { SDTL_INIT(tl_smt_mask, cpu_smt_flags, SMT), #ifdef CONFIG_SCHED_CLUSTER @@ -496,7 +489,7 @@ static void __init build_sched_topology( * PKG domain since the NUMA domains will auto-magically create the * right spanning domains based on the SLIT. */ - if (x86_has_numa_in_package) { + if (topology_num_nodes_per_package() > 1) { unsigned int pkgdom = ARRAY_SIZE(x86_topology) - 2; memset(&x86_topology[pkgdom], 0, sizeof(x86_topology[pkgdom])); @@ -550,7 +543,7 @@ int arch_sched_node_distance(int from, i case INTEL_GRANITERAPIDS_X: case INTEL_ATOM_DARKMONT_X: - if (!x86_has_numa_in_package || topology_max_packages() == 1 || + if (topology_max_packages() == 1 || topology_num_nodes_per_package() == 1 || d < REMOTE_DISTANCE) return d; @@ -606,7 +599,7 @@ void set_cpu_sibling_map(int cpu) o = &cpu_data(i); if (match_pkg(c, o) && !topology_same_node(c, o)) - x86_has_numa_in_package = true; + WARN_ON_ONCE(topology_num_nodes_per_package() == 1); if ((i == cpu) || (has_smt && match_smt(c, o))) link_mask(topology_sibling_cpumask, cpu, i);