[libvirt] [PATCH v3 2/4] qemu_domain: add a PPC64 memLockLimit helper

Erik Skultety eskultet at redhat.com
Thu Mar 7 14:12:03 UTC 2019


On Tue, Mar 05, 2019 at 09:46:07AM -0300, Daniel Henrique Barboza wrote:
> There are a lot of documentation in the comments about how
> PPC64 handles passthrough VFIO devices to calculate the
> memLockLimit. And more will be added with the PPC64 NVLink2
> support code.
>
> Let's remove the PPC64 code from qemuDomainGetMemLockLimitBytes
> body and put it into a helper function. This will simply the

s/simply/simplify

> flow of qemuDomainGetMemLockLimitBytes that handles all other
> platforms and improves the readability of PPC64 specifics.
>
> Suggested-by: Erik Skultety <eskultet at redhat.com>
> Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
> ---
>  src/qemu/qemu_domain.c | 169 ++++++++++++++++++++++-------------------
>  1 file changed, 91 insertions(+), 78 deletions(-)
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 099097fe62..77548c224c 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -10343,6 +10343,95 @@ qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm)
>  }
>
>
> +/**
> + * getPPC64MemLockLimitBytes:
> + * @def: domain definition
> + *
> + * A PPC64 helper that calculates the memory locking limit in order for
> + * the guest to operate properly.
> + */
> +static unsigned long long
> +getPPC64MemLockLimitBytes(virDomainDefPtr def)
> +{
> +    unsigned long long memKB = 0;
> +    unsigned long long baseLimit, memory, maxMemory;

One variable per line.

[...]

I'll squash this in before pushing:

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 77548c224c..535ee78c6f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10354,7 +10354,9 @@ static unsigned long long
 getPPC64MemLockLimitBytes(virDomainDefPtr def)
 {
     unsigned long long memKB = 0;
-    unsigned long long baseLimit, memory, maxMemory;
+    unsigned long long baseLimit = 0;
+    unsigned long long memory = 0;
+    unsigned long long maxMemory = 0;
     unsigned long long passthroughLimit = 0;
     size_t i, nPCIHostBridges = 0;
     bool usesVFIO = false;

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list