<div dir="auto"><div dir="auto"><br></div><div dir="auto">Reviewed-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri., 20 Apr. 2018, 17:23 Gerd Hoffmann, <<a href="mailto:kraxel@redhat.com">kraxel@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Apr 03, 2018 at 11:59:04AM +0200, Gerd Hoffmann wrote:<br>
> Wait until we have enough space in the virt queue to actually queue up<br>
> our request.  Avoids the guest spinning in case we have a non-zero<br>
> amount of free entries but not enough for the request.<br>
<br>
Ping airlied, can you please either pick it up or review so I can commit<br>
myself?<br>
<br>
thanks,<br>
  Gerd<br>
<br>
> Cc: <a href="mailto:stable@vger.kernel.org" target="_blank" rel="noreferrer">stable@vger.kernel.org</a><br>
> Reported-by: Alain Magloire <<a href="mailto:amagloire@blackberry.com" target="_blank" rel="noreferrer">amagloire@blackberry.com</a>><br>
> Signed-off-by: Gerd Hoffmann <<a href="mailto:kraxel@redhat.com" target="_blank" rel="noreferrer">kraxel@redhat.com</a>><br>
> ---<br>
>  drivers/gpu/drm/virtio/virtgpu_vq.c | 4 ++--<br>
>  1 file changed, 2 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c<br>
> index 48e4f1df6e..020070d483 100644<br>
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c<br>
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c<br>
> @@ -293,7 +293,7 @@ static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev,<br>
>       ret = virtqueue_add_sgs(vq, sgs, outcnt, incnt, vbuf, GFP_ATOMIC);<br>
>       if (ret == -ENOSPC) {<br>
>               spin_unlock(&vgdev->ctrlq.qlock);<br>
> -             wait_event(vgdev->ctrlq.ack_queue, vq->num_free);<br>
> +             wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= outcnt + incnt);<br>
>               spin_lock(&vgdev->ctrlq.qlock);<br>
>               goto retry;<br>
>       } else {<br>
> @@ -368,7 +368,7 @@ static int virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev,<br>
>       ret = virtqueue_add_sgs(vq, sgs, outcnt, 0, vbuf, GFP_ATOMIC);<br>
>       if (ret == -ENOSPC) {<br>
>               spin_unlock(&vgdev->cursorq.qlock);<br>
> -             wait_event(vgdev->cursorq.ack_queue, vq->num_free);<br>
> +             wait_event(vgdev->cursorq.ack_queue, vq->num_free >= outcnt);<br>
>               spin_lock(&vgdev->cursorq.qlock);<br>
>               goto retry;<br>
>       } else {<br>
> -- <br>
> 2.9.3<br>
> <br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</blockquote></div>