Commit 81140acc authored by Ming Lei's avatar Ming Lei Committed by Ingo Molnar

lockdep: Print lock name in lockdep_init_error()

This patch prints the name of the lock which is acquired
before lockdep_init() is called, so that users can easily
find which lock triggered the lockdep init error warning.

This patch also removes the lockdep_init_error() message
of "Arch code didn't call lockdep_init() early enough?"
since lockdep_init() is called in arch independent code now.
Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1321508072-23853-2-git-send-email-tom.leiming@gmail.comSigned-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 73839c5b
...@@ -431,6 +431,7 @@ unsigned int max_lockdep_depth; ...@@ -431,6 +431,7 @@ unsigned int max_lockdep_depth;
* about it later on, in lockdep_info(). * about it later on, in lockdep_info().
*/ */
static int lockdep_init_error; static int lockdep_init_error;
static const char *lock_init_error;
static unsigned long lockdep_init_trace_data[20]; static unsigned long lockdep_init_trace_data[20];
static struct stack_trace lockdep_init_trace = { static struct stack_trace lockdep_init_trace = {
.max_entries = ARRAY_SIZE(lockdep_init_trace_data), .max_entries = ARRAY_SIZE(lockdep_init_trace_data),
...@@ -657,6 +658,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) ...@@ -657,6 +658,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
if (unlikely(!lockdep_initialized)) { if (unlikely(!lockdep_initialized)) {
lockdep_init(); lockdep_init();
lockdep_init_error = 1; lockdep_init_error = 1;
lock_init_error = lock->name;
save_stack_trace(&lockdep_init_trace); save_stack_trace(&lockdep_init_trace);
} }
#endif #endif
...@@ -3978,7 +3980,8 @@ void __init lockdep_info(void) ...@@ -3978,7 +3980,8 @@ void __init lockdep_info(void)
#ifdef CONFIG_DEBUG_LOCKDEP #ifdef CONFIG_DEBUG_LOCKDEP
if (lockdep_init_error) { if (lockdep_init_error) {
printk("WARNING: lockdep init error! Arch code didn't call lockdep_init() early enough?\n"); printk("WARNING: lockdep init error! lock-%s was acquired"
"before lockdep_init\n", lock_init_error);
printk("Call stack leading to lockdep invocation was:\n"); printk("Call stack leading to lockdep invocation was:\n");
print_stack_trace(&lockdep_init_trace, 0); print_stack_trace(&lockdep_init_trace, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment