LKML Archive on
 help / color / Atom feed
From: Tetsuo Handa <>
To: Peter Zijlstra <>,
	Ingo Molnar <>, Will Deacon <>
Cc: Waiman Long <>,
	Boqun Feng <>,,
	Tetsuo Handa <>
Subject: [PATCH] lockdep: add a hint for "INFO: trying to register non-static key." message
Date: Sun, 21 Mar 2021 15:49:13 +0900
Message-ID: <> (raw)

Since this message is printed when dynamically allocated spinlocks (e.g.
kzalloc()) are used without initialization (e.g. spin_lock_init()),
suggest developers to check whether initialization functions for objects
are called, before making developers wonder what annotation is missing.

Signed-off-by: Tetsuo Handa <>
 kernel/locking/lockdep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index c6d0c1dc6253..44c549f5c061 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -931,6 +931,7 @@ static bool assign_lock_key(struct lockdep_map *lock)
 		pr_err("INFO: trying to register non-static key.\n");
 		pr_err("the code is fine but needs lockdep annotation.\n");
+		pr_err("maybe you didn't initialize this object before you use?\n");
 		pr_err("turning off the locking correctness validator.\n");
 		return false;

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21  6:49 Tetsuo Handa [this message]
2021-03-21 11:05 ` [tip: perf/urgent] lockdep: Add a missing initialization hint to the "INFO: Trying to register non-static key" message tip-bot2 for Tetsuo Handa
2021-03-22 17:19 ` [PATCH] lockdep: add a hint for "INFO: trying to register non-static key." message Waiman Long

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone