qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCHv2 3/3] virtio-serial-bus: on migration send status o


From: Alon Levy
Subject: [Qemu-devel] [PATCHv2 3/3] virtio-serial-bus: on migration send status of pending ports bh
Date: Thu, 28 Apr 2011 15:04:14 +0300

migration protocol bumped to 4, adding a single byte per port which is 1 if
there is a bh scheduled, 0 otherwise.
---
 hw/virtio-serial-bus.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 8556e08..7fb8ade 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -536,7 +536,7 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
         qemu_put_byte(f, port->guest_connected);
         qemu_put_byte(f, port->host_connected);
 
-       elem_popped = 0;
+        elem_popped = 0;
         if (port->elem.out_num) {
             elem_popped = 1;
         }
@@ -548,6 +548,8 @@ static void virtio_serial_save(QEMUFile *f, void *opaque)
             qemu_put_buffer(f, (unsigned char *)&port->elem,
                             sizeof(port->elem));
         }
+        /* Pending bh */
+        qemu_put_byte(f, !!qemu_bh_is_scheduled(port->bh));
     }
 }
 
@@ -558,7 +560,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, 
int version_id)
     uint32_t max_nr_ports, nr_active_ports, ports_map;
     unsigned int i;
 
-    if (version_id > 3) {
+    if (version_id > 4) {
         return -EINVAL;
     }
 
@@ -637,7 +639,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, 
int version_id)
                 virtio_serial_throttle_port(port, false);
             }
         }
+        if (version_id > 3) {
+            if (qemu_get_byte(f)) {
+                qemu_bh_schedule(port->bh);
+            }
+        }
     }
+
     return 0;
 }
 
@@ -889,7 +897,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, 
virtio_serial_conf *conf)
      * Register for the savevm section with the virtio-console name
      * to preserve backward compat
      */
-    register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
+    register_savevm(dev, "virtio-console", -1, 4, virtio_serial_save,
                     virtio_serial_load, vser);
 
     return vdev;
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]