diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spinlock_debug.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 3d9c4dc965ed..58c577dd82e5 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) | |||
162 | 162 | ||
163 | #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) | 163 | #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) |
164 | 164 | ||
165 | #if 0 /* __write_lock_debug() can lock up - maybe this can too? */ | ||
165 | static void __read_lock_debug(rwlock_t *lock) | 166 | static void __read_lock_debug(rwlock_t *lock) |
166 | { | 167 | { |
167 | int print_once = 1; | 168 | int print_once = 1; |
@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock) | |||
184 | } | 185 | } |
185 | } | 186 | } |
186 | } | 187 | } |
188 | #endif | ||
187 | 189 | ||
188 | void _raw_read_lock(rwlock_t *lock) | 190 | void _raw_read_lock(rwlock_t *lock) |
189 | { | 191 | { |
190 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | 192 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); |
191 | if (unlikely(!__raw_read_trylock(&lock->raw_lock))) | 193 | __raw_read_lock(&lock->raw_lock); |
192 | __read_lock_debug(lock); | ||
193 | } | 194 | } |
194 | 195 | ||
195 | int _raw_read_trylock(rwlock_t *lock) | 196 | int _raw_read_trylock(rwlock_t *lock) |
@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock) | |||
235 | lock->owner_cpu = -1; | 236 | lock->owner_cpu = -1; |
236 | } | 237 | } |
237 | 238 | ||
239 | #if 0 /* This can cause lockups */ | ||
238 | static void __write_lock_debug(rwlock_t *lock) | 240 | static void __write_lock_debug(rwlock_t *lock) |
239 | { | 241 | { |
240 | int print_once = 1; | 242 | int print_once = 1; |
@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock) | |||
257 | } | 259 | } |
258 | } | 260 | } |
259 | } | 261 | } |
262 | #endif | ||
260 | 263 | ||
261 | void _raw_write_lock(rwlock_t *lock) | 264 | void _raw_write_lock(rwlock_t *lock) |
262 | { | 265 | { |
263 | debug_write_lock_before(lock); | 266 | debug_write_lock_before(lock); |
264 | if (unlikely(!__raw_write_trylock(&lock->raw_lock))) | 267 | __raw_write_lock(&lock->raw_lock); |
265 | __write_lock_debug(lock); | ||
266 | debug_write_lock_after(lock); | 268 | debug_write_lock_after(lock); |
267 | } | 269 | } |
268 | 270 | ||