[PATCH] powerpc: add for_each_node_by_foo helpers
Benjamin Herrenschmidt
benh at kernel.crashing.org
Mon Mar 13 10:29:52 EST 2006
On Sun, 2006-03-12 at 16:18 -0600, Nathan Lynch wrote:
> Benjamin Herrenschmidt wrote:
> > On Wed, 2006-03-08 at 16:47 +0100, Christoph Hellwig wrote:
> > > Typical use for of_find_node_by_name and of_find_node_by_type is to
> > > iterate over all nodes of a given type/name. Add a helper macro to
> > > do that (in spirit of the list_for_each* macros).
> >
> > Looks good. Maybe you have noted however that we aren't entirely safe
> > yet vs. device-tree being dynamic however. There is a per-node lock, but
> > no lock protecting the global node chain, which as usual means iterating
> > the list isn't entirely safe vs. removal...
>
> Eh? There isn't any per-node lock, and the global chain is protected
> by a rwlock (devtree_lock).
I recently showed a variety of scenarios that would blow up in funny
ways.. It's not enough. It would only work if the global chain lock was
taken by callers before iterating.
Ben.
More information about the Linuxppc64-dev
mailing list