diff options
| author | Thomas Graf <tgraf@suug.ch> | 2015-01-02 17:00:19 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-01-03 14:32:57 -0500 |
| commit | 113948d841e8d78039e5dbbb5248f5b73e99eafa (patch) | |
| tree | dd83aa9e9cc3d6cae386afa57dad4046df7e33bd | |
| parent | 897362e446436d245972e72c6bc5b33bd7a5c659 (diff) | |
spinlock: Add spin_lock_bh_nested()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/linux/spinlock.h | 8 | ||||
| -rw-r--r-- | include/linux/spinlock_api_smp.h | 2 | ||||
| -rw-r--r-- | include/linux/spinlock_api_up.h | 1 | ||||
| -rw-r--r-- | kernel/locking/spinlock.c | 8 |
4 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 262ba4ef9a8e..3e18379dfa6f 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -190,6 +190,8 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) | |||
| 190 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 190 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 191 | # define raw_spin_lock_nested(lock, subclass) \ | 191 | # define raw_spin_lock_nested(lock, subclass) \ |
| 192 | _raw_spin_lock_nested(lock, subclass) | 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 | # define raw_spin_lock_nest_lock(lock, nest_lock) \ | 196 | # define raw_spin_lock_nest_lock(lock, nest_lock) \ |
| 195 | do { \ | 197 | do { \ |
| @@ -205,6 +207,7 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock) | |||
| 205 | # define raw_spin_lock_nested(lock, subclass) \ | 207 | # define raw_spin_lock_nested(lock, subclass) \ |
| 206 | _raw_spin_lock(((void)(subclass), (lock))) | 208 | _raw_spin_lock(((void)(subclass), (lock))) |
| 207 | # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) | 209 | # define raw_spin_lock_nest_lock(lock, nest_lock) _raw_spin_lock(lock) |
| 210 | # define raw_spin_lock_bh_nested(lock, subclass) _raw_spin_lock_bh(lock) | ||
| 208 | #endif | 211 | #endif |
| 209 | 212 | ||
| 210 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 213 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| @@ -324,6 +327,11 @@ do { \ | |||
| 324 | raw_spin_lock_nested(spinlock_check(lock), subclass); \ | 327 | raw_spin_lock_nested(spinlock_check(lock), subclass); \ |
| 325 | } while (0) | 328 | } while (0) |
| 326 | 329 | ||
| 330 | #define spin_lock_bh_nested(lock, subclass) \ | ||
| 331 | do { \ | ||
| 332 | raw_spin_lock_bh_nested(spinlock_check(lock), subclass);\ | ||
| 333 | } while (0) | ||
| 334 | |||
| 327 | #define spin_lock_nest_lock(lock, nest_lock) \ | 335 | #define spin_lock_nest_lock(lock, nest_lock) \ |
| 328 | do { \ | 336 | do { \ |
| 329 | raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \ | 337 | raw_spin_lock_nest_lock(spinlock_check(lock), nest_lock); \ |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 42dfab89e740..5344268e6e62 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
| @@ -22,6 +22,8 @@ int in_lock_functions(unsigned long addr); | |||
| 22 | void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); | 22 | void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); |
| 23 | void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) | 23 | void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) |
| 24 | __acquires(lock); | 24 | __acquires(lock); |
| 25 | void __lockfunc _raw_spin_lock_bh_nested(raw_spinlock_t *lock, int subclass) | ||
| 26 | __acquires(lock); | ||
| 25 | void __lockfunc | 27 | void __lockfunc |
| 26 | _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) | 28 | _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) |
| 27 | __acquires(lock); | 29 | __acquires(lock); |
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h index d0d188861ad6..d3afef9d8dbe 100644 --- a/include/linux/spinlock_api_up.h +++ b/include/linux/spinlock_api_up.h | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | 57 | ||
| 58 | #define _raw_spin_lock(lock) __LOCK(lock) | 58 | #define _raw_spin_lock(lock) __LOCK(lock) |
| 59 | #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) | 59 | #define _raw_spin_lock_nested(lock, subclass) __LOCK(lock) |
| 60 | #define _raw_spin_lock_bh_nested(lock, subclass) __LOCK(lock) | ||
| 60 | #define _raw_read_lock(lock) __LOCK(lock) | 61 | #define _raw_read_lock(lock) __LOCK(lock) |
| 61 | #define _raw_write_lock(lock) __LOCK(lock) | 62 | #define _raw_write_lock(lock) __LOCK(lock) |
| 62 | #define _raw_spin_lock_bh(lock) __LOCK_BH(lock) | 63 | #define _raw_spin_lock_bh(lock) __LOCK_BH(lock) |
diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c index 4b082b5cac9e..db3ccb1dd614 100644 --- a/kernel/locking/spinlock.c +++ b/kernel/locking/spinlock.c | |||
| @@ -363,6 +363,14 @@ void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) | |||
| 363 | } | 363 | } |
| 364 | EXPORT_SYMBOL(_raw_spin_lock_nested); | 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 | unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, | 374 | unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, |
| 367 | int subclass) | 375 | int subclass) |
| 368 | { | 376 | { |
