[libvirt] [PATCH v2 3/3] qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK fails

Peter Krempa pkrempa at redhat.com
Mon Nov 9 12:50:17 UTC 2015


Check the return value of virCommandSetMaxMemLock when hotplugging VFIO
PCI hostdevs and reject the hotplug if the memory limit can't be set.
---
 src/qemu/qemu_hotplug.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1e7a653..1a0d1e9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1279,7 +1279,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
         }

         /* setup memory locking limits, that are necessary for VFIO */
-        virProcessSetMaxMemLock(vm->pid, qemuDomainGetMlockLimitBytes(vm->def));
+        if (virProcessSetMaxMemLock(vm->pid,
+                                    qemuDomainGetMlockLimitBytes(vm->def)) < 0)
+            goto error;
+
         break;

     default:
-- 
2.6.2




More information about the libvir-list mailing list