qemu: Allow to define NUMA nodes without memory or CPUs assigned

Allow to define NUMA nodes without memory or CPUs assigned to properly
support the new acpi-generic-initiator device.

This is required because the NUMA nodes passed to the
acpi-generic-initiator object must be independent and not be shared with
other resources, such as CPU or memory.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
This commit is contained in:
Andrea Righi authored and Daniel P. Berrangé committed 2025-09-08 18:06:33 +01:00
1 parent daccea611d
commit b21822a29c
2 files changed
+15 -7

No files matched your search

+3
View File
@@ -1492,6 +1492,9 @@ virDomainNumaFillCPUsInNode(virDomainNuma *numa,
if (node >= virDomainNumaGetNodeCount(numa))
return -1;
if (virDomainNumaGetNodeMemorySize(numa, node) == 0)
return 0;
virBitmapSetAll(maxCPUsBitmap);
for (i = 0; i < numa->nmem_nodes; i++) {
+12 -7
View File
@@ -7820,7 +7820,9 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
}
}
if (masterInitiator < 0) {
/* HMAT requires a master initiator, so when it's enabled, ensure that
* at least one NUMA node has CPUs assigned. */
if (hmat && masterInitiator < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("At least one NUMA node has to have CPUs"));
goto cleanup;
@@ -7828,8 +7830,9 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
for (i = 0; i < ncells; i++) {
ssize_t initiator = virDomainNumaGetNodeInitiator(def->numa, i);
unsigned long long memSize = virDomainNumaGetNodeMemorySize(def->numa, i);
if (needBackend) {
if (needBackend && memSize > 0) {
g_autoptr(virJSONValue) tcProps = NULL;
if (qemuBuildThreadContextProps(&tcProps, &nodeBackends[i],
@@ -7857,11 +7860,13 @@ qemuBuildNumaCommandLine(virQEMUDriverConfig *cfg,
virBufferAsprintf(&buf, ",initiator=%zd", initiator);
}
if (needBackend)
virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
else
virBufferAsprintf(&buf, ",mem=%llu",
virDomainNumaGetNodeMemorySize(def->numa, i) / 1024);
if (memSize > 0) {
if (needBackend) {
virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
} else {
virBufferAsprintf(&buf, ",mem=%llu", memSize / 1024);
}
}
virCommandAddArgBuffer(cmd, &buf);
}