fix(topology): attach SNC/NPS NUMA nodes to their real socket

Topology mapped one NUMA node per CPU, so on a 2-socket SNC2 host
(nodes 0-3) node 1 went to CPU1 and nodes 2-3 got no CPU: the second
BlueField-3, four GPUs and several NICs rendered unattached.

Use numa-nodes.txt (node=N package=P), now carried by parser v26 as
TopologyEvidence.NUMANodes; without it, fall back to contiguous
per-socket blocks of zero-based node ids. Pin parser v26.0.0. ADL-082.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikhail ChusavitinandClaude Opus 5.5 committed 2026-10-19 13:41:22 +03:00
1 parent 23cda0fc83
commit c4870cfb36
46 files changed
+155 -53

No files matched your search

+54 -1
View File
@@ -6,7 +6,7 @@ import (
"testing"
"git.mchus.pro/mchus/logpile/internal/exporter"
"git.mchus.pro/reanimator/parser/v20/models"
"git.mchus.pro/reanimator/parser/v26/models"
)
func intp(v int) *int { return &v }
@@ -143,3 +143,56 @@ func TestBuildAttachesHPEMemoryAndRAIDMemberDisks(t *testing.T) {
}
}
}
func TestBuildAttachesSubNUMAClusterNodesToTheirSocket(t *testing.T) {
// SNC2 on 2 sockets: Linux numbers NUMA nodes 0,1 on package 0 and 2,3 on
// package 1. Every device must reach a CPU, not only nodes 0 and 1.
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
CPUs: []exporter.ReanimatorCPU{{Socket: 0}, {Socket: 1}},
PCIeDevices: []exporter.ReanimatorPCIe{
{Slot: "0000:50:00.0", DeviceClass: "NetworkController", Model: "BlueField-3", NUMANode: intp(0)},
{Slot: "0000:5e:00.0", DeviceClass: "VideoController", Model: "GPU", NUMANode: intp(1)},
{Slot: "0000:d0:00.0", DeviceClass: "NetworkController", Model: "BlueField-3", NUMANode: intp(2)},
{Slot: "0000:dd:00.0", DeviceClass: "VideoController", Model: "GPU", NUMANode: intp(3)},
},
}}
doc := Build(snapshot, nil)
want := map[string]string{
"nic:0000:50:00.0": "cpu:0",
"gpu:0000:5e:00.0": "cpu:0",
"nic:0000:d0:00.0": "cpu:1",
"gpu:0000:dd:00.0": "cpu:1",
}
got := map[string]string{}
for _, e := range doc.Edges {
if e.Kind == "pcie" {
got[e.To] = e.From
}
}
for to, from := range want {
if got[to] != from {
t.Errorf("%s attached to %q, want %q", to, got[to], from)
}
}
}
func TestBuildUsesNUMANodePackageEvidence(t *testing.T) {
// SNC2 with devices only on the low node of each package: without the
// numa-nodes.txt map, node 1 would be guessed onto CPU 1.
snapshot := &exporter.ReanimatorExport{Hardware: exporter.ReanimatorHardware{
CPUs: []exporter.ReanimatorCPU{{Socket: 0}, {Socket: 1}},
PCIeDevices: []exporter.ReanimatorPCIe{
{Slot: "0000:50:00.0", DeviceClass: "NetworkController", NUMANode: intp(0)},
{Slot: "0000:5e:00.0", DeviceClass: "VideoController", NUMANode: intp(1)},
},
}}
e := &models.TopologyEvidence{NUMANodes: "node=0 package=0\nnode=1 package=0\nnode=2 package=1\nnode=3 package=1\n"}
doc := Build(snapshot, e)
got := map[string]string{}
for _, edge := range doc.Edges {
got[edge.To] = edge.From
}
if got["nic:0000:50:00.0"] != "cpu:0" || got["gpu:0000:5e:00.0"] != "cpu:0" {
t.Fatalf("pcie edges = %v, want both devices on cpu:0", got)
}
}