Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/topo: Replace x86_has_numa_in_package

.. 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>
Reviewed-by: Ingo Molnar <mingo@kernel.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>
Link: https://patch.msgid.link/20260303110100.123701837@infradead.org

+3 -10
+3 -10
arch/x86/kernel/smpboot.c
··· 468 468 } 469 469 #endif 470 470 471 - /* 472 - * Set if a package/die has multiple NUMA nodes inside. 473 - * AMD Magny-Cours, Intel Cluster-on-Die, and Intel 474 - * Sub-NUMA Clustering have this. 475 - */ 476 - static bool x86_has_numa_in_package; 477 - 478 471 static struct sched_domain_topology_level x86_topology[] = { 479 472 SDTL_INIT(tl_smt_mask, cpu_smt_flags, SMT), 480 473 #ifdef CONFIG_SCHED_CLUSTER ··· 489 496 * PKG domain since the NUMA domains will auto-magically create the 490 497 * right spanning domains based on the SLIT. 491 498 */ 492 - if (x86_has_numa_in_package) { 499 + if (topology_num_nodes_per_package() > 1) { 493 500 unsigned int pkgdom = ARRAY_SIZE(x86_topology) - 2; 494 501 495 502 memset(&x86_topology[pkgdom], 0, sizeof(x86_topology[pkgdom])); ··· 543 550 case INTEL_GRANITERAPIDS_X: 544 551 case INTEL_ATOM_DARKMONT_X: 545 552 546 - if (!x86_has_numa_in_package || topology_max_packages() == 1 || 553 + if (topology_max_packages() == 1 || topology_num_nodes_per_package() == 1 || 547 554 d < REMOTE_DISTANCE) 548 555 return d; 549 556 ··· 599 606 o = &cpu_data(i); 600 607 601 608 if (match_pkg(c, o) && !topology_same_node(c, o)) 602 - x86_has_numa_in_package = true; 609 + WARN_ON_ONCE(topology_num_nodes_per_package() == 1); 603 610 604 611 if ((i == cpu) || (has_smt && match_smt(c, o))) 605 612 link_mask(topology_sibling_cpumask, cpu, i);