[libvirt] [PATCH 2/3] qemu: Reset the maximum locked memory on hotplug fail

Daniel Henrique Barboza danielhb413 at gmail.com
Fri Sep 6 14:10:20 UTC 2019



On 9/3/19 5:09 PM, Eric Farman wrote:
> If attaching a PCI hostdev fails, there are several things that
> need to be un-done as part of the cleanup.  One thing that is
> not done is re-calculating/re-setting the maximum amount of locked
> memory for the domain, since we may have changed that.
>
> Let's fix that, just to ensure everything is back the way it was.
>
> Signed-off-by: Eric Farman <farman at linux.ibm.com>
> ---

Ouch. This is a bug fix that should be pushed regardless of the rest of the
series, IMHO.

Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>



>   src/qemu/qemu_hotplug.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> index 24e75e49be..979e97b608 100644
> --- a/src/qemu/qemu_hotplug.c
> +++ b/src/qemu/qemu_hotplug.c
> @@ -1469,6 +1469,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
>       bool teardowncgroup = false;
>       bool teardownlabel = false;
>       bool teardowndevice = false;
> +    bool teardownmemlock = false;
>       int backend;
>       VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg = virQEMUDriverGetConfig(driver);
>       unsigned int flags = 0;
> @@ -1510,6 +1511,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
>   
>       if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0)
>           goto error;
> +    teardownmemlock = true;
>   
>       if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
>           goto error;
> @@ -1577,6 +1579,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
>       if (teardowndevice &&
>           qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
>           VIR_WARN("Unable to remove host device from /dev");
> +    if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm) < 0)
> +        VIR_WARN("Unable to reset maximum locked memory on hotplug fail");
>   
>       if (releaseaddr)
>           qemuDomainReleaseDeviceAddress(vm, info);




More information about the libvir-list mailing list