On 12/2/19 9:26 AM, Michal Privoznik wrote: > We have this beautiful function that does crystal ball > divination. The function is named > qemuDomainGetMemLockLimitBytes() and it calculates the upper > limit of how much locked memory is given guest going to need. The > function bases its guess on devices defined for a domain. For > instance, if there is a VFIO hostdev defined then it adds 1GiB to > the guessed maximum. Since NVMe disks are pretty much VFIO > hostdevs (but not quite), we have to do the same sorcery. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > ACKed-by: Peter Krempa <pkrempa@xxxxxxxxxx> > --- > src/qemu/qemu_domain.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > For the patch as-is Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx> But... > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c > index 59e98de2d2..7b515b9520 100644 > --- a/src/qemu/qemu_domain.c > +++ b/src/qemu/qemu_domain.c > @@ -11920,6 +11920,9 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def) > } > } > > + if (virDomainDefHasNVMeDisk(def)) > + usesVFIO = true; > + We have qemuDomainNeedsVFIO which helpully captures these rules. Looks the logic has already diverged for ppc here because it doesn't consider IsMdev devices. Something for a future patch - Cole > memory = virDomainDefGetMemoryTotal(def); > > if (def->mem.max_memory) > @@ -12018,6 +12021,7 @@ unsigned long long > qemuDomainGetMemLockLimitBytes(virDomainDefPtr def) > { > unsigned long long memKB = 0; > + bool usesVFIO = false; > size_t i; > > /* prefer the hard limit */ > @@ -12058,11 +12062,17 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def) > for (i = 0; i < def->nhostdevs; i++) { > if (virHostdevIsVFIODevice(def->hostdevs[i]) || > virHostdevIsMdevDevice(def->hostdevs[i])) { > - memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024; > - goto done; > + usesVFIO = true; > + break; > } > } > > + if (virDomainDefHasNVMeDisk(def)) > + usesVFIO = true; > + > + if (usesVFIO) > + memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024; > + > done: > return memKB << 10; > } > - Cole -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list