drm/virtio: exbuf->fence_fd unmodified on interrupted wait
authorRyan Neph <ryanneph@chromium.org>
Fri, 3 Feb 2023 23:33:44 +0000 (15:33 -0800)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Mon, 6 Feb 2023 17:10:56 +0000 (20:10 +0300)
commit8f20660f053cefd4693e69cfff9cf58f4f7c4929
treefb41c2678fefd55e0322d26fac74f8b7bd7dabe6
parent9f8b3706eb23bed26f7898af3c6f7fe3858564a1
drm/virtio: exbuf->fence_fd unmodified on interrupted wait

An interrupted dma_fence_wait() becomes an -ERESTARTSYS returned
to userspace ioctl(DRM_IOCTL_VIRTGPU_EXECBUFFER) calls, prompting to
retry the ioctl(), but the passed exbuf->fence_fd has been reset to -1,
making the retry attempt fail at sync_file_get_fence().

The uapi for DRM_IOCTL_VIRTGPU_EXECBUFFER is changed to retain the
passed value for exbuf->fence_fd when returning anything besides a
successful result from the ioctl.

Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization")
Signed-off-by: Ryan Neph <ryanneph@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230203233345.2477767-1-ryanneph@chromium.org
drivers/gpu/drm/virtio/virtgpu_ioctl.c
include/uapi/drm/virtgpu_drm.h