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;
....@@ -39,7 +39,7 @@
3939 * Make sure we are not reinitializing a held lock:
4040 */
4141 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);
4343 #endif
4444 lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED;
4545 lock->magic = RWLOCK_MAGIC;
....@@ -111,6 +111,7 @@
111111 {
112112 debug_spin_lock_before(lock);
113113 arch_spin_lock(&lock->raw_lock);
114
+ mmiowb_spin_lock();
114115 debug_spin_lock_after(lock);
115116 }
116117
....@@ -118,8 +119,10 @@
118119 {
119120 int ret = arch_spin_trylock(&lock->raw_lock);
120121
121
- if (ret)
122
+ if (ret) {
123
+ mmiowb_spin_lock();
122124 debug_spin_lock_after(lock);
125
+ }
123126 #ifndef CONFIG_SMP
124127 /*
125128 * Must not happen on UP:
....@@ -131,6 +134,7 @@
131134
132135 void do_raw_spin_unlock(raw_spinlock_t *lock)
133136 {
137
+ mmiowb_spin_unlock();
134138 debug_spin_unlock(lock);
135139 arch_spin_unlock(&lock->raw_lock);
136140 }