Re: [RFC][PATCH 5/6] x86/topo: Fix SNC topology mess

From: Chen, Yu C

Date: Sat Feb 28 2026 - 02:36:36 EST


On 2/28/2026 3:23 AM, Tim Chen wrote:
On Fri, 2026-02-27 at 14:01 +0100, Peter Zijlstra wrote:
On Thu, Feb 26, 2026 at 11:00:38AM -0800, Tim Chen wrote:
May be a good idea to sanity check that the nodes in the first unit cluster
has the same package id and give a WARNING if that's not the case.

But then we'd also have check the second cluster is another package. And
if we're checking that, we might as well check they're symmetric.

Is this sufficiently paranoid for you? :-)


Thanks. Looks pretty good and hopefully those warnings will
never be triggered.

+
+/* If you NUMA_EMU on top of SNC, you get to keep the pieces */
+static void slit_validate(void)
+{
+ u32 pkg1 = slit_cluster_package(0);
+ u32 pkg2 = slit_cluster_package(__num_nodes_per_package);
+ WARN_ON(pkg1 == ~0 || pkg2 == ~0 || pkg1 == pkg2);
+
+ WARN_ON(!slit_cluster_symmetric(0));
+ WARN_ON(!slit_cluster_symmetric(__num_nodes_per_package));
+}
+

Here we check packages0 and 1, should we check all the packages?

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 8735f1968b00..91bac3e2e7fd 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -543,12 +543,13 @@ static u32 slit_cluster_package(int N)
/* If you NUMA_EMU on top of SNC, you get to keep the pieces */
static void slit_validate(void)
{
- u32 pkg1 = slit_cluster_package(0);
- u32 pkg2 = slit_cluster_package(__num_nodes_per_package);
- WARN_ON(pkg1 == ~0 || pkg2 == ~0 || pkg1 == pkg2);
+ for (int pkg = 0; pkg < topology_max_packages(); pkg++) {
+ int node = pkg * __num_nodes_per_package;
+ u32 pkg_id = slit_cluster_package(node);

- WARN_ON(!slit_cluster_symmetric(0));
- WARN_ON(!slit_cluster_symmetric(__num_nodes_per_package));
+ WARN_ON(pkg_id == ~0);
+ WARN_ON(!slit_cluster_symmetric(node));
+ }
}