[tip:core/locking] lockdep: Print more info when MAX_LOCK_DEPTH is exceeded

From: tip-bot for Ben Greear
Date: Thu Feb 07 2013 - 07:13:12 EST


Commit-ID: 7a508076d4efdfd4fcb6fbd50a32d2c1a6e98791
Gitweb: http://git.kernel.org/tip/7a508076d4efdfd4fcb6fbd50a32d2c1a6e98791
Author: Ben Greear <greearb@xxxxxxxxxxxxxxx>
AuthorDate: Wed, 6 Feb 2013 10:56:19 -0800
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Thu, 7 Feb 2013 12:17:43 +0100

lockdep: Print more info when MAX_LOCK_DEPTH is exceeded

This helps debug cases where a lock is acquired over and
over without being released.

Suggested-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Cc: peterz@xxxxxxxxxxxxx
Link: http://lkml.kernel.org/r/1360176979-4421-1-git-send-email-greearb@xxxxxxxxxxxxxxx
[ Changed the printout ordering. ]
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
kernel/lockdep.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index c783e80..1966746 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -3192,9 +3192,14 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
#endif
if (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {
debug_locks_off();
- printk("BUG: MAX_LOCK_DEPTH too low!\n");
+ printk("BUG: MAX_LOCK_DEPTH too low, depth: %i max: %lu!\n",
+ curr->lockdep_depth, MAX_LOCK_DEPTH);
printk("turning off the locking correctness validator.\n");
+
+ lockdep_print_held_locks(current);
+ debug_show_all_locks();
dump_stack();
+
return 0;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/