* [PATCH 0/2] drm/virtio: locking/reservation fixes
@ 2020-02-11 13:50 Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking Gerd Hoffmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-11 13:50 UTC (permalink / raw)
To: dri-devel; +Cc: Gerd Hoffmann, gurchetansingh
Gerd Hoffmann (2):
drm/virtio: fix virtio_gpu_execbuffer_ioctl locking
drm/virtio: fix virtio_gpu_cursor_plane_update().
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++----------
drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
2 files changed, 11 insertions(+), 10 deletions(-)
--
2.18.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking
2020-02-11 13:50 [PATCH 0/2] drm/virtio: locking/reservation fixes Gerd Hoffmann
@ 2020-02-11 13:50 ` Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 2/2] drm/virtio: fix virtio_gpu_cursor_plane_update() Gerd Hoffmann
2020-02-12 18:08 ` [PATCH 0/2] drm/virtio: locking/reservation fixes Chia-I Wu
2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-11 13:50 UTC (permalink / raw)
To: dri-devel
Cc: David Airlie, open list, open list:VIRTIO GPU DRIVER,
Gerd Hoffmann, gurchetansingh
Lockdep says we can't call vmemdup() while having objects reserved
because it needs the mmap semaphore. So reorder the calls reserve
the objects later.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 205ec4abae2b..0477d1250f2d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -126,22 +126,22 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
bo_handles = NULL;
}
- if (buflist) {
- ret = virtio_gpu_array_lock_resv(buflist);
- if (ret)
- goto out_unused_fd;
- }
-
buf = vmemdup_user(u64_to_user_ptr(exbuf->command), exbuf->size);
if (IS_ERR(buf)) {
ret = PTR_ERR(buf);
- goto out_unresv;
+ goto out_unused_fd;
+ }
+
+ if (buflist) {
+ ret = virtio_gpu_array_lock_resv(buflist);
+ if (ret)
+ goto out_memdup;
}
out_fence = virtio_gpu_fence_alloc(vgdev);
if(!out_fence) {
ret = -ENOMEM;
- goto out_memdup;
+ goto out_unresv;
}
if (out_fence_fd >= 0) {
@@ -160,11 +160,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
vfpriv->ctx_id, buflist, out_fence);
return 0;
-out_memdup:
- kvfree(buf);
out_unresv:
if (buflist)
virtio_gpu_array_unlock_resv(buflist);
+out_memdup:
+ kvfree(buf);
out_unused_fd:
kvfree(bo_handles);
if (buflist)
--
2.18.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drm/virtio: fix virtio_gpu_cursor_plane_update().
2020-02-11 13:50 [PATCH 0/2] drm/virtio: locking/reservation fixes Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking Gerd Hoffmann
@ 2020-02-11 13:50 ` Gerd Hoffmann
2020-02-12 18:08 ` [PATCH 0/2] drm/virtio: locking/reservation fixes Chia-I Wu
2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-11 13:50 UTC (permalink / raw)
To: dri-devel
Cc: David Airlie, open list, open list:VIRTIO GPU DRIVER,
Gerd Hoffmann, gurchetansingh
Add missing virtio_gpu_array_lock_resv() call.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index ac42c84d2d7f..d1c3f5fbfee4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -260,6 +260,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
if (!objs)
return;
virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]);
+ virtio_gpu_array_lock_resv(objs);
virtio_gpu_cmd_transfer_to_host_2d
(vgdev, 0,
plane->state->crtc_w,
--
2.18.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] drm/virtio: locking/reservation fixes
2020-02-11 13:50 [PATCH 0/2] drm/virtio: locking/reservation fixes Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 2/2] drm/virtio: fix virtio_gpu_cursor_plane_update() Gerd Hoffmann
@ 2020-02-12 18:08 ` Chia-I Wu
2 siblings, 0 replies; 4+ messages in thread
From: Chia-I Wu @ 2020-02-12 18:08 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: ML dri-devel, Gurchetan Singh
The fixes look reasonable.
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
On Tue, Feb 11, 2020 at 5:50 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
>
>
> Gerd Hoffmann (2):
> drm/virtio: fix virtio_gpu_execbuffer_ioctl locking
> drm/virtio: fix virtio_gpu_cursor_plane_update().
>
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++++++++++----------
> drivers/gpu/drm/virtio/virtgpu_plane.c | 1 +
> 2 files changed, 11 insertions(+), 10 deletions(-)
>
> --
> 2.18.2
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-12 18:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-11 13:50 [PATCH 0/2] drm/virtio: locking/reservation fixes Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 1/2] drm/virtio: fix virtio_gpu_execbuffer_ioctl locking Gerd Hoffmann
2020-02-11 13:50 ` [PATCH 2/2] drm/virtio: fix virtio_gpu_cursor_plane_update() Gerd Hoffmann
2020-02-12 18:08 ` [PATCH 0/2] drm/virtio: locking/reservation fixes Chia-I Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox