]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Drop @forceVFIO argument of qemuDomainAdjustMaxMemLock()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 10 May 2023 06:55:10 +0000 (08:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 16 May 2023 12:43:43 +0000 (14:43 +0200)
After previous cleanup, there's not a single caller that would
call qemuDomainAdjustMaxMemLock() with @forceVFIO set. All callers
pass false.

Drop the unneeded argument from the function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_hotplug.c

index b5b4184782055353ee0d50966e2ead63c9310820..7933fecba8b1c26790738e5051a5859bc8f03726 100644 (file)
@@ -8040,7 +8040,7 @@ qemuDomainStorageSourceAccessModifyNVMe(virQEMUDriver *driver,
 
  revoke:
     if (revoke_maxmemlock) {
-        if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+        if (qemuDomainAdjustMaxMemLock(vm) < 0)
             VIR_WARN("Unable to change max memlock limit");
     }
 
@@ -9726,12 +9726,9 @@ qemuDomainSetMaxMemLock(virDomainObj *vm,
 /**
  * qemuDomainAdjustMaxMemLock:
  * @vm: domain
- * @forceVFIO: apply VFIO requirements even if vm's def doesn't require it
  *
  * Adjust the memory locking limit for the QEMU process associated to @vm, in
- * order to comply with VFIO or architecture requirements. If @forceVFIO is
- * true then the limit is changed even if nothing in @vm's definition indicates
- * so.
+ * order to comply with VFIO or architecture requirements.
  *
  * The limit will not be changed unless doing so is needed; the first time
  * the limit is changed, the original (default) limit is stored in @vm and
@@ -9741,11 +9738,10 @@ qemuDomainSetMaxMemLock(virDomainObj *vm,
  * Returns: 0 on success, <0 on failure
  */
 int
-qemuDomainAdjustMaxMemLock(virDomainObj *vm,
-                           bool forceVFIO)
+qemuDomainAdjustMaxMemLock(virDomainObj *vm)
 {
     return qemuDomainSetMaxMemLock(vm,
-                                   qemuDomainGetMemLockLimitBytes(vm->def, forceVFIO),
+                                   qemuDomainGetMemLockLimitBytes(vm->def, false),
                                    &QEMU_DOMAIN_PRIVATE(vm)->originalMemlock);
 }
 
@@ -9770,7 +9766,7 @@ qemuDomainAdjustMaxMemLockHostdev(virDomainObj *vm,
     int ret = 0;
 
     vm->def->hostdevs[vm->def->nhostdevs++] = hostdev;
-    if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+    if (qemuDomainAdjustMaxMemLock(vm) < 0)
         ret = -1;
 
     vm->def->hostdevs[--(vm->def->nhostdevs)] = NULL;
@@ -9803,7 +9799,7 @@ qemuDomainAdjustMaxMemLockNVMe(virDomainObj *vm,
 
     VIR_APPEND_ELEMENT_COPY(vm->def->disks, vm->def->ndisks, disk);
 
-    if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+    if (qemuDomainAdjustMaxMemLock(vm) < 0)
         ret = -1;
 
     VIR_DELETE_ELEMENT_INPLACE(vm->def->disks, vm->def->ndisks - 1, vm->def->ndisks);
index ee2ddda0793aced1b0910ad93344418db9fe8763..9d15a78e1ca998b387da9ffb841d42c424a71c95 100644 (file)
@@ -856,8 +856,7 @@ void qemuDomainUpdateCurrentMemorySize(virDomainObj *vm);
 
 unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDef *def,
                                                   bool forceVFIO);
-int qemuDomainAdjustMaxMemLock(virDomainObj *vm,
-                               bool forceVFIO);
+int qemuDomainAdjustMaxMemLock(virDomainObj *vm);
 int qemuDomainAdjustMaxMemLockHostdev(virDomainObj *vm,
                                       virDomainHostdevDef *hostdev);
 int qemuDomainAdjustMaxMemLockNVMe(virDomainObj *vm,
index 54b5a2c2c9d4664c7413ab5bbb8a71ccfb36ed5c..d5148f581543d5a1e2fe892b00a2c241f75936bf 100644 (file)
@@ -1244,7 +1244,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
         break;
 
     case VIR_DOMAIN_NET_TYPE_VDPA:
-        if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+        if (qemuDomainAdjustMaxMemLock(vm) < 0)
             goto cleanup;
         adjustmemlock = true;
         break;
@@ -1417,7 +1417,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
          * after all
          */
         if (adjustmemlock)
-            qemuDomainAdjustMaxMemLock(vm, false);
+            qemuDomainAdjustMaxMemLock(vm);
 
         if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
             if (conn)
@@ -1564,7 +1564,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
     if (teardowndevice &&
         qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
         VIR_WARN("Unable to remove host device from /dev");
-    if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm, false) < 0)
+    if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm) < 0)
         VIR_WARN("Unable to reset maximum locked memory on hotplug fail");
 
     if (releaseaddr)
@@ -2291,7 +2291,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
     if (virDomainMemoryInsert(vm->def, mem) < 0)
         goto cleanup;
 
-    if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+    if (qemuDomainAdjustMaxMemLock(vm) < 0)
         goto removedef;
 
     qemuDomainObjEnterMonitor(vm);
@@ -2357,7 +2357,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
 
     /* reset the mlock limit */
     virErrorPreserveLast(&orig_err);
-    ignore_value(qemuDomainAdjustMaxMemLock(vm, false));
+    ignore_value(qemuDomainAdjustMaxMemLock(vm));
     virErrorRestore(&orig_err);
 
     goto audit;
@@ -2720,7 +2720,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver,
     ret = 0;
  cleanup:
     if (ret < 0) {
-        if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm, false) < 0)
+        if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm) < 0)
             VIR_WARN("Unable to reset maximum locked memory on hotplug fail");
         if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0)
             VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail");
@@ -4583,7 +4583,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriver *driver,
     ignore_value(qemuProcessRefreshBalloonState(vm, VIR_ASYNC_JOB_NONE));
 
     /* decrease the mlock limit after memory unplug if necessary */
-    ignore_value(qemuDomainAdjustMaxMemLock(vm, false));
+    ignore_value(qemuDomainAdjustMaxMemLock(vm));
 
     return 0;
 }
@@ -4690,7 +4690,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver,
         qemuDomainRemovePCIHostDevice(driver, vm, hostdev);
         /* QEMU might no longer need to lock as much memory, eg. we just
          * detached the last VFIO device, so adjust the limit here */
-        if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
+        if (qemuDomainAdjustMaxMemLock(vm) < 0)
             VIR_WARN("Failed to adjust locked memory limit");
         break;
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: