[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090902185315.GU28804@bolzano.suse.de>
Date: Wed, 2 Sep 2009 20:53:16 +0200
From: Jan Blunck <jblunck@...e.de>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alan Stern <stern@...land.harvard.edu>,
Kay Sievers <kay.sievers@...e.de>, gregkh@...e.de,
kasievers@...e.de, USB list <linux-usb@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...e.hu>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Subject: Re: driver/base/dd.c lockdep warning
On Wed, Sep 02, Peter Zijlstra wrote:
>
> So the proposal I currently have to solve this is to allocate 48 lock
> classes:
>
> struct lock_class_key device_tree_depth[MAX_LOCK_DEPTH];
>
> and when creating a new device node, set the lock class corresponding
> the depth in the tree:
>
> mutex_lock_init(&device->lock);
> BUG_ON(device->depth >= MAX_LOCK_DEPTH); // surely we're not that deep
> lockdep_set_class(&device->lock, device_tree_depth + device->depth);
> ...
> mutex_lock(&device->lock); /* already have parent locked */
> device_attach(device, parent);
>
> and take multiple child locks using:
>
> mutex_lock_nest_lock(&device->lock, &device->parent->lock);
>
> Which, I think should work for most cases out there.
>
> Alan had some funny corner cases, but I think he wasn't sure whether
> those would indeed show up in reality.
JFYI, I tried to get away with just parent, child and normal class but
the problem is that device_add() is called recursive via driver probing
code. So either we change that (and iterate down the device tree) or we need
to implement what you proposed.
Cheers,
Jan
--
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