public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
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 <rui.zhang@intel.com>
Subject: [PATCH v2 3/5] x86/topo: Replace x86_has_numa_in_package
Date: Tue, 03 Mar 2026 11:55:42 +0100	[thread overview]
Message-ID: <20260303110100.123701837@infradead.org> (raw)
In-Reply-To: 20260303105539.428037056@infradead.org

.. 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) <peterz@infradead.org>
Tested-by: Tony Luck <tony.luck@intel.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Kyle Meyer <kyle.meyer@hpe.com>
---
 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);



  parent reply	other threads:[~2026-03-03 11:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 10:55 [PATCH v2 0/5] x86/topo: SNC Divination Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 1/5] x86/numa: Store extra copy of numa_nodes_parsed Peter Zijlstra
2026-03-04 15:46   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 2/5] x86/topo: Add topology_num_nodes_per_package() Peter Zijlstra
2026-03-04 15:46   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` Peter Zijlstra [this message]
2026-03-04 15:46   ` [tip: x86/urgent] x86/topo: Replace x86_has_numa_in_package tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 4/5] x86/topo: Fix SNC topology mess Peter Zijlstra
2026-03-03 11:59   ` Ingo Molnar
2026-03-03 14:45     ` Peter Zijlstra
2026-03-04 15:46   ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2026-03-03 10:55 ` [PATCH v2 5/5] x86/resctrl: Fix SNC detection Peter Zijlstra
2026-03-04 15:46   ` [tip: x86/urgent] " tip-bot2 for Tony Luck
2026-03-03 12:01 ` [PATCH v2 0/5] x86/topo: SNC Divination Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260303110100.123701837@infradead.org \
    --to=peterz@infradead.org \
    --cc=brgerst@gmail.com \
    --cc=hpa@zytor.com \
    --cc=kprateek.nayak@amd.com \
    --cc=kyle.meyer@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patryk.wlazlyn@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=russ.anderson@hpe.com \
    --cc=tglx@kernel.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tony.luck@intel.com \
    --cc=vinicius.gomes@intel.com \
    --cc=x86@kernel.org \
    --cc=yu.c.chen@intel.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox