From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Joerg Roedel <joerg.roedel@amd.com>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: bug in tty ldisc and friends
Date: Wed, 17 Jun 2009 16:10:18 +0200 [thread overview]
Message-ID: <20090617141018.GA6846@elte.hu> (raw)
In-Reply-To: <1245227523.13761.21661.camel@twins>
* Peter Zijlstra <a.p.zijlstra@chello.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().
> we really should do another round of SPIN_LOCK_UNLOCKED cleanups
> and finally remove that thing.
+1.
Ingo
next prev parent reply other threads:[~2009-06-17 14:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 5:45 bug in tty ldisc and friends Steven Rostedt
2009-06-16 8:37 ` Alan Cox
2009-06-16 8:50 ` Ingo Molnar
2009-06-16 8:57 ` Alan Cox
2009-06-16 9:09 ` Ingo Molnar
2009-06-16 10:00 ` Ingo Molnar
2009-06-16 10:04 ` Alan Cox
2009-06-16 10:12 ` Ingo Molnar
2009-06-16 10:25 ` Ingo Molnar
2009-06-16 10:29 ` Ingo Molnar
2009-06-16 10:34 ` Joerg Roedel
2009-06-16 10:45 ` Ingo Molnar
2009-06-16 10:36 ` Ingo Molnar
2009-06-16 11:39 ` Joerg Roedel
2009-06-16 12:11 ` Ingo Molnar
2009-06-16 15:24 ` Joerg Roedel
2009-06-17 8:32 ` Peter Zijlstra
2009-06-17 14:10 ` Ingo Molnar [this message]
2009-06-17 14:28 ` Joerg Roedel
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=20090617141018.GA6846@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.