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