locking/rtmutex: Annotate API and implementation
PATCH 1/1 locking/rtmutex: Annotate API and implementation
Add lock context annotations to the rtmutex API and implementation and enable lock context analysis.
--- include/linux/rtmutex.h | 22 +++++++++++++++------- kernel/locking/Makefile | 1 + kernel/locking/rtmutex.c | 4 ++++ kernel/locking/rtmutex_api.c | 10 ++++++++-- 4 files changed, 28 insertions(+), 9 deletions(-)
include/linux/rtmutex.h +15 -7
@@ -56,6 +56,8 @@ static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)#endif extern void rt_mutex_base_init (struct rt_mutex_base *rtb); +context_lock_struct (rt_mutex); +/** * The rt_mutex structure *
@@ -108,8 +110,10 @@ do { \extern void __rt_mutex_init (struct rt_mutex *lock,const char *name,struct lock_class_key *key);#ifdef CONFIG_DEBUG_LOCK_ALLOC -extern void rt_mutex_lock_nested (struct rt_mutex *lock,unsigned int subclass); -extern void _rt_mutex_lock_nest_lock (struct rt_mutex *lock,struct lockdep_map *nest_lock); +extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass) + __acquires(lock); +extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock) + __acquires(lock);#define rt_mutex_lock (lock) rt_mutex_lock_nested(lock, 0)#define rt_mutex_lock_nest_lock (lock, nest_lock) \ do { \
@@ -118,15 +122,19 @@ extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map * } while (0)#else -extern void rt_mutex_lock (struct rt_mutex *lock); +extern void rt_mutex_lock(struct rt_mutex *lock) __acquires(lock);#define rt_mutex_lock_nested (lock, subclass) rt_mutex_lock(lock)#define rt_mutex_lock_nest_lock (lock, nest_lock) rt_mutex_lock(lock)#endif -extern int rt_mutex_lock_interruptible (struct rt_mutex *lock); -extern int rt_mutex_lock_killable (struct rt_mutex *lock); -extern int rt_mutex_trylock (struct rt_mutex *lock); +extern int rt_mutex_lock_interruptible(struct rt_mutex *lock) + __cond_acquires(0, lock); +extern int rt_mutex_lock_killable(struct rt_mutex *lock) + __cond_acquires(0, lock); +extern int rt_mutex_trylock(struct rt_mutex *lock) + __cond_acquires(true, lock); -extern void rt_mutex_unlock (struct rt_mutex *lock); +extern void rt_mutex_unlock(struct rt_mutex *lock) + __releases(lock);#endif
kernel/locking/Makefile +1 -0
@@ -4,6 +4,7 @@ KCOV_INSTRUMENT := n CONTEXT_ANALYSIS_mutex.o := y +CONTEXT_ANALYSIS_rtmutex.o := y CONTEXT_ANALYSIS_rtmutex_api.o := y CONTEXT_ANALYSIS_ww_rt_mutex.o := y CONTEXT_ANALYSIS_rwsem.o := y
kernel/locking/rtmutex.c +4 -0
@@ -484,6 +484,7 @@ static __always_inline bool __waiter_less(struct rb_node *a, const struct rb_nod static __always_inline voidrt_mutex_enqueue (struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);
@@ -492,6 +493,7 @@ rt_mutex_enqueue(struct rt_mutex_base *lock, struct rt_mutex_waiter *waiter) static __always_inline voidrt_mutex_dequeue (struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);
@@ -1092,6 +1094,7 @@ static int __sched rt_mutex_adjust_prio_chain(struct task_struct *task, static int __schedtry_to_take_rt_mutex (struct rt_mutex_base *lock,struct task_struct *task,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);
@@ -1319,6 +1322,7 @@ static int __sched task_blocks_on_rt_mutex(struct rt_mutex_base *lock,*/ static void __sched mark_wakeup_next_waiter(struct rt_wake_q_head *wqh,struct rt_mutex_base *lock) + __must_hold(&lock->wait_lock) {struct rt_mutex_waiter *waiter;
kernel/locking/rtmutex_api.c +8 -2
@@ -41,6 +41,7 @@ static __always_inline int __rt_mutex_lock_common(struct rt_mutex *lock,unsigned int state, struct lockdep_map *nest_lock, unsigned int subclass) + __cond_acquires(0, lock) { int ret;
@@ -66,12 +67,14 @@ EXPORT_SYMBOL(rt_mutex_base_init);* @subclass: the lockdep subclass */ void __sched rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass) + __no_context_analysis/* ignoring the return value below is fine in this case */ {__rt_mutex_lock_common (lock,TASK_UNINTERRUPTIBLE ,NULL , subclass); }EXPORT_SYMBOL_GPL (rt_mutex_lock_nested); void __sched _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock) + __no_context_analysis/* ignoring the return value below is fine in this case */ {__rt_mutex_lock_common (lock,TASK_UNINTERRUPTIBLE , nest_lock,0 ); }
@@ -157,6 +160,7 @@ void __sched rt_mutex_unlock(struct rt_mutex *lock) {mutex_release (&lock->dep_map, _RET_IP_);__rt_mutex_unlock (&lock->rtmutex); +__release (lock); }EXPORT_SYMBOL_GPL (rt_mutex_unlock);
@@ -182,6 +186,7 @@ int __sched __rt_mutex_futex_trylock(struct rt_mutex_base *lock)*/ bool __sched __rt_mutex_futex_unlock(struct rt_mutex_base *lock,struct rt_wake_q_head *wqh) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);
@@ -312,6 +317,7 @@ int __sched __rt_mutex_start_proxy_lock(struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter, struct task_struct *task, struct wake_q_head *wake_q) + __must_hold(&lock->wait_lock) { int ret;
@@ -526,7 +532,7 @@ static __always_inline int __mutex_lock_common(struct mutex *lock,unsigned int subclass, struct lockdep_map *nest_lock, unsigned long ip) - __acquires(lock) __no_context_analysis + __acquires(lock) { int ret;
@@ -648,7 +654,7 @@ EXPORT_SYMBOL(mutex_trylock);#endif /* !CONFIG_DEBUG_LOCK_ALLOC */ void __sched mutex_unlock(struct mutex *lock) -__releases (lock) __no_context_analysis +__releases (lock) {mutex_release (&lock->dep_map, _RET_IP_);__rt_mutex_unlock (&lock->rtmutex);
Quoted 5 lines · Bart Van Assche
Add lock context annotations to the rtmutex API and implementation and enable lock context analysis.
Signed-off-by Bart Van Assche <[email protected]>
If I'm not mistaken, Peter was working on this concurrently?
https://lore.kernel.org/all/[email protected]/ ?
Quoted 175 lines
--- include/linux/rtmutex.h | 22 +++++++++++++++------- kernel/locking/Makefile | 1 + kernel/locking/rtmutex.c | 4 ++++ kernel/locking/rtmutex_api.c | 10 ++++++++-- 4 files changed, 28 insertions(+), 9 deletions(-)include/linux/rtmutex.h +15
-7@@ -56,6 +56,8 @@ static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)#endif extern void rt_mutex_base_init (struct rt_mutex_base *rtb); +context_lock_struct (rt_mutex); +/** * The rt_mutex structure * @@ -108,8 +110,10 @@ do { \extern void __rt_mutex_init (struct rt_mutex *lock,const char *name,struct lock_class_key *key);#ifdef CONFIG_DEBUG_LOCK_ALLOC -extern void rt_mutex_lock_nested (struct rt_mutex *lock,unsigned int subclass); -extern void _rt_mutex_lock_nest_lock (struct rt_mutex *lock,struct lockdep_map *nest_lock); +extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass) + __acquires(lock); +extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock) + __acquires(lock);#define rt_mutex_lock (lock) rt_mutex_lock_nested(lock, 0)#define rt_mutex_lock_nest_lock (lock, nest_lock) \ do { \@@ -118,15 +122,19 @@ extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map * } while (0)#else -extern void rt_mutex_lock (struct rt_mutex *lock); +extern void rt_mutex_lock(struct rt_mutex *lock) __acquires(lock);#define rt_mutex_lock_nested (lock, subclass) rt_mutex_lock(lock)#define rt_mutex_lock_nest_lock (lock, nest_lock) rt_mutex_lock(lock)#endif -extern int rt_mutex_lock_interruptible (struct rt_mutex *lock); -extern int rt_mutex_lock_killable (struct rt_mutex *lock); -extern int rt_mutex_trylock (struct rt_mutex *lock); +extern int rt_mutex_lock_interruptible(struct rt_mutex *lock) + __cond_acquires(0, lock); +extern int rt_mutex_lock_killable(struct rt_mutex *lock) + __cond_acquires(0, lock); +extern int rt_mutex_trylock(struct rt_mutex *lock) + __cond_acquires(true, lock); -extern void rt_mutex_unlock (struct rt_mutex *lock); +extern void rt_mutex_unlock(struct rt_mutex *lock) + __releases(lock);#endif kernel/locking/Makefile +1
-0@@ -4,6 +4,7 @@ KCOV_INSTRUMENT := n CONTEXT_ANALYSIS_mutex.o := y +CONTEXT_ANALYSIS_rtmutex.o := y CONTEXT_ANALYSIS_rtmutex_api.o := y CONTEXT_ANALYSIS_ww_rt_mutex.o := y CONTEXT_ANALYSIS_rwsem.o := ykernel/locking/rtmutex.c +4
-0@@ -484,6 +484,7 @@ static __always_inline bool __waiter_less(struct rb_node *a, const struct rb_nod static __always_inline voidrt_mutex_enqueue (struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);@@ -492,6 +493,7 @@ rt_mutex_enqueue(struct rt_mutex_base *lock, struct rt_mutex_waiter *waiter) static __always_inline voidrt_mutex_dequeue (struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);@@ -1092,6 +1094,7 @@ static int __sched rt_mutex_adjust_prio_chain(struct task_struct *task, static int __schedtry_to_take_rt_mutex (struct rt_mutex_base *lock,struct task_struct *task,struct rt_mutex_waiter *waiter) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);@@ -1319,6 +1322,7 @@ static int __sched task_blocks_on_rt_mutex(struct rt_mutex_base *lock,*/ static void __sched mark_wakeup_next_waiter(struct rt_wake_q_head *wqh,struct rt_mutex_base *lock) + __must_hold(&lock->wait_lock) {struct rt_mutex_waiter *waiter;kernel/locking/rtmutex_api.c +8
-2@@ -41,6 +41,7 @@ static __always_inline int __rt_mutex_lock_common(struct rt_mutex *lock,unsigned int state, struct lockdep_map *nest_lock, unsigned int subclass) + __cond_acquires(0, lock) { int ret;@@ -66,12 +67,14 @@ EXPORT_SYMBOL(rt_mutex_base_init);* @subclass: the lockdep subclass */ void __sched rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass) + __no_context_analysis/* ignoring the return value below is fine in this case */ {__rt_mutex_lock_common (lock,TASK_UNINTERRUPTIBLE ,NULL , subclass); }EXPORT_SYMBOL_GPL (rt_mutex_lock_nested); void __sched _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock) + __no_context_analysis/* ignoring the return value below is fine in this case */ {__rt_mutex_lock_common (lock,TASK_UNINTERRUPTIBLE , nest_lock,0 ); }@@ -157,6 +160,7 @@ void __sched rt_mutex_unlock(struct rt_mutex *lock) {mutex_release (&lock->dep_map, _RET_IP_);__rt_mutex_unlock (&lock->rtmutex); +__release (lock); }EXPORT_SYMBOL_GPL (rt_mutex_unlock);@@ -182,6 +186,7 @@ int __sched __rt_mutex_futex_trylock(struct rt_mutex_base *lock)*/ bool __sched __rt_mutex_futex_unlock(struct rt_mutex_base *lock,struct rt_wake_q_head *wqh) + __must_hold(&lock->wait_lock) {lockdep_assert_held (&lock->wait_lock);@@ -312,6 +317,7 @@ int __sched __rt_mutex_start_proxy_lock(struct rt_mutex_base *lock,struct rt_mutex_waiter *waiter, struct task_struct *task, struct wake_q_head *wake_q) + __must_hold(&lock->wait_lock) { int ret;@@ -526,7 +532,7 @@ static __always_inline int __mutex_lock_common(struct mutex *lock,unsigned int subclass, struct lockdep_map *nest_lock, unsigned long ip) - __acquires(lock) __no_context_analysis + __acquires(lock) { int ret;@@ -648,7 +654,7 @@ EXPORT_SYMBOL(mutex_trylock);#endif /* !CONFIG_DEBUG_LOCK_ALLOC */ void __sched mutex_unlock(struct mutex *lock) -__releases (lock) __no_context_analysis +__releases (lock) {mutex_release (&lock->dep_map, _RET_IP_);__rt_mutex_unlock (&lock->rtmutex);
Quoted 9 lines · Marco Elver
Quoted 5 lines · Bart Van Assche
Add lock context annotations to the rtmutex API and implementation and enable lock context analysis.
Signed-off-by Bart Van Assche <[email protected]>If I'm not mistaken, Peter was working on this concurrently?
https://lore.kernel.org/all/[email protected]/ ?
Hmm ... I don't see CONTEXT_ANALYSIS_rtmutex.o := y in any of Peter's rtmutext patches. Did I perhaps overlook something? According to the results of this query my patch is the first patch that enables context analysis for rtmutex.c:
https://lore.kernel.org/all/?q=CONTEXT_ANALYSIS_rtmutex
Thanks,
Bart.
Peter Zijlstra
maintainerQuoted 4 lines · Bart Van Assche
Add lock context annotations to the rtmutex API and implementation and enable lock context analysis.
Signed-off-by Bart Van Assche <[email protected]>
This does not build, I need at least the below, but then PREEMPT_RT is still not happy.
---
include/linux/rtmutex.h +1 -1
@@ -20,7 +20,7 @@extern int max_lock_depth; -struct rt_mutex_base { +context_lock_struct (rt_mutex_base) {raw_spinlock_t wait_lock; struct rb_root_cached waiters __guarded_by(&wait_lock); struct task_struct *owner __guarded_by(&wait_lock);
kernel/locking/rtmutex.c +7 -0
@@ -314,6 +314,7 @@ static __always_inline bool rt_mutex_cmp static int __sched rt_mutex_slowtrylock(struct rt_mutex_base *lock); static __always_inline bool rt_mutex_try_acquire(struct rt_mutex_base *lock) +__cond_acquires (true, lock) {/* * With debug enabled rt_mutex_cmpxchg trylock() will always fail.
@@ -1095,6 +1096,7 @@ static int __sched try_to_take_rt_mutex(struct rt_mutex_base *lock, struct task_struct *task, struct rt_mutex_waiter *waiter) __must_hold(&lock->wait_lock) + __cond_acquires(nonzero, lock) { lockdep_assert_held(&lock->wait_lock);
@@ -1625,6 +1627,7 @@ static int __sched rt_mutex_slowlock_blostruct rt_mutex_waiter *waiter, struct wake_q_head *wake_q) __releases(&lock->wait_lock) __acquires(&lock->wait_lock) + __cond_acquires(0, lock) { struct rt_mutex *rtm = container_of(lock, struct rt_mutex, rtmutex);struct task_struct *owner;
@@ -1715,6 +1718,7 @@ static int __sched __rt_mutex_slowlock(sstruct rt_mutex_waiter *waiter, struct wake_q_head *wake_q) __must_hold(&lock->wait_lock) + __cond_acquires(0, lock) { struct rt_mutex *rtm = container_of(lock, struct rt_mutex, rtmutex);struct ww_mutex *ww =ww_container_of (rtm);
@@ -1773,6 +1777,7 @@ static inline int __rt_mutex_slowlock_lounsigned int state, struct wake_q_head *wake_q) __must_hold(&lock->wait_lock) + __cond_acquires(0, lock) { struct rt_mutex_waiter waiter;int ret;
@@ -1797,6 +1802,7 @@ static inline int __rt_mutex_slowlock_lo static int __sched rt_mutex_slowlock(struct rt_mutex_base *lock,struct ww_acquire_ctx *ww_ctx,unsigned int state) +__cond_acquires (0 , lock) {DEFINE_WAKE_Q (wake_q);unsigned long flags;
@@ -1829,6 +1835,7 @@ static int __sched rt_mutex_slowlock(str static __always_inline int __rt_mutex_lock(struct rt_mutex_base *lock,unsigned int state) +__cond_acquires (0 , lock) {lockdep_assert (!current->pi_blocked_on);
kernel/locking/rtmutex_api.c +2 -1
@@ -88,6 +88,7 @@ EXPORT_SYMBOL_GPL(_rt_mutex_lock_nest_lo* @lock: the rt_mutex to be locked */ void __sched rt_mutex_lock(struct rt_mutex *lock) + __no_context_analysis/* ignoring the return value below is fine in this case */ {__rt_mutex_lock_common (lock,TASK_UNINTERRUPTIBLE ,NULL ,0 ); }
@@ -532,7 +533,7 @@ static __always_inline int __mutex_lock_unsigned int subclass, struct lockdep_map *nest_lock, unsigned long ip) - __acquires(lock) + __cond_acquires(0, lock) { int ret;
Quoted 2 lines · Peter Zijlstra
This does not build, I need at least the below, but then
PREEMPT_RTis still not happy.
Apparently I had tested my patch with PREEMPT_RT=n only. The patch below should support both PREEMPT_RT=n and PREEMPT_RT=y:
--- include/linux/rtmutex.h | 22 +++++++++++++++------- kernel/locking/Makefile | 1 + kernel/locking/rtmutex.c | 5 +++++ kernel/locking/rtmutex_api.c | 6 ++++++ 4 files changed, 27 insertions(+), 7 deletions(-)
include/linux/rtmutex.h +2 -0
@@ -56,6 +56,8 @@ static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)#endif extern void rt_mutex_base_init (struct rt_mutex_base *rtb); +context_lock_struct (rt_mutex); +/** * The rt_mutex structure *
@@ -108,8 +110,10 @@ do { \ extern void __rt_mutex_init(struct rt_mutex *lock, const char *name,
struct lock_class_key *key);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
-extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass); -extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock); +extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass)
+ __acquires(lock);
+extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *nest_lock)
+ __acquires(lock);
#define rt_mutex_lock(lock) rt_mutex_lock_nested(lock, 0)
#define rt_mutex_lock_nest_lock(lock, nest_lock) \
do { \
@@ -118,15 +122,19 @@ extern void _rt_mutex_lock_nest_lock(struct rt_mutex *lock, struct lockdep_map *
} while (0)
#else
-extern void rt_mutex_lock(struct rt_mutex *lock);
+extern void rt_mutex_lock(struct rt_mutex *lock) __acquires(lock);
#define rt_mutex_lock_nested(lock, subclass) rt_mutex_lock(lock) #define rt_mutex_lock_nest_lock(lock, nest_lock) rt_mutex_lock(lock) #endif
-extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); -extern int rt_mutex_lock_killable(struct rt_mutex *lock); -extern int rt_mutex_trylock(struct rt_mutex *lock); +extern int rt_mutex_lock_interruptible(struct rt_mutex *lock)
+ __cond_acquires(0, lock);
+extern int rt_mutex_lock_killable(struct rt_mutex *lock)
+ __cond_acquires(0, lock);
+extern int rt_mutex_trylock(struct rt_mutex *lock)
+ __cond_acquires(true, lock);
-extern void rt_mutex_unlock(struct rt_mutex *lock); +extern void rt_mutex_unlock(struct rt_mutex *lock)
+ __releases(lock);
#endif
kernel/locking/Makefile +1 -0
@@ -4,6 +4,7 @@ KCOV_INSTRUMENT := n CONTEXT_ANALYSIS_mutex.o := y +CONTEXT_ANALYSIS_rtmutex.o := y CONTEXT_ANALYSIS_rtmutex_api.o := y CONTEXT_ANALYSIS_ww_rt_mutex.o := y CONTEXT_ANALYSIS_rwsem.o := y
kernel/locking/rtmutex.c +0 -0
@@ -484,6 +484,7 @@ static __always_inline bool __waiter_less(struct rb_node *a, const struct rb_nod static __always_inline void rt_mutex_enqueue(struct rt_mutex_base *lock, struct rt_mutex_waiter
*waiter)
+ __must_hold(&lock->wait_lock)
{
lockdep_assert_held(&lock->wait_lock);
@@ -492,6 +493,7 @@ rt_mutex_enqueue(struct rt_mutex_base *lock, struct rt_mutex_waiter *waiter)
static __always_inline void
rt_mutex_dequeue(struct rt_mutex_base *lock, struct rt_mutex_waiter
*waiter)
+ __must_hold(&lock->wait_lock)
{
lockdep_assert_held(&lock->wait_lock);
@@ -1092,6 +1094,7 @@ static int __sched rt_mutex_adjust_prio_chain(struct task_struct *task,
static int __sched
try_to_take_rt_mutex(struct rt_mutex_base *lock, struct task_struct *task,
struct rt_mutex_waiter *waiter)
+ __must_hold(&lock->wait_lock)
{
lockdep_assert_held(&lock->wait_lock);
@@ -1319,6 +1322,7 @@ static int __sched task_blocks_on_rt_mutex(struct rt_mutex_base *lock,
*/
static void __sched mark_wakeup_next_waiter(struct rt_wake_q_head *wqh,
struct rt_mutex_base *lock)
+ __must_hold(&lock->wait_lock)
{
struct rt_mutex_waiter *waiter;
@@ -1479,6 +1483,7 @@ static void __sched rt_mutex_slowunlock(struct rt_mutex_base *lock)
}
static __always_inline void __rt_mutex_unlock(struct rt_mutex_base *lock)
+ __no_context_analysis
{
if (likely(rt_mutex_cmpxchg_release(lock, current, NULL)))
return;
kernel/locking/rtmutex_api.c +1 -0
@@ -41,6 +41,7 @@ static __always_inline int __rt_mutex_lock_common(struct rt_mutex *lock,unsigned int state, struct lockdep_map *nest_lock, unsigned int subclass) + __cond_acquires(0, lock) { int ret;
@@ -66,12 +67,14 @@ EXPORT_SYMBOL(rt_mutex_base_init);* @subclass: the lockdep subclass */ void __sched rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int
subclass)
+ __no_context_analysis /* ignoring the return value below is fine in this case */
{
__rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, NULL, subclass);
}
EXPORT_SYMBOL_GPL(rt_mutex_lock_nested);
void __sched _rt_mutex_lock_nest_lock(struct rt_mutex *lock, structlockdep_map *nest_lock)
+ __no_context_analysis /* ignoring the return value below is fine in this case */
{
__rt_mutex_lock_common(lock, TASK_UNINTERRUPTIBLE, nest_lock, 0);
}
@@ -157,6 +160,7 @@ void __sched rt_mutex_unlock(struct rt_mutex *lock)
{
mutex_release(&lock->dep_map, _RET_IP_); __rt_mutex_unlock(&lock->rtmutex);
+ __release(lock);
}
EXPORT_SYMBOL_GPL(rt_mutex_unlock);
@@ -182,6 +186,7 @@ int __sched __rt_mutex_futex_trylock(struct rt_mutex_base *lock)
*/
bool __sched __rt_mutex_futex_unlock(struct rt_mutex_base *lock,
struct rt_wake_q_head *wqh)
+ __must_hold(&lock->wait_lock)
{
lockdep_assert_held(&lock->wait_lock);
@@ -312,6 +317,7 @@ int __sched __rt_mutex_start_proxy_lock(struct rt_mutex_base *lock,
struct rt_mutex_waiter *waiter, struct task_struct *task,
struct wake_q_head *wake_q)
+ __must_hold(&lock->wait_lock)
{
int ret;
Peter Zijlstra
maintainerQuoted 5 lines · Bart Van Assche
Quoted 2 lines · Peter Zijlstra
This does not build, I need at least the below, but then
PREEMPT_RTis still not happy.Apparently I had tested my patch with PREEMPT_RT=n only. The patch below should support both PREEMPT_RT=n and PREEMPT_RT=y:
Is whitespace mangled :/