[PATCH] qemu: Add check for needed paths for memory devices

Kristina Hanicova posted 1 patch 2 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/0307d6c4bf36626f516ce5f3fa6385f0ee4ed0ca.1621520857.git.khanicov@redhat.com
src/qemu/qemu_process.c | 5 +++++
1 file changed, 5 insertions(+)
[PATCH] qemu: Add check for needed paths for memory devices
Posted by Kristina Hanicova 2 years, 11 months ago
When building a commandline for a DIMM memory device with
non-default access mode, the qemuBuildMemoryBackendProps() will
tell QEMU to allocate memory from per-domain memory backing dir.
But later, when preparing the host, the
qemuProcessNeedMemoryBackingPath() does not check for memory
devices at all resulting in per-domain memory backing dir not
being created which upsets QEMU.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1961114

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
---
 src/qemu/qemu_process.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b69a9d1927..35213f81ec 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3938,6 +3938,11 @@ qemuProcessNeedMemoryBackingPath(virDomainDef *def,
             return true;
     }
 
+    for (i = 0; i < def->nmems; i++) {
+        if (def->mems[i]->access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT)
+            return true;
+    }
+
     if (mem) {
         switch (mem->model) {
         case VIR_DOMAIN_MEMORY_MODEL_DIMM:
-- 
2.31.1

Re: [PATCH] qemu: Add check for needed paths for memory devices
Posted by Michal Prívozník 2 years, 11 months ago
On 5/20/21 4:29 PM, Kristina Hanicova wrote:
> When building a commandline for a DIMM memory device with
> non-default access mode, the qemuBuildMemoryBackendProps() will
> tell QEMU to allocate memory from per-domain memory backing dir.
> But later, when preparing the host, the
> qemuProcessNeedMemoryBackingPath() does not check for memory
> devices at all resulting in per-domain memory backing dir not
> being created which upsets QEMU.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1961114
> 
> Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
> ---
>  src/qemu/qemu_process.c | 5 +++++
>  1 file changed, 5 insertions(+)

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

and pushed.

Michal