hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/kernel/locking/spinlock_debug.c
....@@ -14,14 +14,14 @@
1414 #include <linux/export.h>
1515
1616 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)
1818 {
1919 #ifdef CONFIG_DEBUG_LOCK_ALLOC
2020 /*
2121 * Make sure we are not reinitializing a held lock:
2222 */
2323 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);
2525 #endif
2626 lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
2727 lock->magic = SPINLOCK_MAGIC;
....@@ -31,7 +31,6 @@
3131
3232 EXPORT_SYMBOL(__raw_spin_lock_init);
3333
34
-#ifndef CONFIG_PREEMPT_RT_FULL
3534 void __rwlock_init(rwlock_t *lock, const char *name,
3635 struct lock_class_key *key)
3736 {
....@@ -40,7 +39,7 @@
4039 * Make sure we are not reinitializing a held lock:
4140 */
4241 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);
4443 #endif
4544 lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED;
4645 lock->magic = RWLOCK_MAGIC;
....@@ -49,7 +48,6 @@
4948 }
5049
5150 EXPORT_SYMBOL(__rwlock_init);
52
-#endif
5351
5452 static void spin_dump(raw_spinlock_t *lock, const char *msg)
5553 {
....@@ -113,6 +111,7 @@
113111 {
114112 debug_spin_lock_before(lock);
115113 arch_spin_lock(&lock->raw_lock);
114
+ mmiowb_spin_lock();
116115 debug_spin_lock_after(lock);
117116 }
118117
....@@ -120,8 +119,10 @@
120119 {
121120 int ret = arch_spin_trylock(&lock->raw_lock);
122121
123
- if (ret)
122
+ if (ret) {
123
+ mmiowb_spin_lock();
124124 debug_spin_lock_after(lock);
125
+ }
125126 #ifndef CONFIG_SMP
126127 /*
127128 * Must not happen on UP:
....@@ -133,11 +134,11 @@
133134
134135 void do_raw_spin_unlock(raw_spinlock_t *lock)
135136 {
137
+ mmiowb_spin_unlock();
136138 debug_spin_unlock(lock);
137139 arch_spin_unlock(&lock->raw_lock);
138140 }
139141
140
-#ifndef CONFIG_PREEMPT_RT_FULL
141142 static void rwlock_bug(rwlock_t *lock, const char *msg)
142143 {
143144 if (!debug_locks_off())
....@@ -227,5 +228,3 @@
227228 debug_write_unlock(lock);
228229 arch_write_unlock(&lock->raw_lock);
229230 }
230
-
231
-#endif