|
|
c480ed |
From 18f38f4aee3a3472f5e50786ee221d8d397bc6a8 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <18f38f4aee3a3472f5e50786ee221d8d397bc6a8@dist-git>
|
|
|
c480ed |
From: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
c480ed |
Date: Fri, 3 May 2019 13:54:50 +0200
|
|
|
c480ed |
Subject: [PATCH] qemu: domain: Simplify non-VFIO memLockLimit calculation for
|
|
|
c480ed |
PPC64
|
|
|
c480ed |
|
|
|
c480ed |
@passthroughLimit is being calculated even if @usesVFIO is false. After
|
|
|
c480ed |
that, an if-else conditional is used to check if we're going to sum it
|
|
|
c480ed |
up with @baseLimit.
|
|
|
c480ed |
|
|
|
c480ed |
This patch initializes @passthroughLimit to zero and always returns
|
|
|
c480ed |
@memKB = @baseLimit + @passthroughLimit. The conditional is then used to
|
|
|
c480ed |
calculate @passthroughLimit if @usesVFIO == true. This results in some
|
|
|
c480ed |
cycles being spared for the @usesVFIO == false scenario, but the real
|
|
|
c480ed |
motivation is to make the code simpler to add an alternative formula to
|
|
|
c480ed |
calculate @passthroughLimit for NVLink2.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
|
|
|
c480ed |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
c480ed |
(cherry picked from commit cf7c5212876b2403de5b0fafedec33af4439526e)
|
|
|
c480ed |
|
|
|
c480ed |
https: //bugzilla.redhat.com/show_bug.cgi?id=1505998
|
|
|
c480ed |
Signed-off-by: Erik Skultety <eskultet@redhat.com>
|
|
|
c480ed |
Message-Id: <a6380e14dfb1c8cb463f5e3eb25bda78dc9d7dd8.1556884442.git.eskultet@redhat.com>
|
|
|
c480ed |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/qemu/qemu_domain.c | 13 +++++--------
|
|
|
c480ed |
1 file changed, 5 insertions(+), 8 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
c480ed |
index cc2a896a07..d936090d87 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_domain.c
|
|
|
c480ed |
+++ b/src/qemu/qemu_domain.c
|
|
|
c480ed |
@@ -9840,7 +9840,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
|
|
|
c480ed |
unsigned long long maxMemory;
|
|
|
c480ed |
unsigned long long memory;
|
|
|
c480ed |
unsigned long long baseLimit;
|
|
|
c480ed |
- unsigned long long passthroughLimit;
|
|
|
c480ed |
+ unsigned long long passthroughLimit = 0;
|
|
|
c480ed |
size_t nPCIHostBridges = 0;
|
|
|
c480ed |
bool usesVFIO = false;
|
|
|
c480ed |
|
|
|
c480ed |
@@ -9906,15 +9906,12 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def)
|
|
|
c480ed |
* kiB pages, less still if the guest is mapped with hugepages (unlike
|
|
|
c480ed |
* the default 32-bit DMA window, DDW windows can use large IOMMU
|
|
|
c480ed |
* pages). 8 MiB is for second and further level overheads, like (b) */
|
|
|
c480ed |
- passthroughLimit = MAX(2 * 1024 * 1024 * nPCIHostBridges,
|
|
|
c480ed |
- memory +
|
|
|
c480ed |
- memory / 512 * nPCIHostBridges + 8192);
|
|
|
c480ed |
-
|
|
|
c480ed |
if (usesVFIO)
|
|
|
c480ed |
- memKB = baseLimit + passthroughLimit;
|
|
|
c480ed |
- else
|
|
|
c480ed |
- memKB = baseLimit;
|
|
|
c480ed |
+ passthroughLimit = MAX(2 * 1024 * 1024 * nPCIHostBridges,
|
|
|
c480ed |
+ memory +
|
|
|
c480ed |
+ memory / 512 * nPCIHostBridges + 8192);
|
|
|
c480ed |
|
|
|
c480ed |
+ memKB = baseLimit + passthroughLimit;
|
|
|
c480ed |
goto done;
|
|
|
c480ed |
}
|
|
|
c480ed |
|
|
|
c480ed |
--
|
|
|
c480ed |
2.21.0
|
|
|
c480ed |
|