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

spinlock: Add spin_lock_bh_nested()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Thomas Graf and committed by
David S. Miller
113948d8 897362e4

+19
+8
include/linux/spinlock.h
··· 190 190 #ifdef CONFIG_DEBUG_LOCK_ALLOC 191 191 # define raw_spin_lock_nested(lock, subclass) \ 192 192 _raw_spin_lock_nested(lock, subclass) 193 + # define raw_spin_lock_bh_nested(lock, subclass) \ 194 + _raw_spin_lock_bh_nested(lock, subclass) 193 195 194 196 # define raw_spin_lock_nest_lock(lock, nest_lock) \ 195 197 do { \ ··· 207 205 # define raw_spin_lock_nested(lock, subclass) \ 208 206 _raw_spin_lock(((void)(subclass), (lock))) 209 207 # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) 208 + # define raw_spin_lock_bh_nested(lock, subclass) _raw_spin_lock_bh(lock) 210 209 #endif 211 210 212 211 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) ··· 325 322 #define spin_lock_nested(lock, subclass) \ 326 323 do { \ 327 324 raw_spin_lock_nested(spinlock_check(lock), subclass); \ 325 + } while (0) 326 + 327 + #define spin_lock_bh_nested(lock, subclass) \ 328 + do { \ 329 + raw_spin_lock_bh_nested(spinlock_check(lock), subclass);\ 328 330 } while (0) 329 331 330 332 #define spin_lock_nest_lock(lock, nest_lock) \
+2
include/linux/spinlock_api_smp.h
··· 22 22 void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); 23 23 void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) 24 24 __acquires(lock); 25 + void __lockfunc _raw_spin_lock_bh_nested(raw_spinlock_t *lock, int subclass) 26 + __acquires(lock); 25 27 void __lockfunc 26 28 _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) 27 29 __acquires(lock);
+1
include/linux/spinlock_api_up.h
··· 57 57 58 58 #define _raw_spin_lock(lock) __LOCK(lock) 59 59 #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) 60 + #define _raw_spin_lock_bh_nested(lock, subclass) __LOCK(lock) 60 61 #define _raw_read_lock(lock) __LOCK(lock) 61 62 #define _raw_write_lock(lock) __LOCK(lock) 62 63 #define _raw_spin_lock_bh(lock) __LOCK_BH(lock)
+8
kernel/locking/spinlock.c
··· 363 363 } 364 364 EXPORT_SYMBOL(_raw_spin_lock_nested); 365 365 366 + void __lockfunc _raw_spin_lock_bh_nested(raw_spinlock_t *lock, int subclass) 367 + { 368 + __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); 369 + spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); 370 + LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); 371 + } 372 + EXPORT_SYMBOL(_raw_spin_lock_bh_nested); 373 + 366 374 unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, 367 375 int subclass) 368 376 {