linux/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.h headers: kobject.h redux 2011-01-10 08:51:44 -08:00
acpiphp_core.c PCI: Make current and maximum bus speeds part of the PCI core 2010-02-22 16:15:17 -08:00
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
cpci_hotplug.h PCI: cpci_hotplug: stop managing hotplug_slot->name 2008-10-22 16:42:39 -07:00
cpci_hotplug_core.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
cpci_hotplug_pci.c PCI: cpci_hotplug: stop managing hotplug_slot->name 2008-10-22 16:42:39 -07:00
cpcihp_generic.c PCI: hotplug/cpcihp, fix pci device refcounting 2010-02-22 16:17:02 -08:00
cpcihp_zt5550.c
cpcihp_zt5550.h
cpqphp.h PCI: Make current and maximum bus speeds part of the PCI core 2010-02-22 16:15:17 -08:00
cpqphp_core.c PCI hotplug: cpqphp: use pci_dev->vendor 2011-07-22 08:25:43 -07:00
cpqphp_ctrl.c PCI: Make current and maximum bus speeds part of the PCI core 2010-02-22 16:15:17 -08:00
cpqphp_nvram.c PCI Hotplug: cpqphp: fix comment style 2009-06-11 12:04:08 -07:00
cpqphp_nvram.h
cpqphp_pci.c PCI Hotplug: cpqphp: don't use pci_find_slot() 2009-06-11 12:04:16 -07:00
cpqphp_sysfs.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
fakephp.c PCI: use for_each_pci_dev() 2010-07-30 09:47:22 -07:00
ibmphp.h PCI: ibmphp: stop managing hotplug_slot->name 2008-10-22 16:42:41 -07:00
ibmphp_core.c PCI: Make current and maximum bus speeds part of the PCI core 2010-02-22 16:15:17 -08:00
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: Rename add_range() to add_bus_range() to avoid conflict 2010-02-10 17:45:09 -08:00
Kconfig PCI: drivers/pci/slot.c should depend on CONFIG_SYSFS 2009-06-18 13:57:24 -07:00
Makefile PCI hotplug: acpiphp should be linked after vendor drivers 2009-11-04 08:47:14 -08:00
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.h pciehp: update workqueue usage 2010-10-18 08:31:02 +02: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
pcihp_skeleton.c PCI hotplug: remove redundant .owner initializations 2009-06-16 14:30:12 -07:00
pcihp_slot.c Fix pointer dereference before call to pcie_bus_configure_settings 2011-09-09 19:49:58 -07:00
rpadlpar.h
rpadlpar_core.c pci/of: Match PCI devices to OF nodes dynamically 2011-06-08 09:08:17 +10:00
rpadlpar_sysfs.c
rpaphp.h PCI hotplug: rpaphp: make debug var unique 2008-10-20 10:54:27 -07:00
rpaphp_core.c Fix common misspellings 2011-03-31 11:26:23 -03:00
rpaphp_pci.c PCI hotplug: rpaphp: make debug var unique 2008-10-20 10:54:27 -07:00
rpaphp_slot.c headers: kobject.h redux 2011-01-10 08:51:44 -08:00
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.h shpchp: update workqueue usage 2010-10-18 08:33:02 +02: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