mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-20 11:48:28 -06:00
qemuBuildCommandLine: Fall back to mem balloon if there's no hard_limit
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.
This commit is contained in:
parent
94a24dd3a9
commit
a7f94a40bb
@ -9219,8 +9219,19 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (mlock)
|
||||
virCommandSetMaxMemLock(cmd, def->mem.hard_limit * 1024);
|
||||
if (mlock) {
|
||||
unsigned long long memKB;
|
||||
|
||||
/* VFIO requires all of the guest's memory to be
|
||||
* locked resident, plus some amount for IO
|
||||
* space. Alex Williamson suggested adding 1GiB for IO
|
||||
* space just to be safe (some finer tuning might be
|
||||
* nice, though).
|
||||
*/
|
||||
memKB = def->mem.hard_limit ?
|
||||
def->mem.hard_limit : def->mem.max_balloon + 1024 * 1024;
|
||||
virCommandSetMaxMemLock(cmd, memKB * 1024);
|
||||
}
|
||||
|
||||
virObjectUnref(cfg);
|
||||
return cmd;
|
||||
|
Loading…
Reference in New Issue
Block a user