aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-07-19 04:49:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:49 -0400
commitc71063c9c9dc232d0d51f936f237f7dc5681e8e3 (patch)
tree3f56b9e12c86b2afe9e613e868001654240aabb7 /kernel/lockdep.c
parentd38e1d5aaee384698fcef9455d6e2df1d062a1d0 (diff)
lockdep debugging: give stacktrace for init_error
When I started adding support for lockdep to 64-bit powerpc, I got a lockdep_init_error and with this patch was able to pinpoint why and where to put lockdep_init(). Let's support this generally for others adding lockdep support to their architecture. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 156fce4960c3..734da579ad13 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -375,6 +375,11 @@ unsigned int max_recursion_depth;
375 * about it later on, in lockdep_info(). 375 * about it later on, in lockdep_info().
376 */ 376 */
377static int lockdep_init_error; 377static int lockdep_init_error;
378static unsigned long lockdep_init_trace_data[20];
379static struct stack_trace lockdep_init_trace = {
380 .max_entries = ARRAY_SIZE(lockdep_init_trace_data),
381 .entries = lockdep_init_trace_data,
382};
378 383
379/* 384/*
380 * Various lockdep statistics: 385 * Various lockdep statistics:
@@ -662,6 +667,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
662 if (unlikely(!lockdep_initialized)) { 667 if (unlikely(!lockdep_initialized)) {
663 lockdep_init(); 668 lockdep_init();
664 lockdep_init_error = 1; 669 lockdep_init_error = 1;
670 save_stack_trace(&lockdep_init_trace);
665 } 671 }
666#endif 672#endif
667 673
@@ -3040,8 +3046,11 @@ void __init lockdep_info(void)
3040 sizeof(struct held_lock) * MAX_LOCK_DEPTH); 3046 sizeof(struct held_lock) * MAX_LOCK_DEPTH);
3041 3047
3042#ifdef CONFIG_DEBUG_LOCKDEP 3048#ifdef CONFIG_DEBUG_LOCKDEP
3043 if (lockdep_init_error) 3049 if (lockdep_init_error) {
3044 printk("WARNING: lockdep init error! Arch code didnt call lockdep_init() early enough?\n"); 3050 printk("WARNING: lockdep init error! Arch code didn't call lockdep_init() early enough?\n");
3051 printk("Call stack leading to lockdep invocation was:\n");
3052 print_stack_trace(&lockdep_init_trace, 0);
3053 }
3045#endif 3054#endif
3046} 3055}
3047 3056