[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111107084316.GA3106@swordfish.waw.cen>
Date: Mon, 7 Nov 2011 11:43:16 +0300
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: Yong Zhang <yong.zhang0@...il.com>
Cc: Borislav Petkov <bp@...en8.de>,
David Rientjes <rientjes@...gle.com>,
Tejun Heo <tj@...nel.org>, Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: WARNING: at kernel/lockdep.c:690 __lock_acquire+0x168/0x164b()
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@...il.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();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists