Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
libvirt (11.9.0+nvidia4-1) noble; urgency=medium

* util: Fix max socket calculation

-- Nathan Chen <nathanc@nvidia.com> Tue, 03 Feb 2026 21:57:12 -0800

libvirt (11.9.0+nvidia3-1) noble; urgency=medium

* NVIDIA: SAUCE: qemu: Use pci_bus to identify multi-smmuv3 model
Expand Down
32 changes: 29 additions & 3 deletions src/util/virhostcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ virHostCPUParseNode(const char *node,
int siblings;
unsigned int cpu;
int direrr;
g_autoptr(GHashTable) st = g_hash_table_new(g_direct_hash, g_direct_equal);
gpointer sock_resolved;

*threads = 0;
*cores = 0;
Expand All @@ -356,15 +358,29 @@ virHostCPUParseNode(const char *node,
if (virHostCPUGetSocket(cpu, &sock) < 0)
goto cleanup;

virBitmapSetBitExpand(sockets_map, sock);
if (!g_hash_table_lookup_extended(st,
GUINT_TO_POINTER(sock),
NULL,
&sock_resolved)) {
g_hash_table_insert(st,
GUINT_TO_POINTER(sock),
GUINT_TO_POINTER(sock_max));
sock = sock_max;
sock_max++;
} else {
sock = GPOINTER_TO_UINT(sock_resolved);
}

if (sock > sock_max)
sock_max = sock;
virBitmapSetBitExpand(sockets_map, sock);
}

if (direrr < 0)
goto cleanup;

if (sock_max == 0) {
g_hash_table_insert(st, GUINT_TO_POINTER(0), GUINT_TO_POINTER(sock_max));
}

sock_max++;

/* allocate cores maps for each socket */
Expand Down Expand Up @@ -400,6 +416,16 @@ virHostCPUParseNode(const char *node,

if (virHostCPUGetSocket(cpu, &sock) < 0)
goto cleanup;

if (!g_hash_table_lookup_extended(st,
GUINT_TO_POINTER(sock),
NULL,
&sock_resolved)) {
goto cleanup;
}

sock = GPOINTER_TO_UINT(sock_resolved);

if (!virBitmapIsBitSet(sockets_map, sock)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("CPU socket topology has changed"));
Expand Down