diff options
author | Christian König <christian.koenig@amd.com> | 2021-01-15 14:32:39 +0100 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2021-01-20 15:05:45 +0100 |
commit | 7621350c6bb20fb6ab7eb988833ab96eac3dcbef (patch) | |
tree | 24929d0358a69f7b0a0f65cfa09b41b4687c2ed8 /include/linux/lockdep.h | |
parent | f987c9e0f537222e90dd3214bfc481860fe2abe0 (diff) | |
download | linux-7621350c6bb20fb6ab7eb988833ab96eac3dcbef.tar.gz linux-7621350c6bb20fb6ab7eb988833ab96eac3dcbef.tar.bz2 linux-7621350c6bb20fb6ab7eb988833ab96eac3dcbef.zip |
drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT v3
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.
v3: Add might_sleep() and also use lockdep_assert_none_held() in the
IOCTL path.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patchwork.freedesktop.org/patch/414944/
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r-- | include/linux/lockdep.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index b9e9adec73e8..6eb117c0d0f3 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -310,6 +310,10 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie); WARN_ON_ONCE(debug_locks && !lockdep_is_held(l)); \ } while (0) +#define lockdep_assert_none_held_once() do { \ + WARN_ON_ONCE(debug_locks && current->lockdep_depth); \ + } while (0) + #define lockdep_recursing(tsk) ((tsk)->lockdep_recursion) #define lockdep_pin_lock(l) lock_pin_lock(&(l)->dep_map) @@ -387,6 +391,7 @@ extern int lockdep_is_held(const void *); #define lockdep_assert_held_write(l) do { (void)(l); } while (0) #define lockdep_assert_held_read(l) do { (void)(l); } while (0) #define lockdep_assert_held_once(l) do { (void)(l); } while (0) +#define lockdep_assert_none_held_once() do { } while (0) #define lockdep_recursing(tsk) (0) |