[PATCH] qemu: Take all PHBs into account while calculating memlock limits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the multi-phb support series is in, work on the TODO at
qemuDomainGetMemLockLimitBytes() to arrive at the correct memlock limit
value.

Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>
---
This patch should be applied on top of Andrea's multi-phb support
patchset.

 src/qemu/qemu_domain.c  |   12 ++++++++----
 tests/qemumemlocktest.c |    2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a3ce10a..a8293b4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6674,12 +6674,16 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
         unsigned long long memory;
         unsigned long long baseLimit;
         unsigned long long passthroughLimit;
-        size_t nPCIHostBridges;
+        size_t nPCIHostBridges = 0;
         bool usesVFIO = false;
 
-        /* TODO: Detect at runtime once we start using more than just
-         *       the default PCI Host Bridge */
-        nPCIHostBridges = 1;
+        for (i = 0; i < def->ncontrollers; i++) {
+            if (def->controllers[i]->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI ||
+                def->controllers[i]->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
+                continue;
+            }
+            nPCIHostBridges++;
+        }
 
         for (i = 0; i < def->nhostdevs; i++) {
             virDomainHostdevDefPtr dev = def->hostdevs[i];
diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
index c0f1dc3..268563d 100644
--- a/tests/qemumemlocktest.c
+++ b/tests/qemumemlocktest.c
@@ -131,7 +131,7 @@ mymain(void)
 
     DO_TEST("pseries-hardlimit", 2147483648);
     DO_TEST("pseries-locked", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED);
-    DO_TEST("pseries-hostdev", 2168455168);
+    DO_TEST("pseries-hostdev", 4320133120);
 
     DO_TEST("pseries-hardlimit+locked", 2147483648);
     DO_TEST("pseries-hardlimit+hostdev", 2147483648);

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux