qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <1303992254-4940-4-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1303992254-4940-1-git-send-email-alevy@redhat.com>

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

      parent reply	other threads:[~2011-04-28 12:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 12:04 [Qemu-devel] [PATCHv2 0/3] virtio-serial-bus: use a bh for flush_queued_data Alon Levy
2011-04-28 12:04 ` [Qemu-devel] [PATCHv2 1/3] virtio-serial-bus: use bh for unthrottling Alon Levy
2011-04-28 12:04 ` [Qemu-devel] [PATCHv2 2/3] bh: add qemu_bh_is_scheduled Alon Levy
2011-04-28 12:04 ` Alon Levy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303992254-4940-4-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).