From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT
Date: Fri, 15 Jan 2021 14:35:50 +0100 [thread overview]
Message-ID: <20210115133550.1678-1-christian.koenig@amd.com> (raw)
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT can't be used when a reservation
object lock is help or otherwise we can deadlock with page faults.
Make lockdep complain badly about that.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/drm_syncobj.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 6e74e6745eca..6228e9cd089a 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -387,6 +387,20 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
if (!syncobj)
return -ENOENT;
+ if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT &&
+ IS_ENABLED(CONFIG_LOCKDEP)) {
+ struct dma_resv robj;
+
+ /* Waiting for userspace with a reservation lock help is illegal
+ * cause that can deadlock with page faults. Make lockdep
+ * complain about it early on.
+ */
+ dma_resv_init(&robj);
+ dma_resv_lock(&robj, NULL);
+ dma_resv_unlock(&robj);
+ dma_resv_fini(&robj);
+ }
+
*fence = drm_syncobj_fence_get(syncobj);
drm_syncobj_put(syncobj);
--
2.25.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2021-01-15 13:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 13:35 Christian König [this message]
2021-01-15 13:52 ` [PATCH] drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210115133550.1678-1-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.