On Mon, Jan 18, 2021 at 07:03:34PM +0100, Christian König wrote:
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.cEgads, the cursed comment style is spreading :/
index 6e74e6745eca..f51458615158 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -387,6 +387,13 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
if (!syncobj)
return -ENOENT;
+ /* Waiting for userspace with locks help is illegal cause that can
+ * trivial deadlock with page faults for example. Make lockdep complain
+ * about it early on.
+ */
+ if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)Should this not be part of drm_syncobj_fence_add_wait() instead?
+ lockdep_assert_none_held_once();
+
Also, do you want to sprinkle might_sleep() around ?
*fence = drm_syncobj_fence_get(syncobj);
drm_syncobj_put(syncobj);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h