[PATCH 04/48] qemu: Assume QEMU_CAPS_NUMA

Michal Privoznik mprivozn at redhat.com
Tue Nov 8 08:29:06 UTC 2022


Introduced in QEMU's commit of v3.0.0-rc0~124^2~1 the
set-numa-node command is always available for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_domain.c                        | 10 +++------
 src/qemu/qemu_validate.c                      | 21 -------------------
 tests/qemuxml2argvdata/cpu-numa-disjoint.err  |  1 -
 .../fd-memory-numa-topology2.args             |  2 +-
 .../fd-memory-numa-topology2.xml              |  2 +-
 .../fd-memory-numa-topology3.args             |  2 +-
 .../fd-memory-numa-topology3.xml              |  2 +-
 tests/qemuxml2argvdata/numatune-memnode.err   |  1 -
 tests/qemuxml2argvtest.c                      | 21 +++++++------------
 tests/qemuxml2xmltest.c                       | 12 +++++------
 10 files changed, 21 insertions(+), 53 deletions(-)
 delete mode 100644 tests/qemuxml2argvdata/cpu-numa-disjoint.err
 delete mode 100644 tests/qemuxml2argvdata/numatune-memnode.err

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 09e213e48d..c9a622e75a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4531,16 +4531,12 @@ qemuDomainDefTsegPostParse(virDomainDef *def,
  * Returns: 0 on success, -1 on error
  */
 int
-qemuDomainDefNumaCPUsRectify(virDomainDef *def, virQEMUCaps *qemuCaps)
+qemuDomainDefNumaCPUsRectify(virDomainDef *def,
+                             virQEMUCaps *qemuCaps G_GNUC_UNUSED)
 {
     unsigned int vcpusMax, numacpus;
 
-    /* QEMU_CAPS_NUMA tells us if QEMU is able to handle disjointed
-     * NUMA CPU ranges. The filling process will create a disjointed
-     * setup in node0 most of the time. Do not proceed if QEMU
-     * can't handle it.*/
-    if (virDomainNumaGetNodeCount(def->numa) == 0 ||
-        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA))
+    if (virDomainNumaGetNodeCount(def->numa) == 0)
         return 0;
 
     vcpusMax = virDomainDefGetVcpusMax(def);
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 1192bf1804..78c68a99d0 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -983,27 +983,6 @@ static int
 qemuValidateDomainDefNuma(const virDomainDef *def,
                           virQEMUCaps *qemuCaps)
 {
-    size_t ncells = virDomainNumaGetNodeCount(def->numa);
-    size_t i;
-
-    for (i = 0; i < ncells; i++) {
-        virBitmap *cpumask = virDomainNumaGetNodeCpumask(def->numa, i);
-
-        if (cpumask) {
-            g_autofree char * cpumaskStr = NULL;
-            if (!(cpumaskStr = virBitmapFormat(cpumask)))
-                return -1;
-
-            if (strchr(cpumaskStr, ',') &&
-                !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("disjoint NUMA cpu ranges are not supported "
-                                 "with this QEMU"));
-                return -1;
-            }
-        }
-    }
-
     if (virDomainNumaHasHMAT(def->numa)) {
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA_HMAT)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/tests/qemuxml2argvdata/cpu-numa-disjoint.err b/tests/qemuxml2argvdata/cpu-numa-disjoint.err
deleted file mode 100644
index ff4b1cce2e..0000000000
--- a/tests/qemuxml2argvdata/cpu-numa-disjoint.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: disjoint NUMA cpu ranges are not supported with this QEMU
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.args b/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
index 9d8866d914..10952872bf 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
 -overcommit mem-lock=off \
 -smp 20,sockets=1,cores=8,threads=1 \
 -object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0,share=off,prealloc=on,size=15032385536 \
--numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
+-numa node,nodeid=0,cpus=0-7,cpus=16-19,memdev=ram-node0 \
 -object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1,share=on,prealloc=on,size=15032385536 \
 -numa node,nodeid=1,cpus=8-15,memdev=ram-node1 \
 -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
index f6af88a2a8..5b84a49796 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
@@ -16,7 +16,7 @@
   <cpu>
     <topology sockets='1' dies='1' cores='8' threads='1'/>
     <numa>
-      <cell id='0' cpus='0-7' memory='14680064' unit='KiB'/>
+      <cell id='0' cpus='0-7,16-19' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='8-15' memory='14680064' unit='KiB' memAccess='shared'/>
     </numa>
   </cpu>
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.args b/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
index 39ab4e0f2d..e9cb1f0fa5 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
 -overcommit mem-lock=off \
 -smp 32,sockets=1,cores=24,threads=1 \
 -object memory-backend-file,id=ram-node0,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node0,share=on,prealloc=on,size=15032385536 \
--numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
+-numa node,nodeid=0,cpus=0-1,cpus=6-31,memdev=ram-node0 \
 -object memory-backend-file,id=ram-node1,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node1,share=on,prealloc=on,size=15032385536 \
 -numa node,nodeid=1,cpus=2-3,memdev=ram-node1 \
 -object memory-backend-file,id=ram-node2,mem-path=/var/lib/libvirt/qemu/ram/-1-instance-00000092/ram-node2,share=off,prealloc=on,size=15032385536 \
diff --git a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
index 1bf006c21c..1b8fd7dfee 100644
--- a/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
+++ b/tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
@@ -16,7 +16,7 @@
   <cpu>
     <topology sockets='1' dies='1' cores='24' threads='1'/>
     <numa>
-      <cell id='0' cpus='0-1' memory='14680064' unit='KiB'/>
+      <cell id='0' cpus='0-1,6-31' memory='14680064' unit='KiB'/>
       <cell id='1' cpus='2-3' memory='14680064' unit='KiB' memAccess='shared'/>
       <cell id='2' cpus='4-5' memory='14680064' unit='KiB' memAccess='private'/>
     </numa>
diff --git a/tests/qemuxml2argvdata/numatune-memnode.err b/tests/qemuxml2argvdata/numatune-memnode.err
deleted file mode 100644
index ff4b1cce2e..0000000000
--- a/tests/qemuxml2argvdata/numatune-memnode.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: disjoint NUMA cpu ranges are not supported with this QEMU
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index bf3465ee15..dd2460bc0b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1866,7 +1866,6 @@ mymain(void)
                  ARG_MIGRATE_FROM, "stdio",
                  ARG_MIGRATE_FD, 7,
                  ARG_QEMU_CAPS,
-                 QEMU_CAPS_NUMA,
                  QEMU_CAPS_LAST,
                  ARG_END);
 
