lkml.org 
[lkml]   [2005]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Add pci_walk_bus function to PCI core (nonrecursive)
From
Date
On Wed, 2005-08-17 at 22:13 -0700, Greg KH wrote:
> On Thu, Aug 18, 2005 at 02:58:28PM +1000, Benjamin Herrenschmidt wrote:
> > I wonder if it's finally time to implement proper race free list
> > iterators in the kernel. Not that difficult... A small struct iterator
> > with a list head and the current elem pointer, and the "interated" list
> > containing the list itself, a list of iterators and a lock. Iterators
> > can then be "fixed" up on element removal with a fine grained lock on
> > list structure access.
>
> Pat tried to do that with klist, but people seem to think it's still
> racy in some corner cases. Have you looked at them?

Not specifically... I used that type of construct in a distant past and
I'm pretty sure my stuff back them was quite solid but it's all old
memories. You have to be careful about a few things, like properly
getting() the current pointed object under the lock, and that sort of
thing, but it's not that complicated. I don't know of any other mecanism
to iterate lists in a safe way without taking global locks, which we
want to avoid as that would open us to all sorts of deadlocks...

The case of trees like PCI is fine provided parents aren't removed
before all childs are removed, and thus all iterators properly
invalidated.

Now, maybe I missed something ... but in any case, it seems a lot of our
current iterating constucts are racy.

Ben.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-18 10:05    [W:0.044 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site