restrictions for virtiofs (related to commit: 88957116c9 for libvirt 6.9.0)

Masayoshi Mizuma msys.mizuma at gmail.com
Fri Oct 2 15:31:32 UTC 2020


Hello Jan, and Michal,

commit: 88957116c9 ("qemu: Use memory-backend-* for regular guest memory") gets
the system memory sharable without numa config.
The qemu options with the patch will be like as:

  -machine pc-q35-5.2,accel=kvm,usb=off,vmport=off,smm=on,dump-guest-core=off,memory-backend=pc.ram \
  -object memory-backend-file,id=pc.ram,mem-path=/var/lib/libvirt/qemu/ram/2-Test/pc.ram,share=yes,size=17179869184 \

So, we can remove the numa restriction of virtiofs, right?
The patch to remove that is the bottom of this email.

And, 88957116c9 seems to introduce another restriction which we
cannot create numa nodes on the machine. I got the following
message when I set the numa config and started the VM:

   2020-10-02T00:31:46.780374Z qemu-system-x86_64: '-machine memory-backend' and '-numa memdev' properties are mutually exclusive

qemu rejects the -machine memory-backend' and '-numa memdev' because it
may cause crash. commit: ea81f98bce ("numa: prevent usage of -M memory-backend
and -numa memdev at the same time") introduced the check.

Do you have any ideas to solve above?

===================================================================
From: Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>
Date: Fri, 2 Oct 2020 10:50:06 -0400
Subject: [PATCH] qemu: Remove the number of numa restriction for virtiofs

virtiofs requires at least one numa node to access the system
memory as shared memory.

88957116c9 ("qemu: Use memory-backend-* for regular guest memory")
gets the system memory sharable without the numa config.

Let's remove the number of numa restriction for virtiofs.

Signed-off-by: Masayoshi Mizuma <m.mizuma at jp.fujitsu.com>
---
 src/qemu/qemu_validate.c | 44 ++++++++++++++++++++--------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index a212605579..b5372e7499 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3475,36 +3475,36 @@ qemuValidateDomainDefVirtioFSSharedMemory(const virDomainDef *def)
     size_t numa_nodes = virDomainNumaGetNodeCount(def->numa);
     size_t i;
 
-    if (numa_nodes == 0) {
+    if ((!numa_nodes) && (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("virtiofs requires one or more NUMA nodes"));
+                       _("virtiofs requires shared memory"));
         return -1;
-    }
-
-    for (i = 0; i < numa_nodes; i++) {
-        virDomainMemoryAccess node_access =
-            virDomainNumaGetNodeMemoryAccessMode(def->numa, i);
+    } else {
+        for (i = 0; i < numa_nodes; i++) {
+            virDomainMemoryAccess node_access =
+                virDomainNumaGetNodeMemoryAccessMode(def->numa, i);
 
-        switch (node_access) {
-        case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT:
-            if (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
+            switch (node_access) {
+            case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT:
+                if (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                                   _("virtiofs requires shared memory"));
+                    return -1;
+                }
+                break;
+            case VIR_DOMAIN_MEMORY_ACCESS_SHARED:
+                break;
+            case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE:
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("virtiofs requires shared memory"));
                 return -1;
-            }
-            break;
-        case VIR_DOMAIN_MEMORY_ACCESS_SHARED:
-            break;
-        case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE:
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("virtiofs requires shared memory"));
-            return -1;
 
-        case VIR_DOMAIN_MEMORY_ACCESS_LAST:
-        default:
-            virReportEnumRangeError(virDomainMemoryAccess, node_access);
-            return -1;
+            case VIR_DOMAIN_MEMORY_ACCESS_LAST:
+            default:
+                virReportEnumRangeError(virDomainMemoryAccess, node_access);
+                return -1;
 
+            }
         }
     }
     return 0;
-- 
2.27.0

Thanks,
Masa




More information about the libvir-list mailing list