| .. | .. |
|---|
| 14 | 14 | #define __LINUX_RT_MUTEX_H |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | #include <linux/linkage.h> |
|---|
| 17 | | -#include <linux/rbtree.h> |
|---|
| 18 | | -#include <linux/spinlock_types.h> |
|---|
| 17 | +#include <linux/rbtree_type.h> |
|---|
| 18 | +#include <linux/spinlock_types_raw.h> |
|---|
| 19 | 19 | |
|---|
| 20 | 20 | extern int max_lock_depth; /* for sysctl */ |
|---|
| 21 | + |
|---|
| 22 | +#ifdef CONFIG_DEBUG_MUTEXES |
|---|
| 23 | +#include <linux/debug_locks.h> |
|---|
| 24 | +#endif |
|---|
| 21 | 25 | |
|---|
| 22 | 26 | /** |
|---|
| 23 | 27 | * The rt_mutex structure |
|---|
| .. | .. |
|---|
| 31 | 35 | raw_spinlock_t wait_lock; |
|---|
| 32 | 36 | struct rb_root_cached waiters; |
|---|
| 33 | 37 | struct task_struct *owner; |
|---|
| 34 | | -#ifdef CONFIG_DEBUG_RT_MUTEXES |
|---|
| 35 | 38 | int save_state; |
|---|
| 36 | | - const char *name, *file; |
|---|
| 37 | | - int line; |
|---|
| 38 | | - void *magic; |
|---|
| 39 | | -#endif |
|---|
| 40 | 39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 41 | 40 | struct lockdep_map dep_map; |
|---|
| 42 | 41 | #endif |
|---|
| .. | .. |
|---|
| 49 | 48 | extern int rt_mutex_debug_check_no_locks_freed(const void *from, |
|---|
| 50 | 49 | unsigned long len); |
|---|
| 51 | 50 | extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task); |
|---|
| 51 | + extern void rt_mutex_debug_task_free(struct task_struct *tsk); |
|---|
| 52 | 52 | #else |
|---|
| 53 | 53 | static inline int rt_mutex_debug_check_no_locks_freed(const void *from, |
|---|
| 54 | 54 | unsigned long len) |
|---|
| .. | .. |
|---|
| 56 | 56 | return 0; |
|---|
| 57 | 57 | } |
|---|
| 58 | 58 | # define rt_mutex_debug_check_no_locks_held(task) do { } while (0) |
|---|
| 59 | +# define rt_mutex_debug_task_free(t) do { } while (0) |
|---|
| 59 | 60 | #endif |
|---|
| 60 | 61 | |
|---|
| 61 | | -#ifdef CONFIG_DEBUG_RT_MUTEXES |
|---|
| 62 | | -# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 63 | | - , .name = #mutexname, .file = __FILE__, .line = __LINE__ |
|---|
| 64 | | - |
|---|
| 65 | | -# define rt_mutex_init(mutex) \ |
|---|
| 62 | +#define rt_mutex_init(mutex) \ |
|---|
| 66 | 63 | do { \ |
|---|
| 67 | 64 | static struct lock_class_key __key; \ |
|---|
| 68 | 65 | __rt_mutex_init(mutex, __func__, &__key); \ |
|---|
| 69 | 66 | } while (0) |
|---|
| 70 | | - |
|---|
| 71 | | - extern void rt_mutex_debug_task_free(struct task_struct *tsk); |
|---|
| 72 | | -#else |
|---|
| 73 | | -# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 74 | | -# define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL, NULL) |
|---|
| 75 | | -# define rt_mutex_debug_task_free(t) do { } while (0) |
|---|
| 76 | | -#endif |
|---|
| 77 | 67 | |
|---|
| 78 | 68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 79 | 69 | #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| .. | .. |
|---|
| 82 | 72 | #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 83 | 73 | #endif |
|---|
| 84 | 74 | |
|---|
| 85 | | -#define __RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 86 | | - { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
|---|
| 75 | +#define __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 76 | + .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ |
|---|
| 87 | 77 | , .waiters = RB_ROOT_CACHED \ |
|---|
| 88 | 78 | , .owner = NULL \ |
|---|
| 89 | | - __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 90 | | - __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)} |
|---|
| 79 | + __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) |
|---|
| 80 | + |
|---|
| 81 | +#define __RT_MUTEX_INITIALIZER(mutexname) \ |
|---|
| 82 | + { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 83 | + , .save_state = 0 } |
|---|
| 84 | + |
|---|
| 85 | +#define __RT_MUTEX_INITIALIZER_SAVE_STATE(mutexname) \ |
|---|
| 86 | + { __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \ |
|---|
| 87 | + , .save_state = 1 } |
|---|
| 91 | 88 | |
|---|
| 92 | 89 | #define DEFINE_RT_MUTEX(mutexname) \ |
|---|
| 93 | 90 | struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname) |
|---|
| .. | .. |
|---|
| 115 | 112 | #endif |
|---|
| 116 | 113 | |
|---|
| 117 | 114 | extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); |
|---|
| 118 | | -extern int rt_mutex_timed_lock(struct rt_mutex *lock, |
|---|
| 119 | | - struct hrtimer_sleeper *timeout); |
|---|
| 120 | | - |
|---|
| 121 | 115 | extern int rt_mutex_trylock(struct rt_mutex *lock); |
|---|
| 122 | 116 | |
|---|
| 123 | 117 | extern void rt_mutex_unlock(struct rt_mutex *lock); |
|---|