Commit b41cda03 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

locking/rtmutex: Set proper wait context for lockdep

RT mutexes belong to the LD_WAIT_SLEEP class. Make them so.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210815211302.031014562@linutronix.de
parent d8bbd97a
...@@ -52,17 +52,22 @@ do { \ ...@@ -52,17 +52,22 @@ do { \
} while (0) } while (0)
#ifdef CONFIG_DEBUG_LOCK_ALLOC #ifdef CONFIG_DEBUG_LOCK_ALLOC
#define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \ #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \
, .dep_map = { .name = #mutexname } .dep_map = { \
.name = #mutexname, \
.wait_type_inner = LD_WAIT_SLEEP, \
}
#else #else
#define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
#endif #endif
#define __RT_MUTEX_INITIALIZER(mutexname) \ #define __RT_MUTEX_INITIALIZER(mutexname) \
{ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ { \
, .waiters = RB_ROOT_CACHED \ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock), \
, .owner = NULL \ .waiters = RB_ROOT_CACHED, \
__DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)} .owner = NULL, \
__DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \
}
#define DEFINE_RT_MUTEX(mutexname) \ #define DEFINE_RT_MUTEX(mutexname) \
struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname) struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
......
...@@ -1556,7 +1556,7 @@ void __sched __rt_mutex_init(struct rt_mutex *lock, const char *name, ...@@ -1556,7 +1556,7 @@ void __sched __rt_mutex_init(struct rt_mutex *lock, const char *name,
struct lock_class_key *key) struct lock_class_key *key)
{ {
debug_check_no_locks_freed((void *)lock, sizeof(*lock)); debug_check_no_locks_freed((void *)lock, sizeof(*lock));
lockdep_init_map(&lock->dep_map, name, key, 0); lockdep_init_map_wait(&lock->dep_map, name, key, 0, LD_WAIT_SLEEP);
__rt_mutex_basic_init(lock); __rt_mutex_basic_init(lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment