Re: bug in tty ldisc and friends

From: Joerg Roedel
Date: Tue Jun 16 2009 - 07:39:52 EST


On Tue, Jun 16, 2009 at 12:36:06PM +0200, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > This is something we noticed recently: dma-debug uses a lot of
> > lock classes and thus creates a really large lock-graph, depleting
> > the reserves quickly.
>
> yep, i think dma-debug is the culprit. It has:
>
> #define HASH_SIZE 1024ULL
>
> each hash entry has a separate lock.
>
> But this should be easily to solve: a special lock-class for these
> locks. Patch below (warning: utterly untested!).
>
> (Btw., that SPIN_LOCK_UNLOCKED init method should really be
> deprecated for real.)
>
> Ingo
>
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 3b93129..012c240 100644
> --- a/lib/dma-debug.c
> +++ 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) {

Ok, cool. I would apply it but I don't know enough about lockdep
internals to write a meaningful commit message. Can you please provide
one so I can commit this?

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/