hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/linux/rtmutex.h
....@@ -14,14 +14,10 @@
1414 #define __LINUX_RT_MUTEX_H
1515
1616 #include <linux/linkage.h>
17
-#include <linux/rbtree_type.h>
18
-#include <linux/spinlock_types_raw.h>
17
+#include <linux/rbtree.h>
18
+#include <linux/spinlock_types.h>
1919
2020 extern int max_lock_depth; /* for sysctl */
21
-
22
-#ifdef CONFIG_DEBUG_MUTEXES
23
-#include <linux/debug_locks.h>
24
-#endif
2521
2622 /**
2723 * The rt_mutex structure
....@@ -35,7 +31,12 @@
3531 raw_spinlock_t wait_lock;
3632 struct rb_root_cached waiters;
3733 struct task_struct *owner;
34
+#ifdef CONFIG_DEBUG_RT_MUTEXES
3835 int save_state;
36
+ const char *name, *file;
37
+ int line;
38
+ void *magic;
39
+#endif
3940 #ifdef CONFIG_DEBUG_LOCK_ALLOC
4041 struct lockdep_map dep_map;
4142 #endif
....@@ -48,7 +49,6 @@
4849 extern int rt_mutex_debug_check_no_locks_freed(const void *from,
4950 unsigned long len);
5051 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);
5252 #else
5353 static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
5454 unsigned long len)
....@@ -56,14 +56,24 @@
5656 return 0;
5757 }
5858 # define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
59
-# define rt_mutex_debug_task_free(t) do { } while (0)
6059 #endif
6160
62
-#define rt_mutex_init(mutex) \
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) \
6366 do { \
6467 static struct lock_class_key __key; \
6568 __rt_mutex_init(mutex, __func__, &__key); \
6669 } 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
6777
6878 #ifdef CONFIG_DEBUG_LOCK_ALLOC
6979 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname) \
....@@ -72,19 +82,12 @@
7282 #define __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)
7383 #endif
7484
75
-#define __RT_MUTEX_INITIALIZER_PLAIN(mutexname) \
76
- .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
85
+#define __RT_MUTEX_INITIALIZER(mutexname) \
86
+ { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
7787 , .waiters = RB_ROOT_CACHED \
7888 , .owner = NULL \
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 }
89
+ __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
90
+ __DEP_MAP_RT_MUTEX_INITIALIZER(mutexname)}
8891
8992 #define DEFINE_RT_MUTEX(mutexname) \
9093 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
....@@ -112,6 +115,9 @@
112115 #endif
113116
114117 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
+
115121 extern int rt_mutex_trylock(struct rt_mutex *lock);
116122
117123 extern void rt_mutex_unlock(struct rt_mutex *lock);