| .. | .. |
|---|
| 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 |
|---|
| 34 | 35 | void __rwlock_init(rwlock_t *lock, const char *name, |
|---|
| 35 | 36 | struct lock_class_key *key) |
|---|
| 36 | 37 | { |
|---|
| .. | .. |
|---|
| 39 | 40 | * Make sure we are not reinitializing a held lock: |
|---|
| 40 | 41 | */ |
|---|
| 41 | 42 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
|---|
| 42 | | - lockdep_init_map(&lock->dep_map, name, key, 0); |
|---|
| 43 | + lockdep_init_map_wait(&lock->dep_map, name, key, 0, LD_WAIT_CONFIG); |
|---|
| 43 | 44 | #endif |
|---|
| 44 | 45 | lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED; |
|---|
| 45 | 46 | lock->magic = RWLOCK_MAGIC; |
|---|
| .. | .. |
|---|
| 48 | 49 | } |
|---|
| 49 | 50 | |
|---|
| 50 | 51 | EXPORT_SYMBOL(__rwlock_init); |
|---|
| 52 | +#endif |
|---|
| 51 | 53 | |
|---|
| 52 | 54 | static void spin_dump(raw_spinlock_t *lock, const char *msg) |
|---|
| 53 | 55 | { |
|---|
| .. | .. |
|---|
| 111 | 113 | { |
|---|
| 112 | 114 | debug_spin_lock_before(lock); |
|---|
| 113 | 115 | arch_spin_lock(&lock->raw_lock); |
|---|
| 116 | + mmiowb_spin_lock(); |
|---|
| 114 | 117 | debug_spin_lock_after(lock); |
|---|
| 115 | 118 | } |
|---|
| 116 | 119 | |
|---|
| .. | .. |
|---|
| 118 | 121 | { |
|---|
| 119 | 122 | int ret = arch_spin_trylock(&lock->raw_lock); |
|---|
| 120 | 123 | |
|---|
| 121 | | - if (ret) |
|---|
| 124 | + if (ret) { |
|---|
| 125 | + mmiowb_spin_lock(); |
|---|
| 122 | 126 | debug_spin_lock_after(lock); |
|---|
| 127 | + } |
|---|
| 123 | 128 | #ifndef CONFIG_SMP |
|---|
| 124 | 129 | /* |
|---|
| 125 | 130 | * Must not happen on UP: |
|---|
| .. | .. |
|---|
| 131 | 136 | |
|---|
| 132 | 137 | void do_raw_spin_unlock(raw_spinlock_t *lock) |
|---|
| 133 | 138 | { |
|---|
| 139 | + mmiowb_spin_unlock(); |
|---|
| 134 | 140 | debug_spin_unlock(lock); |
|---|
| 135 | 141 | arch_spin_unlock(&lock->raw_lock); |
|---|
| 136 | 142 | } |
|---|
| 137 | 143 | |
|---|
| 144 | +#ifndef CONFIG_PREEMPT_RT |
|---|
| 138 | 145 | static void rwlock_bug(rwlock_t *lock, const char *msg) |
|---|
| 139 | 146 | { |
|---|
| 140 | 147 | if (!debug_locks_off()) |
|---|
| .. | .. |
|---|
| 224 | 231 | debug_write_unlock(lock); |
|---|
| 225 | 232 | arch_write_unlock(&lock->raw_lock); |
|---|
| 226 | 233 | } |
|---|
| 234 | + |
|---|
| 235 | +#endif |
|---|