[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1110201425560.5552@chino.kir.corp.google.com>
Date: Thu, 20 Oct 2011 14:31:39 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Tejun Heo <tj@...nel.org>
cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Ingo Molnar <mingo@...e.hu>, Borislav Petkov <bp@...en8.de>,
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 Thu, 20 Oct 2011, Tejun Heo wrote:
> > Tejun, would you like to revert f59de8992aa6 ("lockdep: Clear whole
> > lockdep_map on initialization") since it fixes this lockdep warning?
>
> Hmmm... the issue was that kmemcheck noticed that memory regions in
> lockdep_map are accessed before being set to any value. I'm feeling
> dim as usual and don't understand what's going on here. The function
> looks like the following.
>
>
> void lockdep_init_map(struct lockdep_map *lock, const char *name,
> struct lock_class_key *key, int subclass)
> {
> memset(lock, 0, sizeof(*lock));
>
> #ifdef CONFIG_LOCK_STAT
> lock->cpu = raw_smp_processor_id();
> #endif
> if (DEBUG_LOCKS_WARN_ON(!name)) {
> lock->name = "NULL";
> return;
> }
>
> lock->name = name;
>
>
> So, according to this thread, the problem is that the memset() clears
> lock->name field, right?
Right, and reverting f59de8992aa6 ("lockdep: Clear whole lockdep_map on
initialization") seems to fix the lockdep warning.
> But how can that be a problem? lock->name
> is always set to either "NULL" or @name. Why would clearing it before
> setting make any difference? What am I missing?
>
The scheduler (in sched_fair and sched_rt) calls lock_set_subclass() which
sets the name in double_unlock_balance() to set the name but there's a
race between when that is cleared with the memset() and setting of
lock->name where lockdep can find them to match.
--
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