drm/virtio: fix a wait_event condition
authorChia-I Wu <olvaffe@gmail.com>
Wed, 5 Feb 2020 18:19:45 +0000 (10:19 -0800)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 6 Feb 2020 10:55:08 +0000 (11:55 +0100)
outcnt may be greater than 1 since commit e1218b8c0cc1 ("drm/virtio:
Use vmalloc for command buffer allocations.").

Fixes: e1218b8c0cc1 ("drm/virtio: Use vmalloc for command buffer allocations.")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Cc: David Riley <davidriley@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-2-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_vq.c

index 83f2293..301f475 100644 (file)
@@ -391,7 +391,8 @@ again:
         */
        if (vq->num_free < 2 + outcnt) {
                spin_unlock(&vgdev->ctrlq.qlock);
-               wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= 3);
+               wait_event(vgdev->ctrlq.ack_queue,
+                          vq->num_free >= 2 + outcnt);
                goto again;
        }