[libvirt] [PATCH] S390: Enhance memballoon handling for virtio-s390

Viktor Mihajlovski mihajlov at linux.vnet.ibm.com
Fri Jan 11 15:30:07 UTC 2013


The way in that memory balloon suppression was handled for S390
is flawed for a number or reasons.
1. Just preventing the default balloon to be created in the case
   of VIR_ARCH_S390[X] is not sufficient. An explicit memballoon
   element in the guest definition will still be honored, resulting
   both in a -balloon option and the allocation of a PCI bus address,
   neither being supported.
2. Prohibiting balloon for S390 altogether at a domain_conf level
   is no good solution either as there's work in progress on the QEMU
   side to implement a virtio-balloon device, although in
   conjunction with a new machine type. Suppressing the balloon
   should therefore be done at the QEMU driver level depending
   on the present capabilities.

Therefore we remove the conditional suppression of the default
balloon in domain_conf.c.
Further, we are claiming the memballoon device for virtio-s390
during device address assignment to prevent it from being considered
as a PCI device.
Finally, we suppress the generation of the balloon command line option
if this is a virtio-s390 machine.

Signed-off-by: Viktor Mihajlovski <mihajlov at linux.vnet.ibm.com>
---
 src/conf/domain_conf.c  |    4 +---
 src/qemu/qemu_command.c |    9 ++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6feded4..325e1ee 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10285,9 +10285,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
 
         def->memballoon = memballoon;
         VIR_FREE(nodes);
-    } else if (def->os.arch != VIR_ARCH_S390 &&
-               def->os.arch != VIR_ARCH_S390X) {
-        /* TODO: currently no balloon support on s390 -> no default balloon */
+    } else {
         if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
             def->virtType == VIR_DOMAIN_VIRT_QEMU ||
             def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 981c692..3496dbf 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -795,7 +795,7 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
 {
     /*
        declare address-less virtio devices to be of address type 'type'
-       only disks, networks, consoles and controllers for now
+       only disks, networks, consoles, controllers and memballoon for now
     */
     int i;
 
@@ -825,6 +825,10 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
             def->controllers[i]->info.type = type;
     }
 
+    if (def->memballoon &&
+        def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+        def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+        def->memballoon->info.type = type;
 }
 
 static void
@@ -6956,6 +6960,9 @@ qemuBuildCommandLine(virConnectPtr conn,
      * NB: Earlier we declared that VirtIO balloon will always be in
      * slot 0x3 on bus 0x0
      */
+    if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390) && (def->memballoon))
+        def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
+
     if ((def->memballoon) &&
         (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
         if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
-- 
1.7.9.5




More information about the libvir-list mailing list