Patchwork [for,3.4,1/2] vhost: zerocopy: poll vq in zerocopy callback

login
register
mail settings
Submitter Jason Wang
Date Aug. 6, 2013, 9:29 a.m.
Message ID <1375781359-5764-1-git-send-email-jasowang@redhat.com>
Download mbox | patch
Permalink /patch/264953/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Jason Wang - Aug. 6, 2013, 9:29 a.m.
commit c70aa540c7a9f67add11ad3161096fb95233aa2e upstream.

We add used and signal guest in worker thread but did not poll the virtqueue
during the zero copy callback. This may lead the missing of adding and
signalling during zerocopy. Solve this by polling the virtqueue and let it
wakeup the worker during callback.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/vhost/vhost.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Michael S. Tsirkin - Aug. 6, 2013, 10:04 a.m.
On Tue, Aug 06, 2013 at 05:29:18PM +0800, Jason Wang wrote:
> commit c70aa540c7a9f67add11ad3161096fb95233aa2e upstream.
> 
> We add used and signal guest in worker thread but did not poll the virtqueue
> during the zero copy callback. This may lead the missing of adding and
> signalling during zerocopy. Solve this by polling the virtqueue and let it
> wakeup the worker during callback.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/vhost/vhost.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 1a9e2a9..a50cb9c 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1603,6 +1603,7 @@ void vhost_zerocopy_callback(struct ubuf_info *ubuf)
>  	struct vhost_ubuf_ref *ubufs = ubuf->ctx;
>  	struct vhost_virtqueue *vq = ubufs->vq;
>  
> +	vhost_poll_queue(&vq->poll);
>  	/* set len = 1 to mark this desc buffers done DMA */
>  	vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
>  	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
> -- 
> 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 1a9e2a9..a50cb9c 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1603,6 +1603,7 @@  void vhost_zerocopy_callback(struct ubuf_info *ubuf)
 	struct vhost_ubuf_ref *ubufs = ubuf->ctx;
 	struct vhost_virtqueue *vq = ubufs->vq;
 
+	vhost_poll_queue(&vq->poll);
 	/* set len = 1 to mark this desc buffers done DMA */
 	vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
 	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);