[libvirt] [PATCH] qemuDomainAttachHostPciDevice: Fall back to mem balloon if there's no hard_limit

Eric Blake eblake at redhat.com
Mon Aug 26 15:34:56 UTC 2013


On 08/26/2013 09:28 AM, Michal Privoznik wrote:
> If there's no hard_limit set and domain uses VFIO we still must lock
> the guest memory (prerequisite from qemu). Hence, we should compute
> the amount to be locked from max_balloon.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_hotplug.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 

> @@ -1032,8 +1034,9 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
>           * doesn't hurt to "change" the limit to the same value.
>           */
>          vm->def->hostdevs[vm->def->nhostdevs++] = hostdev;
> -        virProcessSetMaxMemLock(vm->pid,
> -                                vm->def->mem.hard_limit * 1024);
> +        memKB = def->mem.hard_limit ?
> +            def->mem.hard_limit : def->mem.max_balloon + 1024 * 1024;

If I'm reading this correctly, the idea is the max_balloon limit plus 1G
extra, if there is no hard_limit.  (If you intended differently, then
you need more '()')

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130826/b6bb4607/attachment-0001.sig>


More information about the libvir-list mailing list