From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39779 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJkLe-0004lu-Vx for qemu-devel@nongnu.org; Wed, 02 Jun 2010 05:34:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJkLd-0001My-MY for qemu-devel@nongnu.org; Wed, 02 Jun 2010 05:34:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33009) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJkLd-0001Md-FK for qemu-devel@nongnu.org; Wed, 02 Jun 2010 05:34:53 -0400 Date: Wed, 2 Jun 2010 11:44:24 +0300 From: "Michael S. Tsirkin" Message-ID: <20100602084424.GA19574@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] virtio-net: stop vhost backend on vmstop List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Anthony Liguori , dlstevens@us.ibm.com vhost net currently keep 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(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index cb664e6..6a9d560 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 ? VIRTIO_CONFIG_S_DRIVER_OK : 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, n->vdev.status & status); } VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf) -- 1.7.1.12.g42b7f