From 52d2355a0743220f495b1a80f7be0bd90ec19556 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin Date: Wed, 2 Jun 2010 18:09:08 -0300 Subject: [PATCH 6/7] virtio-net: stop vhost backend on vmstop RH-Author: Michael S. Tsirkin Message-id: Patchwork-id: 9678 O-Subject: [RHEL6.0 PATCHv2 1/2] virtio-net: stop vhost backend on vmstop Bugzilla: 598896 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Jes Sorensen RH-Acked-by: Amit Shah RH-Acked-by: Juan Quintela 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 Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) Signed-off-by: Eduardo Habkost --- 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.0.3