From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-net: properly check the vhost status during status set
Date: Fri, 26 Apr 2013 15:26:28 +0300 [thread overview]
Message-ID: <20130426122628.GA15119@redhat.com> (raw)
In-Reply-To: <1366972060-21606-1-git-send-email-jasowang@redhat.com>
On Fri, Apr 26, 2013 at 06:27:40PM +0800, Jason Wang wrote:
> Commit 32993698 (vhost: disable on tap link down) tries to disable the vhost
> also when the peer's link is down. But the check was not done properly, the
> vhost were only started when:
>
> 1) peer's link is not down
> 2) virtio-net has already been started.
>
> Since == have a higher precedence than &&, place a brace to make sure both the
> conditions were met then does the check. This fixes the crash when doing a savem
> after set the link off which let qemu crash and complains:
>
> virtio_net_save: Assertion `!n->vhost_started' failed.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Hmm okay, but now that I think about this,
e.g. if link is up later, vhost will not be started.
So the correct thing is maybe to start vhost but use
some backend that will drop all packets.
And add a callback so we know peer state changed.
Hmm do we need a kernel change for this?
> ---
> hw/net/virtio-net.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 4d2cdd2..6222039 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -114,8 +114,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
> return;
> }
>
> - if (!!n->vhost_started == virtio_net_started(n, status) &&
> - !nc->peer->link_down) {
> + if (!!n->vhost_started ==
> + (virtio_net_started(n, status) && !nc->peer->link_down)) {
> return;
> }
> if (!n->vhost_started) {
> --
> 1.7.1
next prev parent reply other threads:[~2013-04-26 12:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 10:27 [Qemu-devel] [PATCH] virtio-net: properly check the vhost status during status set Jason Wang
2013-04-26 12:26 ` Michael S. Tsirkin [this message]
2013-04-27 5:11 ` Jason Wang
2013-04-27 19:32 ` Michael S. Tsirkin
2013-04-28 7:51 ` Jason Wang
2013-04-28 8:25 ` Michael S. Tsirkin
2013-04-28 8:42 ` Jason Wang
2013-05-07 5:56 ` Jason Wang
2013-05-07 11:25 ` Michael S. Tsirkin
2013-05-07 18:50 ` 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=20130426122628.GA15119@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jasowang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.