[patch V4 69/68] locking/rt: Add missing __might_sleep() to spin/rwlocks

From: Thomas Gleixner
Date: Fri Aug 13 2021 - 04:06:16 EST



From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

On RT enabled kernels the substituted spin_lock and rw_lock acquisition
functions can sleep.

Add the missing __might_sleep() invocations.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
V4+: This should have been part of the V4 submission, but got lost
during patch juggling.
---
kernel/locking/spinlock_rt.c | 3 +++
1 file changed, 3 insertions(+)
---
--- a/kernel/locking/spinlock_rt.c
+++ b/kernel/locking/spinlock_rt.c
@@ -32,6 +32,7 @@ static __always_inline void rtlock_lock(

static __always_inline void __rt_spin_lock(spinlock_t *lock)
{
+ ___might_sleep(__FILE__, __LINE__, 0);
rtlock_lock(&lock->lock);
rcu_read_lock();
migrate_disable();
@@ -206,6 +207,7 @@ EXPORT_SYMBOL(rt_write_trylock);

void __sched rt_read_lock(rwlock_t *rwlock)
{
+ ___might_sleep(__FILE__, __LINE__, 0);
rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_);
rwbase_read_lock(&rwlock->rwbase, TASK_RTLOCK_WAIT);
rcu_read_lock();
@@ -215,6 +217,7 @@ EXPORT_SYMBOL(rt_read_lock);

void __sched rt_write_lock(rwlock_t *rwlock)
{
+ ___might_sleep(__FILE__, __LINE__, 0);
rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_);
rwbase_write_lock(&rwlock->rwbase, TASK_RTLOCK_WAIT);
rcu_read_lock();