.. | .. |
---|
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; |
---|
.. | .. |
---|
39 | 39 | * Make sure we are not reinitializing a held lock: |
---|
40 | 40 | */ |
---|
41 | 41 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
---|
42 | | - lockdep_init_map(&lock->dep_map, name, key, 0); |
---|
| 42 | + lockdep_init_map_wait(&lock->dep_map, name, key, 0, LD_WAIT_CONFIG); |
---|
43 | 43 | #endif |
---|
44 | 44 | lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED; |
---|
45 | 45 | lock->magic = RWLOCK_MAGIC; |
---|
.. | .. |
---|
111 | 111 | { |
---|
112 | 112 | debug_spin_lock_before(lock); |
---|
113 | 113 | arch_spin_lock(&lock->raw_lock); |
---|
| 114 | + mmiowb_spin_lock(); |
---|
114 | 115 | debug_spin_lock_after(lock); |
---|
115 | 116 | } |
---|
116 | 117 | |
---|
.. | .. |
---|
118 | 119 | { |
---|
119 | 120 | int ret = arch_spin_trylock(&lock->raw_lock); |
---|
120 | 121 | |
---|
121 | | - if (ret) |
---|
| 122 | + if (ret) { |
---|
| 123 | + mmiowb_spin_lock(); |
---|
122 | 124 | debug_spin_lock_after(lock); |
---|
| 125 | + } |
---|
123 | 126 | #ifndef CONFIG_SMP |
---|
124 | 127 | /* |
---|
125 | 128 | * Must not happen on UP: |
---|
.. | .. |
---|
131 | 134 | |
---|
132 | 135 | void do_raw_spin_unlock(raw_spinlock_t *lock) |
---|
133 | 136 | { |
---|
| 137 | + mmiowb_spin_unlock(); |
---|
134 | 138 | debug_spin_unlock(lock); |
---|
135 | 139 | arch_spin_unlock(&lock->raw_lock); |
---|
136 | 140 | } |
---|