Commit c71063c9 authored by Johannes Berg's avatar Johannes Berg Committed by Linus Torvalds

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: default avatarJohannes Berg <>
Cc: Ingo Molnar <>
Cc: Peter Zijlstra <>
Cc: Arjan van de Ven <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent d38e1d5a
......@@ -375,6 +375,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:
......@@ -662,6 +667,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
if (unlikely(!lockdep_initialized)) {
lockdep_init_error = 1;
......@@ -3040,8 +3046,11 @@ void __init lockdep_info(void)
sizeof(struct held_lock) * MAX_LOCK_DEPTH);
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);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment