lkml.org 
[lkml]   [2011]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] lockdep: print lock name for lockdep_init_error
On 17/11/11 16:34, tom.leiming@gmail.com wrote:

> From: Ming Lei <tom.leiming@gmail.com>
>
> This patch prints the name of the lock which is acquired
> before lockdep_init is called, so that user can easily find
> which lock trigged 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: Ming Lei <tom.leiming@gmail.com>
> ---
> kernel/lockdep.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index 4e7e672..8141317 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -430,6 +430,7 @@ unsigned int max_lockdep_depth;
> * about it later on, in lockdep_info().
> */
> static int lockdep_init_error;
> +static const char *lock_init_error;


You can now remove lockdep_init_error and just test against
lock_init_error below instead.

~Ryan

> static unsigned long lockdep_init_trace_data[20];
> static struct stack_trace lockdep_init_trace = {
> .max_entries = ARRAY_SIZE(lockdep_init_trace_data),
> @@ -651,6 +652,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
> if (unlikely(!lockdep_initialized)) {
> lockdep_init();
> lockdep_init_error = 1;
> + lock_init_error = lock->name;
> save_stack_trace(&lockdep_init_trace);
> }
> #endif
> @@ -3965,7 +3967,8 @@ void __init lockdep_info(void)
>
> #ifdef CONFIG_DEBUG_LOCKDEP
> 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");
> print_stack_trace(&lockdep_init_trace, 0);
> }




\
 
 \ /
  Last update: 2011-11-17 22:53    [W:0.074 / U:2.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site