qemu: Drop @forceVFIO argument of qemuDomainAdjustMaxMemLock()

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>
This commit is contained in:
Michal Privoznik 2023-05-10 08:55:10 +02:00
parent c925bb9273
commit 4f355fa5b7
3 changed files with 15 additions and 20 deletions

View 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);

View 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,

View 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: