From: Greg Kroah-Hartman Date: Mon, 26 Nov 2012 19:07:25 +0000 (-0800) Subject: remove pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch X-Git-Tag: v3.0.53~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61be431862ed27375467cf79b3a1204bb434f0c8;p=thirdparty%2Fkernel%2Fstable-queue.git remove pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch From 3.0 and 3.4 trees as it should not go there. --- diff --git a/queue-3.0/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch b/queue-3.0/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch deleted file mode 100644 index af83b898cbf..00000000000 --- a/queue-3.0/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 90b5c1d7c45eeb622302680ff96ed30c1a2b6f0e Mon Sep 17 00:00:00 2001 -From: Huang Ying -Date: Wed, 24 Oct 2012 14:54:13 +0800 -Subject: PCI/PM: Fix deadlock when unbinding device if parent in D3cold - -From: Huang Ying - -commit 90b5c1d7c45eeb622302680ff96ed30c1a2b6f0e upstream. - -If a PCI device and its parents are put into D3cold, unbinding the -device will trigger deadlock as follow: - -- driver_unbind - - device_release_driver - - device_lock(dev) <--- previous lock here - - __device_release_driver - - pm_runtime_get_sync - ... - - rpm_resume(dev) - - rpm_resume(dev->parent) - ... - - pci_pm_runtime_resume - ... - - pci_set_power_state - - __pci_start_power_transition - - pci_wakeup_bus(dev->parent->subordinate) - - pci_walk_bus - - device_lock(dev) <--- deadlock here - - -If we do not do device_lock in pci_walk_bus, we can avoid deadlock. -Device_lock in pci_walk_bus is introduced in commit: -d71374dafbba7ec3f67371d3b7e9f6310a588808, corresponding email thread -is: https://lkml.org/lkml/2006/5/26/38. The patch author Zhang Yanmin -said device_lock is added to pci_walk_bus because: - - Some error handling functions call pci_walk_bus. For example, PCIe - aer. Here we lock the device, so the driver wouldn't detach from the - device, as the cb might call driver's callback function. - -So I fixed the deadlock as follows: - -- remove device_lock from pci_walk_bus -- add device_lock into callback if callback will call driver's callback - -I checked pci_walk_bus users one by one, and found only PCIe aer needs -device lock. - -Signed-off-by: Huang Ying -Signed-off-by: Bjorn Helgaas -Acked-by: Rafael J. Wysocki -CC: Zhang Yanmin -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/pci/bus.c | 3 --- - drivers/pci/pcie/aer/aerdrv_core.c | 20 ++++++++++++++++---- - 2 files changed, 16 insertions(+), 7 deletions(-) - ---- a/drivers/pci/bus.c -+++ b/drivers/pci/bus.c -@@ -284,10 +284,7 @@ void pci_walk_bus(struct pci_bus *top, i - } else - next = dev->bus_list.next; - -- /* Run device routines with the device locked */ -- device_lock(&dev->dev); - retval = cb(dev, userdata); -- device_unlock(&dev->dev); - if (retval) - break; - } ---- a/drivers/pci/pcie/aer/aerdrv_core.c -+++ b/drivers/pci/pcie/aer/aerdrv_core.c -@@ -243,6 +243,7 @@ static int report_error_detected(struct - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - dev->error_state = result_data->state; - - if (!dev->driver || -@@ -261,12 +262,14 @@ static int report_error_detected(struct - dev->driver ? - "no AER-aware driver" : "no driver"); - } -- return 0; -+ goto out; - } - - err_handler = dev->driver->err_handler; - vote = err_handler->error_detected(dev, result_data->state); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -277,14 +280,17 @@ static int report_mmio_enabled(struct pc - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->mmio_enabled) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - vote = err_handler->mmio_enabled(dev); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -295,14 +301,17 @@ static int report_slot_reset(struct pci_ - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->slot_reset) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - vote = err_handler->slot_reset(dev); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -310,15 +319,18 @@ static int report_resume(struct pci_dev - { - struct pci_error_handlers *err_handler; - -+ device_lock(&dev->dev); - dev->error_state = pci_channel_io_normal; - - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->resume) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - err_handler->resume(dev); -+out: -+ device_unlock(&dev->dev); - return 0; - } - diff --git a/queue-3.0/series b/queue-3.0/series index bea74f53d60..1d04445701c 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -1,5 +1,4 @@ mm-bugfix-set-current-reclaim_state-to-null-while-returning-from-kswapd.patch -pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch fanotify-fix-missing-break.patch crypto-cryptd-disable-softirqs-in-cryptd_queue_worker-to-prevent-data-corruption.patch alsa-hda-cirrus-fix-coefficient-index-for-beep-configuration.patch @@ -35,3 +34,4 @@ reiserfs-protect-reiserfs_quota_write-with-write-lock.patch selinux-fix-sel_netnode_insert-suspicious-rcu-dereference.patch pci-ability-to-relocate-assigned-pci-resources.patch pci-calculate-right-add_size.patch +resource-fix-wrong-resource-window-calculation.patch diff --git a/queue-3.4/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch b/queue-3.4/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch deleted file mode 100644 index 1d4156f0431..00000000000 --- a/queue-3.4/pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 90b5c1d7c45eeb622302680ff96ed30c1a2b6f0e Mon Sep 17 00:00:00 2001 -From: Huang Ying -Date: Wed, 24 Oct 2012 14:54:13 +0800 -Subject: PCI/PM: Fix deadlock when unbinding device if parent in D3cold - -From: Huang Ying - -commit 90b5c1d7c45eeb622302680ff96ed30c1a2b6f0e upstream. - -If a PCI device and its parents are put into D3cold, unbinding the -device will trigger deadlock as follow: - -- driver_unbind - - device_release_driver - - device_lock(dev) <--- previous lock here - - __device_release_driver - - pm_runtime_get_sync - ... - - rpm_resume(dev) - - rpm_resume(dev->parent) - ... - - pci_pm_runtime_resume - ... - - pci_set_power_state - - __pci_start_power_transition - - pci_wakeup_bus(dev->parent->subordinate) - - pci_walk_bus - - device_lock(dev) <--- deadlock here - - -If we do not do device_lock in pci_walk_bus, we can avoid deadlock. -Device_lock in pci_walk_bus is introduced in commit: -d71374dafbba7ec3f67371d3b7e9f6310a588808, corresponding email thread -is: https://lkml.org/lkml/2006/5/26/38. The patch author Zhang Yanmin -said device_lock is added to pci_walk_bus because: - - Some error handling functions call pci_walk_bus. For example, PCIe - aer. Here we lock the device, so the driver wouldn't detach from the - device, as the cb might call driver's callback function. - -So I fixed the deadlock as follows: - -- remove device_lock from pci_walk_bus -- add device_lock into callback if callback will call driver's callback - -I checked pci_walk_bus users one by one, and found only PCIe aer needs -device lock. - -Signed-off-by: Huang Ying -Signed-off-by: Bjorn Helgaas -Acked-by: Rafael J. Wysocki -CC: Zhang Yanmin -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/pci/bus.c | 3 --- - drivers/pci/pcie/aer/aerdrv_core.c | 20 ++++++++++++++++---- - 2 files changed, 16 insertions(+), 7 deletions(-) - ---- a/drivers/pci/bus.c -+++ b/drivers/pci/bus.c -@@ -314,10 +314,7 @@ void pci_walk_bus(struct pci_bus *top, i - } else - next = dev->bus_list.next; - -- /* Run device routines with the device locked */ -- device_lock(&dev->dev); - retval = cb(dev, userdata); -- device_unlock(&dev->dev); - if (retval) - break; - } ---- a/drivers/pci/pcie/aer/aerdrv_core.c -+++ b/drivers/pci/pcie/aer/aerdrv_core.c -@@ -244,6 +244,7 @@ static int report_error_detected(struct - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - dev->error_state = result_data->state; - - if (!dev->driver || -@@ -262,12 +263,14 @@ static int report_error_detected(struct - dev->driver ? - "no AER-aware driver" : "no driver"); - } -- return 0; -+ goto out; - } - - err_handler = dev->driver->err_handler; - vote = err_handler->error_detected(dev, result_data->state); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -278,14 +281,17 @@ static int report_mmio_enabled(struct pc - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->mmio_enabled) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - vote = err_handler->mmio_enabled(dev); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -296,14 +302,17 @@ static int report_slot_reset(struct pci_ - struct aer_broadcast_data *result_data; - result_data = (struct aer_broadcast_data *) data; - -+ device_lock(&dev->dev); - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->slot_reset) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - vote = err_handler->slot_reset(dev); - result_data->result = merge_result(result_data->result, vote); -+out: -+ device_unlock(&dev->dev); - return 0; - } - -@@ -311,15 +320,18 @@ static int report_resume(struct pci_dev - { - struct pci_error_handlers *err_handler; - -+ device_lock(&dev->dev); - dev->error_state = pci_channel_io_normal; - - if (!dev->driver || - !dev->driver->err_handler || - !dev->driver->err_handler->resume) -- return 0; -+ goto out; - - err_handler = dev->driver->err_handler; - err_handler->resume(dev); -+out: -+ device_unlock(&dev->dev); - return 0; - } - diff --git a/queue-3.4/series b/queue-3.4/series index 7c5294391ce..4cdc313fdb3 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -3,7 +3,6 @@ xfs-drop-buffer-io-reference-when-a-bad-bio-is-built.patch mac80211-sync-acccess-to-tx_filtered-ps_tx_buf-queues.patch mac80211-don-t-send-null-data-packet-when-not-associated.patch mac80211-call-skb_dequeue-ieee80211_free_txskb-instead-of-__skb_queue_purge.patch -pci-pm-fix-deadlock-when-unbinding-device-if-parent-in-d3cold.patch fanotify-fix-missing-break.patch module-fix-out-by-one-error-in-kallsyms.patch cifs-fix-potential-buffer-overrun-in-cifs.idmap-handling-code.patch