render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
7a3408
From 7b6d887931845fb14f04bdfd997d61de940a0cff Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <7b6d887931845fb14f04bdfd997d61de940a0cff@dist-git>
7a3408
From: Peter Krempa <pkrempa@redhat.com>
7a3408
Date: Tue, 22 Sep 2015 16:59:47 +0200
7a3408
Subject: [PATCH] qemu: ppc64: Align memory sizes to 256MiB blocks
7a3408
7a3408
For some machine types ppc64 machines now require that memory sizes are
7a3408
aligned to 256MiB increments (due to the dynamically reconfigurable
7a3408
memory). As now we treat existing configs reasonably in regards to
7a3408
migration, we can round all the sizes unconditionally. The only drawback
7a3408
will be that the memory size of a VM can potentially increase by
7a3408
(256MiB - 1byte) * number_of_NUMA_nodes.
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1249006
7a3408
(cherry picked from commit bd874b6c422283ff9c07ee28b042b424e85a2398)
7a3408
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_domain.c                                      | 7 ++++++-
7a3408
 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args | 2 +-
7a3408
 2 files changed, 7 insertions(+), 2 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
7a3408
index 77f3d6a..a47535e 100644
7a3408
--- a/src/qemu/qemu_domain.c
7a3408
+++ b/src/qemu/qemu_domain.c
7a3408
@@ -3159,8 +3159,13 @@ qemuDomainAgentAvailable(virDomainObjPtr vm,
7a3408
 
7a3408
 
7a3408
 static unsigned long long
7a3408
-qemuDomainGetMemorySizeAlignment(virDomainDefPtr def ATTRIBUTE_UNUSED)
7a3408
+qemuDomainGetMemorySizeAlignment(virDomainDefPtr def)
7a3408
 {
7a3408
+    /* PPC requires the memory sizes to be rounded to 256MiB increments, so
7a3408
+     * round them to the size always. */
7a3408
+    if (ARCH_IS_PPC64(def->os.arch))
7a3408
+        return 256 * 1024;
7a3408
+
7a3408
     /* Align memory size. QEMU requires rounding to next 4KiB block.
7a3408
      * We'll take the "traditional" path and round it to 1MiB*/
7a3408
 
7a3408
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
7a3408
index 64df406..305e924 100644
7a3408
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
7a3408
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
7a3408
@@ -1,7 +1,7 @@
7a3408
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
7a3408
 QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries \
7a3408
 -cpu host,compat=power7 \
7a3408
--m 214 -smp 4 -nographic -nodefconfig -nodefaults \
7a3408
+-m 256 -smp 4 -nographic -nodefconfig -nodefaults \
7a3408
 -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
7a3408
 -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
7a3408
 -chardev pty,id=charserial0 \
7a3408
-- 
7a3408
2.5.3
7a3408