lkml.org 
[lkml]   [2021]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT v2
From
Date
Hi,

Just a comment about the comments:

On 1/18/21 10:03 AM, Christian König wrote:
> DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT can't be used when we hold locks
> since we are basically waiting for userspace to do something.
>
> Holding a lock while doing so can trivial deadlock with page faults
> etc...
>
> So make lockdep complain when a driver tries to do this.
>
> v2: Add lockdep_assert_none_held() macro.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/drm_syncobj.c | 7 +++++++
> include/linux/lockdep.h | 5 +++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> 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

held because

> + * trivial deadlock with page faults for example. Make lockdep complain

trivially

> + * about it early on.
> + */
> + if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)
> + lockdep_assert_none_held_once();
> +
> *fence = drm_syncobj_fence_get(syncobj);
> drm_syncobj_put(syncobj);
>


thanks.
--
~Randy
You can't do anything without having to do something else first.
-- Belefant's Law

\
 
 \ /
  Last update: 2021-01-18 20:44    [W:0.090 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site