qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: yuri.benditovich@daynix.com,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	qemu-devel@nongnu.org
Cc: dmitry@daynix.com, yan@daynix.com
Subject: Re: [Qemu-devel] [PATCH v2 2/3] net: vhost stop updates virtio queue state
Date: Wed, 9 Nov 2016 18:07:29 +0100	[thread overview]
Message-ID: <a2c227f3-fa63-916b-10aa-7ebda934f8b3@redhat.com> (raw)
In-Reply-To: <1478704922-3400-3-git-send-email-yuri.benditovich@daynix.com>



On 09/11/2016 16:22, yuri.benditovich@daynix.com wrote:
> From: Yuri Benditovich <yuri.benditovich@daynix.com>
> 
> Make virtio queue suitable for push operation from qemu
> after vhost was stopped.
> 
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
>  hw/virtio/vhost.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index bd051ab..2e990d0 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -963,6 +963,7 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
>          virtio_queue_set_last_avail_idx(vdev, idx, state.num);
>      }
>      virtio_queue_invalidate_signalled_used(vdev, idx);
> +    virtio_queue_update_used_idx(vdev, idx);

All three functions virtio_queue_set_last_avail_idx,
virtio_queue_invalidate_signalled_used, virtio_queue_update_used_idx are
only used here.

Plus, virtio_queue_set_last_avail_idx is always called in practice,
since the only failure modes for VHOST_GET_VRING_BASE are EFAULT and
out-of-range virtqueue number.  In both cases QEMU can ignore the other
two steps.

So perhaps we should have a single function virtio_queue_set_vring_base,
taking a vhost_vring_state struct?  It can do all three.

Paolo

>  
>      /* In the cross-endian case, we need to reset the vring endianness to
>       * native as legacy devices expect so by default.
> 

  reply	other threads:[~2016-11-09 17:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 15:21 [Qemu-devel] [PATCH v2 0/3] virtio-net discards TX data after link down yuri.benditovich
2016-11-09 15:22 ` [Qemu-devel] [PATCH v2 1/3] net: Add virtio queue interface to update used index from vring state yuri.benditovich
2016-11-09 15:22 ` [Qemu-devel] [PATCH v2 2/3] net: vhost stop updates virtio queue state yuri.benditovich
2016-11-09 17:07   ` Paolo Bonzini [this message]
2016-11-09 20:12     ` Michael S. Tsirkin
2016-11-09 15:22 ` [Qemu-devel] [PATCH v2 3/3] net: virtio-net discards TX data after link down yuri.benditovich
2016-11-09 20:28   ` Michael S. Tsirkin
2016-11-09 23:56     ` Yuri Benditovich
2016-11-10 13:54       ` Michael S. Tsirkin
2016-11-10 20:56         ` Yuri Benditovich
2016-11-23  9:52         ` Yuri Benditovich
2016-11-23 13:16           ` Michael S. Tsirkin

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=a2c227f3-fa63-916b-10aa-7ebda934f8b3@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /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).