Skip to content

Commit 2ee91f1

Browse files
Ingo MolnarLinus Torvalds
authored andcommitted
[PATCH] lockdep: show more details about self-test failures
Make the locking self-test failures (of 'FAILURE' type) easier to debug by printing more information. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 50cc670 commit 2ee91f1

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎include/linux/debug_locks.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern int debug_locks_off(void);
2424
int __ret = 0; \
2525
\
2626
if (unlikely(c)) { \
27-
if (debug_locks_off()) \
27+
if (debug_locks_silent || debug_locks_off()) \
2828
WARN_ON(1); \
2929
__ret = 1; \
3030
} \

‎kernel/mutex-debug.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
7777

7878
void debug_mutex_unlock(struct mutex *lock)
7979
{
80+
if (unlikely(!debug_locks))
81+
return;
82+
8083
DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
8184
DEBUG_LOCKS_WARN_ON(lock->magic != lock);
8285
DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);

‎lib/locking-selftest.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,9 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
963963
printk("failed|");
964964
} else {
965965
unexpected_testcase_failures++;
966+
966967
printk("FAILED|");
968+
dump_stack();
967969
}
968970
} else {
969971
testcase_successes++;

0 commit comments

Comments
 (0)