]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: increase locked memory limit when a vDPA device is present
authorLaine Stump <laine@redhat.com>
Tue, 23 Mar 2021 18:39:37 +0000 (14:39 -0400)
committerLaine Stump <laine@redhat.com>
Wed, 24 Mar 2021 19:06:08 +0000 (15:06 -0400)
Just like VFIO devices, vDPA devices may need to have all guest memory
pages locked/pinned in order to operate properly. In the case of VFIO
devices (including mdev and NVME, which also use VFIO) libvirt
automatically increases the locked memory limit when one of those
devices is present. This patch modifies that code to also increase the
limit if there are any vDPA devices present.

Resolves: https://bugzilla.redhat.com/1939776
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_domain.c

index e0379e81ba0e127c127185a2bb949aa415b95f98..76e8903dbcda4a1e9d958b18ea0f8713dbfecb7f 100644 (file)
@@ -9199,7 +9199,7 @@ getPPC64MemLockLimitBytes(virDomainDefPtr def,
         passthroughLimit = maxMemory +
                            128 * (1ULL<<30) / 512 * nPCIHostBridges +
                            8192;
-    } else if (forceVFIO || qemuDomainNeedsVFIO(def)) {
+    } else if (forceVFIO || qemuDomainNeedsVFIO(def) || virDomainDefHasVDPANet(def)) {
         /* For regular (non-NVLink2 present) VFIO passthrough, the value
          * of passthroughLimit is:
          *
@@ -9289,7 +9289,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
      *
      * Note that this may not be valid for all platforms.
      */
-    if (forceVFIO || qemuDomainNeedsVFIO(def))
+    if (forceVFIO || qemuDomainNeedsVFIO(def) || virDomainDefHasVDPANet(def))
         memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
 
     return memKB << 10;