diff --git a/bible-local/10-decisions.md b/bible-local/10-decisions.md index 8229ada..f56abff 100644 --- a/bible-local/10-decisions.md +++ b/bible-local/10-decisions.md @@ -2455,3 +2455,28 @@ boundary for archive parsing and Redfish replay. **Consequences:** Uploads, batch conversion, and live Redfish analysis use the updated library. Existing archives must be reopened to receive the new parsing behavior. Historical decision records retain the module paths used at the time. + +## ADL-082 — Topology maps zero-based NUMA nodes to sockets in contiguous blocks + +**Date:** 2026-10-19 + +**Context:** G894-SD3-AAX7-000 (2× Xeon 6760P, SNC2) reports NUMA nodes 0–3 +(`numa-nodes.txt`: 0,1 → package 0; 2,3 → package 1). `buildNUMAMap` assigned +one NUMA node per CPU by rank, so node 1 went to CPU1 and nodes 2–3 got no CPU: +the second BlueField-3, a CX7, four GPUs and four CX8 rendered as unattached +topology nodes. + +**Decision:** The exact map comes first: parser v26 carries the raw +`numa-nodes.txt` as `TopologyEvidence.NUMANodes`, and topology attaches node +`N` to the CPU whose socket is package `P` (`node=N package=P`). Without that +evidence (other sources, older bundles) the fallback applies: when NUMA ids are +zero-based, a socket owns `ceil((maxNode+1)/cpuCount)` consecutive nodes and +node `n` attaches to `cpu[n/perSocket]` — the Linux numbering for SNC/NPS. +Without SNC this is the same one-node-per-socket mapping as before. Non-zero-based +ids keep the socket-number match. The parser dependency moves from v20 to v26 +(no logpile API changes were needed). + +**Consequences:** easy-bee bundles with `numa-nodes.txt` attach every PCIe +device to its real socket. For sources without the map, the fallback can still +misplace devices when only the low nodes of a socket carry them (SNC2 with +devices on nodes 0 and 1 only: node 1 lands on CPU1). diff --git a/cmd/logpile-cpu-audit/main.go b/cmd/logpile-cpu-audit/main.go index 74ab134..c89c5ec 100644 --- a/cmd/logpile-cpu-audit/main.go +++ b/cmd/logpile-cpu-audit/main.go @@ -16,8 +16,8 @@ import ( "time" "git.mchus.pro/mchus/logpile/internal/exporter" - parser "git.mchus.pro/reanimator/parser/v20" - "git.mchus.pro/reanimator/parser/v20/models" + parser "git.mchus.pro/reanimator/parser/v26" + "git.mchus.pro/reanimator/parser/v26/models" ) const auditSchema = "logpile.cpu-identity-audit.v1" diff --git a/cmd/logpile-cpu-audit/main_test.go b/cmd/logpile-cpu-audit/main_test.go index 9d51b3b..bee1cfd 100644 --- a/cmd/logpile-cpu-audit/main_test.go +++ b/cmd/logpile-cpu-audit/main_test.go @@ -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 TestIsAuditCandidate(t *testing.T) { diff --git a/cmd/logpile/main.go b/cmd/logpile/main.go index 36ba87c..6faafeb 100644 --- a/cmd/logpile/main.go +++ b/cmd/logpile/main.go @@ -13,7 +13,7 @@ import ( "git.mchus.pro/mchus/logpile/internal/server" "git.mchus.pro/mchus/logpile/web" - parser "git.mchus.pro/reanimator/parser/v20" + parser "git.mchus.pro/reanimator/parser/v26" ) var ( diff --git a/go.mod b/go.mod index 14305fc..a77d3a4 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.24.0 require reanimator/chart v0.0.0 -require git.mchus.pro/reanimator/parser/v20 v20.0.0 +require git.mchus.pro/reanimator/parser/v26 v26.0.0 replace reanimator/chart => ./internal/chart diff --git a/go.sum b/go.sum index f50a1d0..489ccc4 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -git.mchus.pro/reanimator/parser/v20 v20.0.0 h1:hH7X+VvKjAQRboRaV4DTW545Pu6zd13U7zcMsq7OnqU= -git.mchus.pro/reanimator/parser/v20 v20.0.0/go.mod h1:hkb0lxWdVPWOsi8DsIDJ30S5WD4ddRl9ab7rR3BarCQ= +git.mchus.pro/reanimator/parser/v26 v26.0.0 h1:fUd9iVUKA3VGIojNm88/Ey83Y9yOl2eKAk2+0HesvoY= +git.mchus.pro/reanimator/parser/v26 v26.0.0/go.mod h1:n3Tn5wapPai/rxJHsaC9W7Vr/vo1srDBatX566fnIkg= diff --git a/internal/analyzer/analyzer.go b/internal/analyzer/analyzer.go index 9d75459..4a3d352 100644 --- a/internal/analyzer/analyzer.go +++ b/internal/analyzer/analyzer.go @@ -1,6 +1,6 @@ package analyzer -import "git.mchus.pro/reanimator/parser/v20/models" +import "git.mchus.pro/reanimator/parser/v26/models" // Analyzer processes parsed IPMI data type Analyzer struct { diff --git a/internal/collector/ipmi_mock.go b/internal/collector/ipmi_mock.go index 1bb7dce..61ee027 100644 --- a/internal/collector/ipmi_mock.go +++ b/internal/collector/ipmi_mock.go @@ -4,7 +4,7 @@ import ( "context" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type IPMIMockConnector struct{} diff --git a/internal/collector/redfish.go b/internal/collector/redfish.go index 4ca6ca2..74b8285 100644 --- a/internal/collector/redfish.go +++ b/internal/collector/redfish.go @@ -19,8 +19,8 @@ import ( "time" "git.mchus.pro/mchus/logpile/internal/collector/redfishprofile" - parser "git.mchus.pro/reanimator/parser/v20" - "git.mchus.pro/reanimator/parser/v20/models" + parser "git.mchus.pro/reanimator/parser/v26" + "git.mchus.pro/reanimator/parser/v26/models" ) type RedfishConnector struct { diff --git a/internal/collector/redfishprofile/matcher.go b/internal/collector/redfishprofile/matcher.go index 9bd1818..961053b 100644 --- a/internal/collector/redfishprofile/matcher.go +++ b/internal/collector/redfishprofile/matcher.go @@ -3,7 +3,7 @@ package redfishprofile import ( "sort" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) const ( diff --git a/internal/collector/redfishprofile/profiles_common.go b/internal/collector/redfishprofile/profiles_common.go index 14c14af..3448675 100644 --- a/internal/collector/redfishprofile/profiles_common.go +++ b/internal/collector/redfishprofile/profiles_common.go @@ -3,7 +3,7 @@ package redfishprofile import ( "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type staticProfile struct { diff --git a/internal/collector/redfishprofile/types.go b/internal/collector/redfishprofile/types.go index 400acb0..efbcbfd 100644 --- a/internal/collector/redfishprofile/types.go +++ b/internal/collector/redfishprofile/types.go @@ -3,7 +3,7 @@ package redfishprofile import ( "sort" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type MatchSignals struct { diff --git a/internal/collector/types.go b/internal/collector/types.go index 1cd7451..19114a8 100644 --- a/internal/collector/types.go +++ b/internal/collector/types.go @@ -3,7 +3,7 @@ package collector import ( "context" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type Request struct { diff --git a/internal/exporter/exporter.go b/internal/exporter/exporter.go index 6854216..27e4475 100644 --- a/internal/exporter/exporter.go +++ b/internal/exporter/exporter.go @@ -6,7 +6,7 @@ import ( "io" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // Exporter handles data export in various formats diff --git a/internal/exporter/exporter_csv_test.go b/internal/exporter/exporter_csv_test.go index a66e102..16c9037 100644 --- a/internal/exporter/exporter_csv_test.go +++ b/internal/exporter/exporter_csv_test.go @@ -5,7 +5,7 @@ import ( "encoding/csv" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestExportCSV_IncludesAllComponentTypesWithUsableSerials(t *testing.T) { diff --git a/internal/exporter/generate_example_test.go b/internal/exporter/generate_example_test.go index 80a1cd3..638fb81 100644 --- a/internal/exporter/generate_example_test.go +++ b/internal/exporter/generate_example_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // TestGenerateReanimatorExample generates an example reanimator.json file diff --git a/internal/exporter/reanimator_converter.go b/internal/exporter/reanimator_converter.go index 709495f..11d214b 100644 --- a/internal/exporter/reanimator_converter.go +++ b/internal/exporter/reanimator_converter.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "git.mchus.pro/reanimator/parser/v20/models" - "git.mchus.pro/reanimator/parser/v20/pciids" + "git.mchus.pro/reanimator/parser/v26/models" + "git.mchus.pro/reanimator/parser/v26/pciids" ) var cpuMicrocodeFirmwareRegex = regexp.MustCompile(`(?i)^cpu\d+\s+microcode$`) diff --git a/internal/exporter/reanimator_converter_test.go b/internal/exporter/reanimator_converter_test.go index 22ccb42..5b87c90 100644 --- a/internal/exporter/reanimator_converter_test.go +++ b/internal/exporter/reanimator_converter_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func intPtr(v int) *int { return &v } diff --git a/internal/exporter/reanimator_event_logs_test.go b/internal/exporter/reanimator_event_logs_test.go index 8b52cf8..aee319c 100644 --- a/internal/exporter/reanimator_event_logs_test.go +++ b/internal/exporter/reanimator_event_logs_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestConvertEventLogs_UndatedEventHasNoEventTime(t *testing.T) { diff --git a/internal/exporter/reanimator_integration_test.go b/internal/exporter/reanimator_integration_test.go index 12d4ea4..7ff4610 100644 --- a/internal/exporter/reanimator_integration_test.go +++ b/internal/exporter/reanimator_integration_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // TestFullReanimatorExport tests complete export with realistic data diff --git a/internal/privacy/customer.go b/internal/privacy/customer.go index 65f1496..726c08d 100644 --- a/internal/privacy/customer.go +++ b/internal/privacy/customer.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // Multi-label public suffixes handled explicitly; every other final label is diff --git a/internal/privacy/privacy.go b/internal/privacy/privacy.go index 4c257ba..97d4977 100644 --- a/internal/privacy/privacy.go +++ b/internal/privacy/privacy.go @@ -13,7 +13,7 @@ import ( "strings" "unicode/utf8" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // File is one unit of scanned content (an extracted archive member, or a diff --git a/internal/privacy/rules.go b/internal/privacy/rules.go index db05ec0..8ac83e1 100644 --- a/internal/privacy/rules.go +++ b/internal/privacy/rules.go @@ -5,7 +5,7 @@ import ( "regexp" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) const ( diff --git a/internal/privacy/sanitized.go b/internal/privacy/sanitized.go index 29bcc38..2a84100 100644 --- a/internal/privacy/sanitized.go +++ b/internal/privacy/sanitized.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // A dotted quad, permissive about leading zeros so it also matches the diff --git a/internal/privacy/unit_test.go b/internal/privacy/unit_test.go index 7386bb0..14fc5b6 100644 --- a/internal/privacy/unit_test.go +++ b/internal/privacy/unit_test.go @@ -3,7 +3,7 @@ package privacy import ( "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestIsSensitiveIP(t *testing.T) { diff --git a/internal/server/chart_view_test.go b/internal/server/chart_view_test.go index 4b454bf..9636c67 100644 --- a/internal/server/chart_view_test.go +++ b/internal/server/chart_view_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestHandleChartCurrent_RendersCurrentReanimatorSnapshot(t *testing.T) { diff --git a/internal/server/collect_handlers_test.go b/internal/server/collect_handlers_test.go index 183b962..c4ad7a8 100644 --- a/internal/server/collect_handlers_test.go +++ b/internal/server/collect_handlers_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func newCollectTestServer() (*Server, *httptest.Server) { diff --git a/internal/server/collect_test_helpers_test.go b/internal/server/collect_test_helpers_test.go index f3ebd65..ac736a3 100644 --- a/internal/server/collect_test_helpers_test.go +++ b/internal/server/collect_test_helpers_test.go @@ -6,7 +6,7 @@ import ( "time" "git.mchus.pro/mchus/logpile/internal/collector" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type mockConnector struct { diff --git a/internal/server/device_repository.go b/internal/server/device_repository.go index 0da0f4b..44866da 100644 --- a/internal/server/device_repository.go +++ b/internal/server/device_repository.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type slotFirmwareInfo struct { diff --git a/internal/server/device_repository_test.go b/internal/server/device_repository_test.go index 247be21..d324095 100644 --- a/internal/server/device_repository_test.go +++ b/internal/server/device_repository_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func intPtr(v int) *int { return &v } diff --git a/internal/server/handlers.go b/internal/server/handlers.go index 44e8be8..1d6d963 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -26,8 +26,8 @@ import ( "git.mchus.pro/mchus/logpile/internal/collector" "git.mchus.pro/mchus/logpile/internal/exporter" "git.mchus.pro/mchus/logpile/internal/sanitize" - parser "git.mchus.pro/reanimator/parser/v20" - "git.mchus.pro/reanimator/parser/v20/models" + parser "git.mchus.pro/reanimator/parser/v26" + "git.mchus.pro/reanimator/parser/v26/models" chartviewer "reanimator/chart/viewer" ) diff --git a/internal/server/handlers_firmware_test.go b/internal/server/handlers_firmware_test.go index 994b7bf..a7cde7a 100644 --- a/internal/server/handlers_firmware_test.go +++ b/internal/server/handlers_firmware_test.go @@ -3,7 +3,7 @@ package server import ( "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestExtractFirmwareComponentAndModel_GPUUsesPartNumberFromParentheses(t *testing.T) { diff --git a/internal/server/handlers_gpu_test.go b/internal/server/handlers_gpu_test.go index 183e196..5b40d0a 100644 --- a/internal/server/handlers_gpu_test.go +++ b/internal/server/handlers_gpu_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestHandleGetSerials_WithGPUs(t *testing.T) { diff --git a/internal/server/handlers_serials_test.go b/internal/server/handlers_serials_test.go index 594813a..eaa6cba 100644 --- a/internal/server/handlers_serials_test.go +++ b/internal/server/handlers_serials_test.go @@ -1,7 +1,7 @@ package server import ( - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" "testing" ) diff --git a/internal/server/manual_input_inspect_test.go b/internal/server/manual_input_inspect_test.go index 7f6918e..86c7ced 100644 --- a/internal/server/manual_input_inspect_test.go +++ b/internal/server/manual_input_inspect_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) // TestManualInspectInput is a persistent local debugging harness for checking diff --git a/internal/server/privacy_scan_test.go b/internal/server/privacy_scan_test.go index 2a77494..42139f6 100644 --- a/internal/server/privacy_scan_test.go +++ b/internal/server/privacy_scan_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func samplePrivacyScan() *models.PrivacyScan { diff --git a/internal/server/raw_export.go b/internal/server/raw_export.go index 28dc3de..d371e3f 100644 --- a/internal/server/raw_export.go +++ b/internal/server/raw_export.go @@ -14,7 +14,7 @@ import ( "time" "git.mchus.pro/mchus/logpile/keys" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) const rawExportFormatV1 = "logpile.raw-export.v1" diff --git a/internal/server/raw_export_test.go b/internal/server/raw_export_test.go index 55a5305..7194008 100644 --- a/internal/server/raw_export_test.go +++ b/internal/server/raw_export_test.go @@ -3,7 +3,7 @@ package server import ( "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestBuildParserFieldSummary_MirrorsBoardInfoToTopLevel(t *testing.T) { diff --git a/internal/server/sanitize_handlers_test.go b/internal/server/sanitize_handlers_test.go index e1e51c6..4dc651b 100644 --- a/internal/server/sanitize_handlers_test.go +++ b/internal/server/sanitize_handlers_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func leakDumpBytes(t *testing.T) []byte { diff --git a/internal/server/server.go b/internal/server/server.go index 943fff3..dacc8a7 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -10,8 +10,8 @@ import ( "time" "git.mchus.pro/mchus/logpile/internal/collector" - parser "git.mchus.pro/reanimator/parser/v20" - "git.mchus.pro/reanimator/parser/v20/models" + parser "git.mchus.pro/reanimator/parser/v26" + "git.mchus.pro/reanimator/parser/v26/models" chartviewer "reanimator/chart/viewer" ) diff --git a/internal/server/source_metadata_test.go b/internal/server/source_metadata_test.go index 9f2d69e..ce25e98 100644 --- a/internal/server/source_metadata_test.go +++ b/internal/server/source_metadata_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func TestApplyArchiveSourceMetadata(t *testing.T) { diff --git a/internal/server/topology_view.go b/internal/server/topology_view.go index a36f358..e7787c3 100644 --- a/internal/server/topology_view.go +++ b/internal/server/topology_view.go @@ -6,7 +6,7 @@ import ( "git.mchus.pro/mchus/logpile/internal/exporter" "git.mchus.pro/mchus/logpile/internal/topology" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func currentTopologyDocument(result *models.AnalysisResult) (*models.TopologyDocument, error) { diff --git a/internal/server/topology_view_test.go b/internal/server/topology_view_test.go index 783f682..d9e46d0 100644 --- a/internal/server/topology_view_test.go +++ b/internal/server/topology_view_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) func topologyTestResult() *models.AnalysisResult { diff --git a/internal/topology/build.go b/internal/topology/build.go index d70c83e..d07e923 100644 --- a/internal/topology/build.go +++ b/internal/topology/build.go @@ -9,7 +9,7 @@ import ( "strings" "git.mchus.pro/mchus/logpile/internal/exporter" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) const ContractVersion = "1.0" @@ -20,6 +20,7 @@ var ( nvLinkRE = regexp.MustCompile(`(?i)^NV(\d+)$`) storcliVDRE = regexp.MustCompile(`^PDs for VD (\d+)$`) storcliPDRE = regexp.MustCompile(`^Drive /c(\d+)/e\d+/s\d+$`) + numaNodeRE = regexp.MustCompile(`node=(\d+)\s+package=(\d+)`) ) // PCI vendor IDs of BMC-embedded VGA functions (Matrox G200e*, ASPEED AST*). @@ -65,6 +66,11 @@ func Build(snapshot *exporter.ReanimatorExport, evidence *models.TopologyEvidenc } numaToCPU := buildNUMAMap(pcieDevices, cpuIDs, socketByCPU) + for node, pkg := range parseNUMAPackages(evidenceString(evidence, func(e *models.TopologyEvidence) string { return e.NUMANodes })) { + if cpuID := memoryCPU(pkg, cpuIDs, socketByCPU); cpuID != "" { + numaToCPU[node] = cpuID + } + } bdfToNode := map[string]string{} gpuNodeByBDF := map[string]string{} for i, dev := range pcieDevices { @@ -169,9 +175,15 @@ func buildNUMAMap(devices []exporter.ReanimatorPCIe, cpuIDs []string, sockets [] nodes = append(nodes, n) } sort.Ints(nodes) + // Zero-based NUMA ids: with Sub-NUMA Clustering a socket owns several + // consecutive nodes (SNC2 on 2 sockets: 0,1 -> CPU0, 2,3 -> CPU1). + perSocket := 1 + if hasZero { + perSocket = (nodes[len(nodes)-1] + len(cpuIDs)) / len(cpuIDs) + } for rank, n := range nodes { - if hasZero && rank < len(cpuIDs) { - result[n] = cpuIDs[rank] + if hasZero && n/perSocket < len(cpuIDs) { + result[n] = cpuIDs[n/perSocket] continue } for i, socket := range sockets { @@ -187,6 +199,18 @@ func buildNUMAMap(devices []exporter.ReanimatorPCIe, cpuIDs []string, sockets [] return result } +// parseNUMAPackages reads numa-nodes.txt "node=N package=P" lines: the exact +// socket of every NUMA node, which the guess above lacks under SNC/NPS. +func parseNUMAPackages(raw string) map[int]int { + out := map[int]int{} + for _, m := range numaNodeRE.FindAllStringSubmatch(raw, -1) { + node, _ := strconv.Atoi(m[1]) + pkg, _ := strconv.Atoi(m[2]) + out[node] = pkg + } + return out +} + func pcieKind(d exporter.ReanimatorPCIe) string { c := strings.ToLower(strings.TrimSpace(d.DeviceClass)) model := strings.ToLower(d.Model + " " + d.Manufacturer) diff --git a/internal/topology/build_test.go b/internal/topology/build_test.go index 9ea046d..18fc9b6 100644 --- a/internal/topology/build_test.go +++ b/internal/topology/build_test.go @@ -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) + } +} diff --git a/internal/topology/render.go b/internal/topology/render.go index 828e0f2..788b800 100644 --- a/internal/topology/render.go +++ b/internal/topology/render.go @@ -6,7 +6,7 @@ import ( "sort" "strings" - "git.mchus.pro/reanimator/parser/v20/models" + "git.mchus.pro/reanimator/parser/v26/models" ) type card struct {