[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090617142819.GR5139@amd.com>
Date: Wed, 17 Jun 2009 16:28:19 +0200
From: Joerg Roedel <joerg.roedel@....com>
To: Ingo Molnar <mingo@...e.hu>
CC: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Steven Rostedt <rostedt@...dmis.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: bug in tty ldisc and friends
On Wed, Jun 17, 2009 at 04:10:18PM +0200, Ingo Molnar wrote:
>
> * Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
>
> > On Tue, 2009-06-16 at 12:36 +0200, Ingo Molnar wrote:
> >
> > > +++ b/lib/dma-debug.c
> > > @@ -62,6 +62,8 @@ struct dma_debug_entry {
> > > #endif
> > > };
> > >
> > > +static struct lock_class_key hash_bucket_class;
> > > +
> > > struct hash_bucket {
> > > struct list_head list;
> > > spinlock_t lock;
> > > @@ -716,7 +718,8 @@ void dma_debug_init(u32 num_entries)
> > >
> > > for (i = 0; i < HASH_SIZE; ++i) {
> > > INIT_LIST_HEAD(&dma_entry_hash[i].list);
> > > - dma_entry_hash[i].lock = SPIN_LOCK_UNLOCKED;
> > > + spin_lock_init(&dma_entry_hash[i].lock);
> > > + lockdep_set_lock_class(&dma_entry_hash[i].lock, &hash_bucket_class);
> > > }
> > >
> > > if (dma_debug_fs_init() != 0) {
> >
> > I don't see what you need that lockdep_set_class() for, the
> > spin_lock_init() would already set a class specific to the
> > callsite. And since all these buckets are initialized from the
> > same place (ie, this loop), they'd all share the same class.
> >
> > Its just that the old style SPIN_LOCK_UNLOCKED doesn't set a class
> > and then reverts to the static address of the lock object itself
> > that these locks used to have different classes.
> >
> > So in short, yes the above patch should fix it, but it could be
> > done shorter..
>
> Indeed ... Joerg: mind removing the set_class complication and just
> switch it to spin_lock_init().
Ok, done.
>
> > we really should do another round of SPIN_LOCK_UNLOCKED cleanups
> > and finally remove that thing.
>
> +1.
A first step might be updating the documentation under
Documentation/spinlocks.txt to teach people the new right way of
initializing spinlocks :-)
Joerg
--
| Advanced Micro Devices GmbH
Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
System |
Research | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
| Registergericht München, HRB Nr. 43632
--
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