[libvirt] [PATCH v2] qemu: check if numa cell's cpu range match with cpu topology count

Maxiwell S. Garcia posted 1 patch 4 years, 7 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190808142630.23115-1-maxiwell@linux.ibm.com
src/qemu/qemu_domain.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
[libvirt] [PATCH v2] qemu: check if numa cell's cpu range match with cpu topology count
Posted by Maxiwell S. Garcia 4 years, 7 months ago
QEMU shows a warning message if partial NUMA mapping is set. This patch
adds a warning message in libvirt when editing the XML. It must be an
error in future, when QEMU remove this ability.

Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
---
 src/qemu/qemu_domain.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0555caa6ab..62dd428fca 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4621,15 +4621,24 @@ qemuDomainDefValidate(const virDomainDef *def,
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS)) {
         unsigned int topologycpus;
         unsigned int granularity;
+        unsigned int numacpus;
 
         /* Starting from QEMU 2.5, max vCPU count and overall vCPU topology
          * must agree. We only actually enforce this with QEMU 2.7+, due
          * to the capability check above */
-        if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0 &&
-            topologycpus != virDomainDefGetVcpusMax(def)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("CPU topology doesn't match maximum vcpu count"));
-            goto cleanup;
+        if (virDomainDefGetVcpusTopology(def, &topologycpus) == 0) {
+            if (topologycpus != virDomainDefGetVcpusMax(def)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("CPU topology doesn't match maximum vcpu count"));
+                goto cleanup;
+            }
+
+            numacpus = virDomainNumaGetCPUCountTotal(def->numa);
+            if ((numacpus != 0) && (topologycpus != numacpus)) {
+                VIR_WARN("CPU topology doesn't match numa CPU count; "
+                         "partial NUMA mapping is obsoleted and will "
+                         "be removed in future");
+            }
         }
 
         /* vCPU hotplug granularity must be respected */
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] qemu: check if numa cell's cpu range match with cpu topology count
Posted by Michal Privoznik 4 years, 7 months ago
On 8/8/19 4:26 PM, Maxiwell S. Garcia wrote:
> QEMU shows a warning message if partial NUMA mapping is set. This patch
> adds a warning message in libvirt when editing the XML. It must be an
> error in future, when QEMU remove this ability.
> 
> Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
> ---
>   src/qemu/qemu_domain.c | 19 ++++++++++++++-----
>   1 file changed, 14 insertions(+), 5 deletions(-)


Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
and pushed,

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list