rt_mutex: Add lockdep annotations
Now that (PI) futexes have their own private RT-mutex interface and implementation we can easily add lockdep annotations to the existing RT-mutex interface. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
3942b77121
commit
f5694788ad
@@ -37,6 +37,9 @@ struct rt_mutex {
|
||||
int line;
|
||||
void *magic;
|
||||
#endif
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
struct lockdep_map dep_map;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct rt_mutex_waiter;
|
||||
@@ -58,19 +61,33 @@ struct hrtimer_sleeper;
|
||||
#ifdef CONFIG_DEBUG_RT_MUTEXES
|
||||
# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
|
||||
, .name = #mutexname, .file = __FILE__, .line = __LINE__
|
||||
# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__)
|
||||
|
||||
# define rt_mutex_init(mutex) \
|
||||
do { \
|
||||
static struct lock_class_key __key; \
|
||||
__rt_mutex_init(mutex, __func__, &__key); \
|
||||
} while (0)
|
||||
|
||||
extern void rt_mutex_debug_task_free(struct task_struct *tsk);
|
||||
#else
|
||||
# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
|
||||
# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL)
|
||||
# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL, NULL)
|
||||
# define rt_mutex_debug_task_free(t) do { } while (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
||||
#define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \
|
||||
, .dep_map = { .name = #mutexname }
|
||||
#else
|
||||
#define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
|
||||
#endif
|
||||
|
||||
#define __RT_MUTEX_INITIALIZER(mutexname) \
|
||||
{ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
|
||||
, .waiters = RB_ROOT \
|
||||
, .owner = NULL \
|
||||
__DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
|
||||
__DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
|
||||
__DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)}
|
||||
|
||||
#define DEFINE_RT_MUTEX(mutexname) \
|
||||
struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
|
||||
@@ -86,7 +103,7 @@ static inline int rt_mutex_is_locked(struct rt_mutex *lock)
|
||||
return lock->owner != NULL;
|
||||
}
|
||||
|
||||
extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
|
||||
extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key);
|
||||
extern void rt_mutex_destroy(struct rt_mutex *lock);
|
||||
|
||||
extern void rt_mutex_lock(struct rt_mutex *lock);
|
||||
|
Reference in New Issue
Block a user