linux_dsm_epyc7002/drivers/base
Alan Stern bf74ad5bc4 [PATCH] Hold the device's parent's lock during probe and remove
This patch (as604) makes the driver core hold a device's parent's lock
as well as the device's lock during calls to the probe and remove
methods in a driver.  This facility is needed by USB device drivers,
owing to the peculiar way USB devices work:

	A device provides multiple interfaces, and drivers are bound
	to interfaces rather than to devices;

	Nevertheless a reset, reset-configuration, suspend, or resume
	affects the entire device and requires the caller to hold the
	lock for the device, not just a lock for one of the interfaces.

Since a USB driver's probe method is always called with the interface
lock held, the locking order rules (always lock parent before child)
prevent these methods from acquiring the device lock.  The solution
provided here is to call all probe and remove methods, for all devices
(not just USB), with the parent lock already acquired.

Although currently only the USB subsystem requires these changes, people
have mentioned in prior discussion that the overhead of acquiring an
extra semaphore in all the prove/remove sequences is not overly large.

Up to now, the USB core has been using its own set of private
semaphores.  A followup patch will remove them, relying entirely on the
device semaphores provided by the driver core.

The code paths affected by this patch are:

	device_add and device_del: The USB core already holds the parent
	lock, so no actual change is needed.

	driver_register and driver_unregister: The driver core will now
	lock both the parent and the device before probing or removing.

	driver_bind and driver_unbind (in sysfs): These routines will
	now lock both the parent and the device before binding or
	unbinding.

	bus_rescan_devices: The helper routine will lock the parent
	before probing a device.

I have not tested this patch for conflicts with other subsystems.  As
far as I can see, the only possibility of conflict would lie in the
bus_rescan_devices pathway, and it seems pretty remote.  Nevertheless,
it would be good for this to get a lot of testing in -mm.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:08 -08:00
..
power [PATCH] fix remaining missing includes 2005-11-07 07:53:41 -08:00
attribute_container.c [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
base.h [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
bus.c [PATCH] Hold the device's parent's lock during probe and remove 2006-01-04 16:18:08 -08:00
class.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
core.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
cpu.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
dd.c [PATCH] Hold the device's parent's lock during probe and remove 2006-01-04 16:18:08 -08:00
dmapool.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
driver.c [PATCH] kernel-doc: drivers/base fixes 2005-10-28 09:52:56 -07:00
firmware_class.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
firmware.c [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
init.c [PATCH] memory hotplug: sysfs and add/remove functions 2005-10-29 21:40:44 -07:00
Kconfig [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
Makefile [PATCH] memory hotplug: sysfs and add/remove functions 2005-10-29 21:40:44 -07:00
map.c [PATCH] drivers/base/*: use kzalloc instead of kmalloc+memset 2005-09-13 08:22:27 -07:00
memory.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
node.c [PATCH] VM: add page_state info to per-node meminfo 2005-09-05 00:05:49 -07:00
platform.c [DRIVER MODEL] Add platform_driver 2005-11-09 17:23:39 +00:00
sys.c [PATCH] fix missing includes 2005-10-30 17:37:32 -08:00
transport_class.c [SCSI] fix transport class corner case after rework 2005-08-28 11:14:06 -05:00