From: tom.leiming@gmail.com
To: mingo@elte.hu, a.p.zijlstra@chello.nl
Cc: linux-kernel@vger.kernel.org, Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH 2/2] lockdep: print lock name for lockdep_init_error
Date: Thu, 17 Nov 2011 13:34:32 +0800 [thread overview]
Message-ID: <1321508072-23853-2-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1321508072-23853-1-git-send-email-tom.leiming@gmail.com>
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;
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);
}
--
1.7.5.4
next prev parent reply other threads:[~2011-11-17 5:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 5:34 [PATCH 1/2] init/main.c: execute lockdep_init as early as possible tom.leiming
2011-11-17 5:34 ` tom.leiming [this message]
2011-11-17 6:02 ` [PATCH 2/2] lockdep: print lock name for lockdep_init_error Yong Zhang
2011-11-17 8:01 ` Ming Lei
2011-11-17 8:44 ` Yong Zhang
2011-11-17 9:01 ` Peter Zijlstra
2011-11-17 21:50 ` Ryan Mallon
2011-12-06 9:41 ` [tip:core/locking] lockdep: Print lock name in lockdep_init_error() tip-bot for Ming Lei
2011-11-17 5:59 ` [PATCH 1/2] init/main.c: execute lockdep_init as early as possible Yong Zhang
2011-12-06 9:40 ` [tip:core/locking] init/main.c: Execute lockdep_init() " tip-bot for Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321508072-23853-2-git-send-email-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).