@@ -1904,8 +1903,7 @@ mymain(void)
     DO_TEST_NOCAPS("cpu-numa2");
     DO_TEST_NOCAPS("cpu-numa-no-memory-element");
     DO_TEST_PARSE_ERROR_NOCAPS("cpu-numa3");
-    DO_TEST_PARSE_ERROR_NOCAPS("cpu-numa-disjoint");
-    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("cpu-numa-disjoint");
     DO_TEST_NOCAPS("cpu-numa-memshared");
     DO_TEST("cpu-host-model",
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
@@ -1971,19 +1969,16 @@ mymain(void)
 
     DO_TEST_NOCAPS("numatune-memory");
     DO_TEST_PARSE_ERROR_NOCAPS("numatune-memory-invalid-nodeset");
-    DO_TEST("numatune-memnode",
-            QEMU_CAPS_NUMA);
-    DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode");
+    DO_TEST_NOCAPS("numatune-memnode");
     DO_TEST_CAPS_VER("numatune-memnode", "5.2.0");
     DO_TEST_CAPS_LATEST("numatune-memnode");
     DO_TEST_PARSE_ERROR_NOCAPS("numatune-memnode-invalid-mode");
     DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode");
     DO_TEST_CAPS_LATEST("numatune-system-memory");
 
-    DO_TEST("numatune-memnode-no-memory",
-            QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("numatune-memnode-no-memory");
 
-    DO_TEST("numatune-distances", QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("numatune-distances");
     DO_TEST_NOCAPS("numatune-no-vcpu");
     DO_TEST_CAPS_LATEST("numatune-hmat");
 
@@ -2632,16 +2627,16 @@ mymain(void)
     DO_TEST_PARSE_ERROR("memory-hotplug-nonuma", QEMU_CAPS_DEVICE_PC_DIMM);
     DO_TEST_PARSE_ERROR_NOCAPS("memory-hotplug-invalid-targetnode");
     DO_TEST_NOCAPS("memory-hotplug");
-    DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
-    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
+    DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM);
+    DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
     DO_TEST_CAPS_LATEST("memory-hotplug-dimm-addr");
-    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
+    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM,
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
     DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "",
                  ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM,
-                 QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+                 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                  QEMU_CAPS_LAST,
                  ARG_END);
     DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm");
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 40763607ba..45e16ce02d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -924,14 +924,14 @@ mymain(void)
     DO_TEST_NOCAPS("cpu-numa2");
     DO_TEST_NOCAPS("cpu-numa-no-memory-element");
     DO_TEST_NOCAPS("cpu-numa-disordered");
-    DO_TEST("cpu-numa-disjoint", QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("cpu-numa-disjoint");
     DO_TEST_NOCAPS("cpu-numa-memshared");
 
     DO_TEST_NOCAPS("numatune-auto-prefer");
-    DO_TEST("numatune-memnode", QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("numatune-memnode");
     DO_TEST_NOCAPS("numatune-memnode-no-memory");
-    DO_TEST("numatune-distances", QEMU_CAPS_NUMA);
-    DO_TEST("numatune-no-vcpu", QEMU_CAPS_NUMA);
+    DO_TEST_NOCAPS("numatune-distances");
+    DO_TEST_NOCAPS("numatune-no-vcpu");
     DO_TEST("numatune-hmat", QEMU_CAPS_NUMA_HMAT);
     DO_TEST_CAPS_LATEST("numatune-memnode-restrictive-mode");
 
@@ -1023,13 +1023,13 @@ mymain(void)
     /* SVE aarch64 CPU features work on modern QEMU */
     DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
 
-    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
+    DO_TEST("memory-hotplug-ppc64-nonuma", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM,
             QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
     DO_TEST_FULL("memory-hotplug-ppc64-nonuma-abi-update", "", WHEN_BOTH,
                  ARG_PARSEFLAGS, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE,
                  ARG_QEMU_CAPS,
                  QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_PC_DIMM,
-                 QEMU_CAPS_NUMA, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
+                 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE,
                  QEMU_CAPS_LAST, ARG_END);
     DO_TEST_NOCAPS("memory-hotplug");
     DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM);
-- 
2.37.4



More information about the libvir-list mailing list