linux-kernel-test/drivers/pci/hotplug
Prarit Bhargava 6af8bef14d PCI hotplug: acpiphp: Prevent deadlock on PCI-to-PCI bridge remove
I originally submitted a patch to workaround this by pushing all Ejection
Requests and Device Checks onto the kacpi_hotplug queue.

http://marc.info/?l=linux-acpi&m=131678270930105&w=2

The patch is still insufficient in that Bus Checks also need to be added.

Rather than add all events, including non-PCI-hotplug events, to the
hotplug queue, mjg suggested that a better approach would be to modify
the acpiphp driver so only acpiphp events would be added to the
kacpi_hotplug queue.

It's a longer patch, but at least we maintain the benefit of having separate
queues in ACPI.  This, of course, is still only a workaround the problem.
As Bjorn and mjg pointed out, we have to refactor a lot of this code to do
the right thing but at this point it is a better to have this code working.

The acpi core places all events on the kacpi_notify queue.  When the acpiphp
driver is loaded and a PCI card with a PCI-to-PCI bridge is removed the
following call sequence occurs:

cleanup_p2p_bridge()
	    -> cleanup_bridge()
		    -> acpi_remove_notify_handler()
			    -> acpi_os_wait_events_complete()
				    -> flush_workqueue(kacpi_notify_wq)

which is the queue we are currently executing on and the process will hang.

Move all hotplug acpiphp events onto the kacpi_hotplug workqueue.  In
handle_hotplug_event_bridge() and handle_hotplug_event_func() we can simply
push the rest of the work onto the kacpi_hotplug queue and then avoid the
deadlock.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: mjg@redhat.com
Cc: bhelgaas@google.com
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-10-14 09:05:31 -07:00
..
acpi_pcihp.c PCI hotplug: Rename is_ejectable which also exists in dock.c 2011-07-22 08:25:35 -07:00
acpiphp_core.c
acpiphp_glue.c PCI hotplug: acpiphp: Prevent deadlock on PCI-to-PCI bridge remove 2011-10-14 09:05:31 -07:00
acpiphp_ibm.c sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
acpiphp.h headers: kobject.h redux 2011-01-10 08:51:44 -08:00
cpci_hotplug_core.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
cpci_hotplug_pci.c
cpci_hotplug.h
cpcihp_generic.c
cpcihp_zt5550.c
cpcihp_zt5550.h
cpqphp_core.c PCI hotplug: cpqphp: use pci_dev->vendor 2011-07-22 08:25:43 -07:00
cpqphp_ctrl.c
cpqphp_nvram.c
cpqphp_nvram.h
cpqphp_pci.c
cpqphp_sysfs.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
cpqphp.h
fakephp.c PCI: use for_each_pci_dev() 2010-07-30 09:47:22 -07:00
ibmphp_core.c
ibmphp_ebda.c PCI hotplug: ibmphp: Add check to prevent reading beyond mapped area 2010-11-11 09:34:31 -08:00
ibmphp_hpc.c PCI hotplug: ibmphp-hpc: semaphore cleanup 2010-10-15 13:09:48 -07:00
ibmphp_pci.c
ibmphp_res.c
ibmphp.h
Kconfig
Makefile
pci_hotplug_core.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pciehp_acpi.c PCI hotplug: Fix unexpected driver unregister in pciehp_acpi.c 2010-12-23 12:51:49 -08:00
pciehp_core.c pciehp: update workqueue usage 2010-10-18 08:31:02 +02:00
pciehp_ctrl.c PCI: pciehp: change wait time for valid configuration access 2011-07-22 09:06:41 -07:00
pciehp_hpc.c PCI: pciehp: change wait time for valid configuration access 2011-07-22 09:06:41 -07:00
pciehp_pci.c PCI hotplug: pciehp: Fixed return value sign for pciehp_unconfigure_device 2010-07-30 09:29:15 -07:00
pciehp.h pciehp: update workqueue usage 2010-10-18 08:31:02 +02:00
pcihp_skeleton.c
pcihp_slot.c Fix pointer dereference before call to pcie_bus_configure_settings 2011-09-09 19:49:58 -07:00
rpadlpar_core.c pci/of: Match PCI devices to OF nodes dynamically 2011-06-08 09:08:17 +10:00
rpadlpar_sysfs.c
rpadlpar.h
rpaphp_core.c Fix common misspellings 2011-03-31 11:26:23 -03:00
rpaphp_pci.c
rpaphp_slot.c headers: kobject.h redux 2011-01-10 08:51:44 -08:00
rpaphp.h
sgi_hotplug.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
shpchp_core.c shpchp: update workqueue usage 2010-10-18 08:33:02 +02:00
shpchp_ctrl.c shpchp: update workqueue usage 2010-10-18 08:33:02 +02:00
shpchp_hpc.c shpchp: update workqueue usage 2010-10-18 08:33:02 +02:00
shpchp_pci.c PCI hotplug: shpchp: Removed check for hotplug of display devices 2010-07-30 09:29:16 -07:00
shpchp_sysfs.c treewide: Convert uses of struct resource to resource_size(ptr) 2011-06-10 14:55:36 +02:00
shpchp.h shpchp: update workqueue usage 2010-10-18 08:33:02 +02:00