Commit 72f0b4e2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] disable debugging version of write_lock()

We've confirmed that the debug version of write_lock() can get stuck for long
enough to cause NMI watchdog timeouts and hence a crash.

We don't know why, yet.   Disable it for now.

Also disable the similar read_lock() code.  Just in case.

Thanks to Dave Olson <olson@unixfolk.com> for reporting and testing.
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 927cbe8a
...@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) ...@@ -162,6 +162,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
#define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg) #define RWLOCK_BUG_ON(cond, lock, msg) if (unlikely(cond)) rwlock_bug(lock, msg)
#if 0 /* __write_lock_debug() can lock up - maybe this can too? */
static void __read_lock_debug(rwlock_t *lock) static void __read_lock_debug(rwlock_t *lock)
{ {
int print_once = 1; int print_once = 1;
...@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock) ...@@ -184,12 +185,12 @@ static void __read_lock_debug(rwlock_t *lock)
} }
} }
} }
#endif
void _raw_read_lock(rwlock_t *lock) void _raw_read_lock(rwlock_t *lock)
{ {
RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic");
if (unlikely(!__raw_read_trylock(&lock->raw_lock))) __raw_read_lock(&lock->raw_lock);
__read_lock_debug(lock);
} }
int _raw_read_trylock(rwlock_t *lock) int _raw_read_trylock(rwlock_t *lock)
...@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock) ...@@ -235,6 +236,7 @@ static inline void debug_write_unlock(rwlock_t *lock)
lock->owner_cpu = -1; lock->owner_cpu = -1;
} }
#if 0 /* This can cause lockups */
static void __write_lock_debug(rwlock_t *lock) static void __write_lock_debug(rwlock_t *lock)
{ {
int print_once = 1; int print_once = 1;
...@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock) ...@@ -257,12 +259,12 @@ static void __write_lock_debug(rwlock_t *lock)
} }
} }
} }
#endif
void _raw_write_lock(rwlock_t *lock) void _raw_write_lock(rwlock_t *lock)
{ {
debug_write_lock_before(lock); debug_write_lock_before(lock);
if (unlikely(!__raw_write_trylock(&lock->raw_lock))) __raw_write_lock(&lock->raw_lock);
__write_lock_debug(lock);
debug_write_lock_after(lock); debug_write_lock_after(lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment