mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Yong Zhang <yong.zhang0@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>,
	David Rientjes <rientjes@google.com>, Tejun Heo <tj@kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: WARNING: at kernel/lockdep.c:690 __lock_acquire+0x168/0x164b()
Date: Mon, 7 Nov 2011 11:43:16 +0300	[thread overview]
Message-ID: <20111107084316.GA3106@swordfish.waw.cen> (raw)
In-Reply-To: <20111107045456.GB3893@zhy>

On (11/07/11 12:54), Yong Zhang wrote:
> > > > Understood. If someone can come up with a simple patch which could
> > > > cover the case I mentioned before, that would be great.
> > > > /me goes to poke at it.
> > > 
> > > I dunno whether this is related but I get the following on 3.1:
> > >
> > 
> > I think this is different problem. Failed check that lockdep key is marked as `static'.
> 
> Actually the lockdep_init_map() in __lock_set_class could lead to
> more problem, such as: certain rq->lock could have different 'key'
> with what we give them in sched_init() because rq is defined staticly.
> 
> Given that, we could have another typical race:
> 
>           CPU A                                   CPU B
>     lock_set_subclass(lockA);
>       lock_set_class(lockA);
>                                             /* lockA->class_cache[] is not set */
>                                             register_lock_class(lockA);
>                                               look_up_lock_class(lockA); /* retrun NULL */
>         lockdep_init_map(lockA);
>           /* lockA->name is cleared */
>           memset(lockA);
>    						if (!static_obj(lock->key))
> 						  /* we get warning here */
>           lock->name = name;
>     
> 
> So memset() in lockdep_init_map() is still the culprit IMHO.
>

Hm, agreed, that still could be the reason.
I guess a little more information may be helpful in some cases.

---
Print key address when attempt to register non-static lock key detected.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

---

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index e69434b..de8a996 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -729,7 +729,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
  	 */
 	if (!static_obj(lock->key)) {
 		debug_locks_off();
-		printk("INFO: trying to register non-static key.\n");
+		printk("INFO: trying to register non-static key at address %p.\n", lock->key);
 		printk("the code is fine but needs lockdep annotation.\n");
 		printk("turning off the locking correctness validator.\n");
 		dump_stack();


  reply	other threads:[~2011-11-07  8:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-15 20:12 Sergey Senozhatsky
2011-10-15 21:42 ` David Rientjes
2011-10-15 22:23   ` Borislav Petkov
2011-10-15 22:32     ` David Rientjes
2011-10-16  5:09       ` Sergey Senozhatsky
2011-10-20 18:39       ` Borislav Petkov
2011-10-20 18:53         ` Sergey Senozhatsky
2011-10-20 19:07           ` Sergey Senozhatsky
2011-10-20 21:17             ` David Rientjes
2011-10-20 21:23               ` Tejun Heo
2011-10-20 21:31                 ` David Rientjes
2011-10-20 21:36                   ` Tejun Heo
2011-10-20 23:00                     ` Sergey Senozhatsky
2011-10-21  9:14                       ` David Rientjes
2011-10-21  9:26                         ` Sergey Senozhatsky
2011-10-21  9:45                         ` Yong Zhang
2011-11-03  7:17                           ` Sergey Senozhatsky
2011-11-03  7:27                             ` Yong Zhang
2011-11-03  7:45                               ` Sergey Senozhatsky
2011-11-03  7:53                                 ` Yong Zhang
2011-11-04  9:25                                   ` Borislav Petkov
2011-11-04  9:31                                     ` Sergey Senozhatsky
2011-11-07  4:54                                       ` Yong Zhang
2011-11-07  8:43                                         ` Sergey Senozhatsky [this message]
2011-11-04  9:34                                     ` Yong Zhang
2011-11-04  9:51                                       ` Sergey Senozhatsky

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=20111107084316.GA3106@swordfish.waw.cen \
    --to=sergey.senozhatsky@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    --cc=yong.zhang0@gmail.com \
    /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

Powered by JetHome