PATCH: Multiprobe sanitizer

From: Alan Cox
Date: Wed Aug 16 2006 - 12:19:00 EST

There are numerous drivers that can use multithreaded probing but having
some kind of global flag as the way to control this makes migration to
threaded probing hard and since it enables it everywhere and is almost
as likely to cause serious pain as holding a clog dance in a minefield.

If we have a pci_driver multithread_probe flag to inherit you can turn
it on for one driver at a time.

>From playing so far however I think we need a different model at the
device layer which serializes until the called probe function says "ok
you can start another one now". That would need some kind of flag and
semaphore plus a helper function.

Anyway in the absence of that this is a starting point to usefully play
with this stuff

Signed-off-by: Alan Cox <alan@xxxxxxxxxx>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc4-mm1/drivers/pci/pci-driver.c linux-2.6.18-rc4-mm1/drivers/pci/pci-driver.c
--- linux.vanilla-2.6.18-rc4-mm1/drivers/pci/pci-driver.c 2006-08-15 15:40:17.000000000 +0100
+++ linux-2.6.18-rc4-mm1/drivers/pci/pci-driver.c 2006-08-15 17:24:44.000000000 +0100
@@ -432,7 +432,11 @@
drv->driver.bus = &pci_bus_type;
drv->driver.owner = owner;
drv->driver.kobj.ktype = &pci_driver_kobj_type;
- drv->driver.multithread_probe = pci_multithread_probe;
+ if(pci_multithread_probe)
+ drv->driver.multithread_probe = pci_multithread_probe;
+ else
+ drv->driver.multithread_probe = drv->multithread_probe;

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc4-mm1/include/linux/pci.h linux-2.6.18-rc4-mm1/include/linux/pci.h
--- linux.vanilla-2.6.18-rc4-mm1/include/linux/pci.h 2006-08-15 15:40:19.000000000 +0100
+++ linux-2.6.18-rc4-mm1/include/linux/pci.h 2006-08-15 16:37:21.000000000 +0100
@@ -351,6 +351,8 @@
struct pci_error_handlers *err_handler;
struct device_driver driver;
struct pci_dynids dynids;
+ int multithread_probe;

#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at