hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
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,6 +31,7 @@
3131
3232 EXPORT_SYMBOL(__raw_spin_lock_init);
3333
34
+#ifndef CONFIG_PREEMPT_RT
3435 void __rwlock_init(rwlock_t *lock, const char *name,
3536 struct lock_class_key *key)
3637 {
....@@ -39,7 +40,7 @@
3940 * Make sure we are not reinitializing a held lock:
4041 */
4142 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);
4344 #endif
4445 lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED;
4546 lock->magic = RWLOCK_MAGIC;
....@@ -48,6 +49,7 @@
4849 }
4950
5051 EXPORT_SYMBOL(__rwlock_init);
52
+#endif
5153
5254 static void spin_dump(raw_spinlock_t *lock, const char *msg)
5355 {
....@@ -111,6 +113,7 @@
111113 {
112114 debug_spin_lock_before(lock);
113115 arch_spin_lock(&lock->raw_lock);
116
+ mmiowb_spin_lock();
114117 debug_spin_lock_after(lock);
115118 }
116119
....@@ -118,8 +121,10 @@
118121 {
119122 int ret = arch_spin_trylock(&lock->raw_lock);
120123
121
- if (ret)
124
+ if (ret) {
125
+ mmiowb_spin_lock();
122126 debug_spin_lock_after(lock);
127
+ }
123128 #ifndef CONFIG_SMP
124129 /*
125130 * Must not happen on UP:
....@@ -131,10 +136,12 @@
131136
132137 void do_raw_spin_unlock(raw_spinlock_t *lock)
133138 {
139
+ mmiowb_spin_unlock();
134140 debug_spin_unlock(lock);
135141 arch_spin_unlock(&lock->raw_lock);
136142 }
137143
144
+#ifndef CONFIG_PREEMPT_RT
138145 static void rwlock_bug(rwlock_t *lock, const char *msg)
139146 {
140147 if (!debug_locks_off())
....@@ -224,3 +231,5 @@
224231 debug_write_unlock(lock);
225232 arch_write_unlock(&lock->raw_lock);
226233 }
234
+
235
+#endif