qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCHv2] virtio-net: stop vhost backend on vmstop


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCHv2] virtio-net: stop vhost backend on vmstop
Date: Wed, 2 Jun 2010 21:02:18 +0300
User-agent: Mutt/1.5.19 (2009-01-05)

vhost net currently keeps running after vmstop,
which causes trouble as qemy does not check
for dirty pages anymore.
The fix is to simply keep vm and vhost running/stopped
status in sync.

Tested-by: David L Stevens <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---

Changes from v1:
  Simplify code as suggested by Amit.

 hw/virtio-net.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 28f26e1..67eebcf 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -877,12 +877,11 @@ static void virtio_net_set_status(struct VirtIODevice 
*vdev, uint8_t status)
 static void virtio_net_vmstate_change(void *opaque, int running, int reason)
 {
     VirtIONet *n = opaque;
-    if (!running) {
-        return;
-    }
-    /* This is called when vm is started, it will start vhost backend if
-     * appropriate e.g. after migration. */
-    virtio_net_set_status(&n->vdev, n->vdev.status);
+    uint8_t status = running ? n->vdev.status : 0;
+    /* This is called when vm is started/stopped,
+     * it will start/stop vhost backend if appropriate
+     * e.g. after migration. */
+    virtio_net_set_status(&n->vdev, status);
 }
 
 VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
-- 
1.7.1.12.g42b7f



reply via email to

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