aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBreno Leitao <leitao@linux.vnet.ibm.com>2010-08-24 08:50:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-25 19:36:51 -0400
commitc5dadddb8c9d310bc263f671f19fe3ba90b329fe (patch)
tree195fd38b6807e3c380bf4f05f3e9c81788dd826b
parent944c794d6437e5301c8769cb242c2b919a5acf59 (diff)
qlge: Fix a deadlock when the interface is going down
Currently qlge can deadlock when the interface is going down, and the mpi_port_cfg_work() is executing on another processor. It happens because unregister_netdev() holds the rtnl lock, and the mpi_port_cfg_work() also request this lock. Since unregiter_netdev() may wait mpi_port_cfg_work(), who also request the holding lock, it can cause an deadlock, displaying the following error: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. rmmod D 00000080c6c1d190 0 3993 2081 0x00008080 Call Trace: [c000000975f56ee0] [c0000000000152a0] .__switch_to+0x100/0x1d0 [c000000975f56f70] [c0000000005781b4] .schedule+0x3a4/0x8c0 [c000000975f570c0] [c000000000578e8c] .schedule_timeout+0x24c/0x350 [c000000975f571e0] [c000000000578a88] .wait_for_common+0x198/0x210 [c000000975f572c0] [c0000000000abbb4] .__cancel_work_timer+0x2c4/0x2e0 [c000000975f57400] [d0000000078e7a20] .ql_adapter_down+0x80/0x260 [qlge] [c000000975f574b0] [d0000000078e7d80] .qlge_close+0x70/0x130 [qlge] [c000000975f57540] [c000000000497ef8] .__dev_close+0x98/0xf0 [c000000975f575d0] [c000000000497f74] .dev_close+0x24/0x60 [c000000975f57650] [c000000000498080] .rollback_registered_many+0xd0/0x2b0 [c000000975f576f0] [c000000000498338] .rollback_registered+0x38/0x50 [c000000975f57780] [c0000000004983d8] .unregister_netdevice_queue+0x88/0xe0 [c000000975f57810] [c000000000498574] .unregister_netdev+0x24/0x40 [c000000975f57890] [d0000000078f6f38] .qlge_remove+0x3c/0x78 [qlge] [c000000975f57920] [c0000000002d9298] .pci_device_remove+0x48/0x90 [c000000975f579a0] [c000000000372850] .__device_release_driver+0xa0/0x130 [c000000975f57a30] [c000000000372a08] .driver_detach+0x128/0x150 [c000000975f57ad0] [c000000000371134] .bus_remove_driver+0xc4/0x1a0 [c000000975f57b70] [c00000000037357c] .driver_unregister+0x8c/0xd0 [c000000975f57c00] [c0000000002d968c] .pci_unregister_driver+0x5c/0x110 [c000000975f57ca0] [d0000000078f6ee4] .qlge_exit+0x1c/0x34 [qlge] Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/qlge/qlge_main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index c9f9754f0784..5a245211fc53 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -3889,11 +3889,8 @@ int ql_wol(struct ql_adapter *qdev)
3889 return status; 3889 return status;
3890} 3890}
3891 3891
3892static int ql_adapter_down(struct ql_adapter *qdev) 3892static void ql_cancel_all_work_sync(struct ql_adapter *qdev)
3893{ 3893{
3894 int i, status = 0;
3895
3896 ql_link_off(qdev);
3897 3894
3898 /* Don't kill the reset worker thread if we 3895 /* Don't kill the reset worker thread if we
3899 * are in the process of recovery. 3896 * are in the process of recovery.
@@ -3905,6 +3902,15 @@ static int ql_adapter_down(struct ql_adapter *qdev)
3905 cancel_delayed_work_sync(&qdev->mpi_idc_work); 3902 cancel_delayed_work_sync(&qdev->mpi_idc_work);
3906 cancel_delayed_work_sync(&qdev->mpi_core_to_log); 3903 cancel_delayed_work_sync(&qdev->mpi_core_to_log);
3907 cancel_delayed_work_sync(&qdev->mpi_port_cfg_work); 3904 cancel_delayed_work_sync(&qdev->mpi_port_cfg_work);
3905}
3906
3907static int ql_adapter_down(struct ql_adapter *qdev)
3908{
3909 int i, status = 0;
3910
3911 ql_link_off(qdev);
3912
3913 ql_cancel_all_work_sync(qdev);
3908 3914
3909 for (i = 0; i < qdev->rss_ring_count; i++) 3915 for (i = 0; i < qdev->rss_ring_count; i++)
3910 napi_disable(&qdev->rx_ring[i].napi); 3916 napi_disable(&qdev->rx_ring[i].napi);
@@ -4727,6 +4733,7 @@ static void __devexit qlge_remove(struct pci_dev *pdev)
4727 struct net_device *ndev = pci_get_drvdata(pdev); 4733 struct net_device *ndev = pci_get_drvdata(pdev);
4728 struct ql_adapter *qdev = netdev_priv(ndev); 4734 struct ql_adapter *qdev = netdev_priv(ndev);
4729 del_timer_sync(&qdev->timer); 4735 del_timer_sync(&qdev->timer);
4736 ql_cancel_all_work_sync(qdev);
4730 unregister_netdev(ndev); 4737 unregister_netdev(ndev);
4731 ql_release_all(pdev); 4738 ql_release_all(pdev);
4732 pci_disable_device(pdev); 4739 pci_disable_device(pdev);
@@ -4746,13 +4753,7 @@ static void ql_eeh_close(struct net_device *ndev)
4746 4753
4747 /* Disabling the timer */ 4754 /* Disabling the timer */
4748 del_timer_sync(&qdev->timer); 4755 del_timer_sync(&qdev->timer);
4749 if (test_bit(QL_ADAPTER_UP, &qdev->flags)) 4756 ql_cancel_all_work_sync(qdev);
4750 cancel_delayed_work_sync(&qdev->asic_reset_work);
4751 cancel_delayed_work_sync(&qdev->mpi_reset_work);
4752 cancel_delayed_work_sync(&qdev->mpi_work);
4753 cancel_delayed_work_sync(&qdev->mpi_idc_work);
4754 cancel_delayed_work_sync(&qdev->mpi_core_to_log);
4755 cancel_delayed_work_sync(&qdev->mpi_port_cfg_work);
4756 4757
4757 for (i = 0; i < qdev->rss_ring_count; i++) 4758 for (i = 0; i < qdev->rss_ring_count; i++)
4758 netif_napi_del(&qdev->rx_ring[i].napi); 4759 netif_napi_del(&qdev->rx_ring[i].napi);