mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lockdep debugging: give stacktrace for init_error
@ 2007-07-05 14:06 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2007-07-05 14:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Zijlstra, Arjan van de Ven, Ingo Molnar, Linux Kernel list

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>

---
 kernel/lockdep.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--- linux-2.6-git.orig/kernel/lockdep.c	2007-07-05 15:48:17.390241118 +0200
+++ linux-2.6-git/kernel/lockdep.c	2007-07-05 15:58:20.334168396 +0200
@@ -291,6 +291,11 @@ unsigned int max_recursion_depth;
  * about it later on, in lockdep_info().
  */
 static int lockdep_init_error;
+static unsigned long lockdep_init_trace_data[20];
+static struct stack_trace lockdep_init_trace = {
+	.max_entries = ARRAY_SIZE(lockdep_init_trace_data),
+	.entries = lockdep_init_trace_data,
+};
 
 /*
  * Various lockdep statistics:
@@ -1170,6 +1175,7 @@ look_up_lock_class(struct lockdep_map *l
 	if (unlikely(!lockdep_initialized)) {
 		lockdep_init();
 		lockdep_init_error = 1;
+		save_stack_trace(&lockdep_init_trace);
 	}
 #endif
 
@@ -2636,8 +2642,11 @@ void __init lockdep_info(void)
 		sizeof(struct held_lock) * MAX_LOCK_DEPTH);
 
 #ifdef CONFIG_DEBUG_LOCKDEP
-	if (lockdep_init_error)
-		printk("WARNING: lockdep init error! Arch code didnt call lockdep_init() early enough?\n");
+	if (lockdep_init_error) {
+		printk("WARNING: lockdep init error! Arch code didn't call lockdep_init() early enough?\n");
+		printk("Call stack leading to lockdep invocation was:\n");
+		print_stack_trace(&lockdep_init_trace, 0);
+	}
 #endif
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-06 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-05 14:06 [PATCH] lockdep debugging: give stacktrace for init_error Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®