Re: [PATCH] Add pci_walk_bus function to PCI core (nonrecursive)
From: Benjamin Herrenschmidt
Date: Thu Aug 18 2005 - 00:01:47 EST
On Thu, 2005-08-18 at 14:33 +1000, Paul Mackerras wrote:
> The PCI error recovery infrastructure needs to be able to contact all
> the drivers affected by a PCI error event, which may mean traversing
> all the devices under a given PCI-PCI bridge. This patch adds a
> function to the PCI core that traverses all the PCI devices on a PCI
> bus and under any PCI-PCI bridges on that bus (and so on), calling a
> given function for each device. This provides a way for the error
> recovery code to iterate through all devices that are affected by an
> error event.
.../...
Note that it's racy vs. removal of devices, but I suspect a good bunch
of the PCI code is. The whole idea that list*_safe routines pay you
anything in that regard need to be shot. Afaik, they are only safe about
the caller removing the current element.
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.
Ben.
-
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/