Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking/rt: Add sparse annotation for RCU.

Every lock, that becomes a sleeping lock on PREEMPT_RT, starts a RCU read
side critical section. There is no sparse annotation for this and sparse
complains about unbalanced locking.

Add __acquires/ __releases for the RCU lock. This covers all but the
trylock functions. A __cond_acquires() annotation didn't work.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240812104200.2239232-4-bigeasy@linutronix.de

authored by

Sebastian Andrzej Siewior and committed by
Thomas Gleixner
168660b8 b1f01f9e

+7 -7
+7 -7
kernel/locking/spinlock_rt.c
··· 51 51 migrate_disable(); 52 52 } 53 53 54 - void __sched rt_spin_lock(spinlock_t *lock) 54 + void __sched rt_spin_lock(spinlock_t *lock) __acquires(RCU) 55 55 { 56 56 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 57 57 __rt_spin_lock(lock); ··· 75 75 EXPORT_SYMBOL(rt_spin_lock_nest_lock); 76 76 #endif 77 77 78 - void __sched rt_spin_unlock(spinlock_t *lock) 78 + void __sched rt_spin_unlock(spinlock_t *lock) __releases(RCU) 79 79 { 80 80 spin_release(&lock->dep_map, _RET_IP_); 81 81 migrate_enable(); ··· 225 225 } 226 226 EXPORT_SYMBOL(rt_write_trylock); 227 227 228 - void __sched rt_read_lock(rwlock_t *rwlock) 228 + void __sched rt_read_lock(rwlock_t *rwlock) __acquires(RCU) 229 229 { 230 230 rtlock_might_resched(); 231 231 rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_); ··· 235 235 } 236 236 EXPORT_SYMBOL(rt_read_lock); 237 237 238 - void __sched rt_write_lock(rwlock_t *rwlock) 238 + void __sched rt_write_lock(rwlock_t *rwlock) __acquires(RCU) 239 239 { 240 240 rtlock_might_resched(); 241 241 rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); ··· 246 246 EXPORT_SYMBOL(rt_write_lock); 247 247 248 248 #ifdef CONFIG_DEBUG_LOCK_ALLOC 249 - void __sched rt_write_lock_nested(rwlock_t *rwlock, int subclass) 249 + void __sched rt_write_lock_nested(rwlock_t *rwlock, int subclass) __acquires(RCU) 250 250 { 251 251 rtlock_might_resched(); 252 252 rwlock_acquire(&rwlock->dep_map, subclass, 0, _RET_IP_); ··· 257 257 EXPORT_SYMBOL(rt_write_lock_nested); 258 258 #endif 259 259 260 - void __sched rt_read_unlock(rwlock_t *rwlock) 260 + void __sched rt_read_unlock(rwlock_t *rwlock) __releases(RCU) 261 261 { 262 262 rwlock_release(&rwlock->dep_map, _RET_IP_); 263 263 migrate_enable(); ··· 266 266 } 267 267 EXPORT_SYMBOL(rt_read_unlock); 268 268 269 - void __sched rt_write_unlock(rwlock_t *rwlock) 269 + void __sched rt_write_unlock(rwlock_t *rwlock) __releases(RCU) 270 270 { 271 271 rwlock_release(&rwlock->dep_map, _RET_IP_); 272 272 rcu_read_unlock();