qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/3] net: vhost stop updates virtio queue sta


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 2/3] net: vhost stop updates virtio queue state
Date: Wed, 9 Nov 2016 18:07:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 09/11/2016 16:22, address@hidden wrote:
> From: Yuri Benditovich <address@hidden>
> 
> Make virtio queue suitable for push operation from qemu
> after vhost was stopped.
> 
> Signed-off-by: Yuri Benditovich <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]