Re: [PATCH v4 05/20] qemu-cgroup: allow accel rendernode access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/13/19 8:50 AM, marcandre.lureau@xxxxxxxxxx wrote:
From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
  src/qemu/qemu_cgroup.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ecd96efb0a..eb6f993d8e 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -503,6 +503,25 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm,
  }
+static int
+qemuSetupVideoAccelCgroup(virDomainObjPtr vm,
+                          virDomainVideoAccelDefPtr def)
+{
+    qemuDomainObjPrivatePtr priv = vm->privateData;
+    int ret;
+
+    if (!def->rendernode ||
+        !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES))
+        return 0;
+
+    ret = virCgroupAllowDevicePath(priv->cgroup, def->rendernode,
+                                   VIR_CGROUP_DEVICE_RW, false);
+    virDomainAuditCgroupPath(vm, priv->cgroup, "allow", def->rendernode,
+                             "rw", ret);
+    return ret;
+}
+
+
  static int
  qemuSetupBlkioCgroup(virDomainObjPtr vm)
  {
@@ -803,6 +822,11 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
              goto cleanup;
      }
+ for (i = 0; i < vm->def->nvideos; i++) {
+        if (qemuSetupVideoAccelCgroup(vm, vm->def->videos[i]->accel) < 0)
+            goto cleanup;
+    }
+
      for (i = 0; i < vm->def->ninputs; i++) {
          if (qemuSetupInputCgroup(vm, vm->def->inputs[i]) < 0)
              goto cleanup;


->accel can be NULL here otherwise we crash like I mentioned yesterday. All the other functions here act on a device as a whole so I think this should be qemuSetupVideoCgroup while you are here

FWIW after fixing this the VM starts, but I see this in the logs with stock Fedora 31 qemu 4.1, not sure if it's indicative of a qemu error or something missing on libvirt side. The VM gets to the initrd load stage but then graphic output stops updating

2019-09-20T20:06:51.238950Z qemu-system-x86_64: Failed initializing vhost-user memory map, consider using -object memory-backend-file share=on 2019-09-20T20:06:51.238971Z qemu-system-x86_64: vhost_set_mem_table failed: Resource temporarily unavailable (11)
2019-09-20T20:06:51.238976Z qemu-system-x86_64: Error start vhost dev

- Cole

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux