From: "Michael S. Tsirkin" <mst@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCHv2] virtio-net: stop vhost backend on vmstop
Date: Wed, 2 Jun 2010 21:01:52 +0300 [thread overview]
Message-ID: <20100602180152.GA21861@redhat.com> (raw)
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 <dlstevens@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
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
next reply other threads:[~2010-06-02 18:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 18:01 Michael S. Tsirkin [this message]
2010-06-04 17:03 ` [PATCHv2] virtio-net: stop vhost backend on vmstop Marcelo Tosatti
2010-06-10 14:19 ` Michael S. Tsirkin
2010-06-10 14:28 ` Anthony Liguori
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=20100602180152.GA21861@redhat.com \
--to=mst@redhat.com \
--cc=kvm@vger.kernel.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).