]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Assume QEMU_CAPS_NUMA
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 7 Nov 2022 09:58:59 +0000 (10:58 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Nov 2022 11:10:50 +0000 (12:10 +0100)
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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/cpu-numa-disjoint.err [deleted file]
tests/qemuxml2argvdata/fd-memory-numa-topology2.args
tests/qemuxml2argvdata/fd-memory-numa-topology2.xml
tests/qemuxml2argvdata/fd-memory-numa-topology3.args
tests/qemuxml2argvdata/fd-memory-numa-topology3.xml
tests/qemuxml2argvdata/numatune-memnode.err [deleted file]
tests/qemuxml2argvtest.c
tests/qemuxml2xmltest.c

index 09e213e48d557d95edb7e199a4dfc94564408568..c9a622e75ade47e670c5cf1d4dc44ff181158196 100644 (file)
@@ -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);
index 1192bf18041925a3068a9b251632efb35890ad71..78c68a99d0b25583f760774cf7edf84ad122db83 100644 (file)
@@ -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 (file)
index ff4b1cc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: disjoint NUMA cpu ranges are not supported with this QEMU
index 9d8866d914abbbe2c4bbfdbbbfa9441f5cf29c38..10952872bf4fcf44bada1ed599adb0b1f871d859 100644 (file)
@@ -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 \
index f6af88a2a8f9faebfea1b238c86ef5a4f762b2e5..5b84a49796b2ff3f98f1187a73189174c563c51c 100644 (file)
@@ -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>
index 39ab4e0f2dc6aa9850ee653c20f7a1efea316e04..e9cb1f0fa5125075e929ad5f5c2ce36645ddfdb1 100644 (file)
@@ -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 \
index 1bf006c21cde82622092e0e2676349abfdff43c3..1b8fd7dfee997d37b2dc99c21be4beb03d11bd40 100644 (file)
@@ -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 (file)
index ff4b1cc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: disjoint NUMA cpu ranges are not supported with this QEMU
index bf3465ee15f0cf62013598616d40cc5052e01301..dd2460bc0b0c22751152190414ce5759962bc177 100644 (file)
@@ -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");
index 40763607ba58098ada25958d69a38594fb5fff17..45e16ce02df8da80fff38d8f3307be7668993097 100644 (file)
@@ -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);