]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: properly set MaxMemLock when hotplugging with VFIO
authorLaine Stump <laine@laine.org>
Wed, 18 Dec 2013 14:46:41 +0000 (16:46 +0200)
committerLaine Stump <laine@laine.org>
Mon, 23 Dec 2013 11:16:57 +0000 (13:16 +0200)
commit6d867f72f4f5fd75905e81b2d43350e7091fca64
treed01bb00b299345b98fb85a7b9bdf408d55f8592d
parentd53c57b806b94adaed650b7ff10893905ff2fa1f
qemu: properly set MaxMemLock when hotplugging with VFIO

This resolves:

  https://bugzilla.redhat.com/show_bug.cgi?id=1035490

virProcessSetMaxMemLock() (which is a wrapper over prlimit(3)) expects
the memory size in bytes, but libvirt's domain definition (which was
being used by qemuDomainAttachHostPciDevice()) stores all memory
tuning parameters in KiB. This was being accounted for when setting
MaxMemLock at domain startup time (so cold-plugged devices would
work), but not for hotplug.

This patch simplifies the few lines that call
virProcessSetMemMaxLock(), and multiply the amount * 1024 so that
we're locking the correct amount of memory.

What remains a mystery to me is why hot-plug of a managed='no' device
would succeed (at least on my system) while managed='yes' would
fail. I guess in one case the memory was coincidentally already
resident and in the other it wasn't.
src/qemu/qemu_hotplug.c