| .. | .. |
|---|
| 14 | 14 | #include <linux/export.h> |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, |
|---|
| 17 | | - struct lock_class_key *key) |
|---|
| 17 | + struct lock_class_key *key, short inner) |
|---|
| 18 | 18 | { |
|---|
| 19 | 19 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
|---|
| 20 | 20 | /* |
|---|
| 21 | 21 | * Make sure we are not reinitializing a held lock: |
|---|
| 22 | 22 | */ |
|---|
| 23 | 23 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
|---|
| 24 | | - lockdep_init_map(&lock->dep_map, name, key, 0); |
|---|
| 24 | + lockdep_init_map_wait(&lock->dep_map, name, key, 0, inner); |
|---|
| 25 | 25 | #endif |
|---|
| 26 | 26 | lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; |
|---|
| 27 | 27 | lock->magic = SPINLOCK_MAGIC; |
|---|
| .. | .. |
|---|
| 31 | 31 | |
|---|
| 32 | 32 | EXPORT_SYMBOL(__raw_spin_lock_init); |
|---|
| 33 | 33 | |
|---|
| 34 | | -#ifndef CONFIG_PREEMPT_RT_FULL |
|---|
| 35 | 34 | void __rwlock_init(rwlock_t *lock, const char *name, |
|---|
| 36 | 35 | struct lock_class_key *key) |
|---|
| 37 | 36 | { |
|---|
| .. | .. |
|---|
| 40 | 39 | * Make sure we are not reinitializing a held lock: |
|---|
| 41 | 40 | */ |
|---|
| 42 | 41 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
|---|
| 43 | | - lockdep_init_map(&lock->dep_map, name, key, 0); |
|---|
| 42 | + lockdep_init_map_wait(&lock->dep_map, name, key, 0, LD_WAIT_CONFIG); |
|---|
| 44 | 43 | #endif |
|---|
| 45 | 44 | lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED; |
|---|
| 46 | 45 | lock->magic = RWLOCK_MAGIC; |
|---|
| .. | .. |
|---|
| 49 | 48 | } |
|---|
| 50 | 49 | |
|---|
| 51 | 50 | EXPORT_SYMBOL(__rwlock_init); |
|---|
| 52 | | -#endif |
|---|
| 53 | 51 | |
|---|
| 54 | 52 | static void spin_dump(raw_spinlock_t *lock, const char *msg) |
|---|
| 55 | 53 | { |
|---|
| .. | .. |
|---|
| 113 | 111 | { |
|---|
| 114 | 112 | debug_spin_lock_before(lock); |
|---|
| 115 | 113 | arch_spin_lock(&lock->raw_lock); |
|---|
| 114 | + mmiowb_spin_lock(); |
|---|
| 116 | 115 | debug_spin_lock_after(lock); |
|---|
| 117 | 116 | } |
|---|
| 118 | 117 | |
|---|
| .. | .. |
|---|
| 120 | 119 | { |
|---|
| 121 | 120 | int ret = arch_spin_trylock(&lock->raw_lock); |
|---|
| 122 | 121 | |
|---|
| 123 | | - if (ret) |
|---|
| 122 | + if (ret) { |
|---|
| 123 | + mmiowb_spin_lock(); |
|---|
| 124 | 124 | debug_spin_lock_after(lock); |
|---|
| 125 | + } |
|---|
| 125 | 126 | #ifndef CONFIG_SMP |
|---|
| 126 | 127 | /* |
|---|
| 127 | 128 | * Must not happen on UP: |
|---|
| .. | .. |
|---|
| 133 | 134 | |
|---|
| 134 | 135 | void do_raw_spin_unlock(raw_spinlock_t *lock) |
|---|
| 135 | 136 | { |
|---|
| 137 | + mmiowb_spin_unlock(); |
|---|
| 136 | 138 | debug_spin_unlock(lock); |
|---|
| 137 | 139 | arch_spin_unlock(&lock->raw_lock); |
|---|
| 138 | 140 | } |
|---|
| 139 | 141 | |
|---|
| 140 | | -#ifndef CONFIG_PREEMPT_RT_FULL |
|---|
| 141 | 142 | static void rwlock_bug(rwlock_t *lock, const char *msg) |
|---|
| 142 | 143 | { |
|---|
| 143 | 144 | if (!debug_locks_off()) |
|---|
| .. | .. |
|---|
| 227 | 228 | debug_write_unlock(lock); |
|---|
| 228 | 229 | arch_write_unlock(&lock->raw_lock); |
|---|
| 229 | 230 | } |
|---|
| 230 | | - |
|---|
| 231 | | -#endif |
|---|