diff options
author | Erez Shitrit <erezsh@mellanox.com> | 2014-07-08 05:45:12 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-08-05 10:47:33 -0400 |
commit | 4eae374845affc3ebf8ccfc38d554a86adc95003 (patch) | |
tree | 7d60bd89c5f42d98b6657a177c7b7d6956c71982 /drivers/infiniband/ulp/ipoib | |
parent | db84f88037592f069f5c1fc7f6b00ae6f5eb2e84 (diff) |
IB/ipoib: Avoid flushing the workqueue from worker context
The error flow of ipoib_ib_dev_open() invokes ipoib_ib_dev_stop() with
workqueue flushing enabled, which deadlocks if the open procedure
itself was called by a worker thread.
Fix this by adding a flush enabled flag to ipoib_ib_dev_open() and set
it accordingly from the locations where such a call is made.
The call trace was the following:
[<ffffffff81095bc4>] ? flush_workqueue+0x54/0x80
[<ffffffffa056c657>] ? ipoib_ib_dev_stop+0x447/0x650 [ib_ipoib]
[<ffffffffa056cc34>] ? ipoib_ib_dev_open+0x284/0x430 [ib_ipoib]
[<ffffffffa05674a8>] ? ipoib_open+0x78/0x1d0 [ib_ipoib]
[<ffffffffa05697b8>] ? ipoib_pkey_open+0x38/0x40 [ib_ipoib]
[<ffffffffa056cf3c>] ? __ipoib_ib_dev_flush+0x15c/0x2c0 [ib_ipoib]
[<ffffffffa056ce56>] ? __ipoib_ib_dev_flush+0x76/0x2c0 [ib_ipoib]
[<ffffffffa056d0a0>] ? ipoib_ib_dev_flush_heavy+0x0/0x20 [ib_ipoib]
[<ffffffffa056d0ba>] ? ipoib_ib_dev_flush_heavy+0x1a/0x20 [ib_ipoib]
[<ffffffff81094d20>] ? worker_thread+0x170/0x2a0
[<ffffffff8109b2a0>] ? autoremove_wake_function+0x0/0x40
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Acked-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp/ipoib')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_ib.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 683d23ac7cbf..3edce617c31b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -471,7 +471,7 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work); | |||
471 | void ipoib_pkey_event(struct work_struct *work); | 471 | void ipoib_pkey_event(struct work_struct *work); |
472 | void ipoib_ib_dev_cleanup(struct net_device *dev); | 472 | void ipoib_ib_dev_cleanup(struct net_device *dev); |
473 | 473 | ||
474 | int ipoib_ib_dev_open(struct net_device *dev); | 474 | int ipoib_ib_dev_open(struct net_device *dev, int flush); |
475 | int ipoib_ib_dev_up(struct net_device *dev); | 475 | int ipoib_ib_dev_up(struct net_device *dev); |
476 | int ipoib_ib_dev_down(struct net_device *dev, int flush); | 476 | int ipoib_ib_dev_down(struct net_device *dev, int flush); |
477 | int ipoib_ib_dev_stop(struct net_device *dev, int flush); | 477 | int ipoib_ib_dev_stop(struct net_device *dev, int flush); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index be8f971edbec..9dcb2c9e758a 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -664,7 +664,7 @@ static void ipoib_ib_tx_timer_func(unsigned long ctx) | |||
664 | drain_tx_cq((struct net_device *)ctx); | 664 | drain_tx_cq((struct net_device *)ctx); |
665 | } | 665 | } |
666 | 666 | ||
667 | int ipoib_ib_dev_open(struct net_device *dev) | 667 | int ipoib_ib_dev_open(struct net_device *dev, int flush) |
668 | { | 668 | { |
669 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 669 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
670 | int ret; | 670 | int ret; |
@@ -705,7 +705,7 @@ int ipoib_ib_dev_open(struct net_device *dev) | |||
705 | dev_stop: | 705 | dev_stop: |
706 | if (!test_and_set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) | 706 | if (!test_and_set_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) |
707 | napi_enable(&priv->napi); | 707 | napi_enable(&priv->napi); |
708 | ipoib_ib_dev_stop(dev, 1); | 708 | ipoib_ib_dev_stop(dev, flush); |
709 | return -1; | 709 | return -1; |
710 | } | 710 | } |
711 | 711 | ||
@@ -916,7 +916,7 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
916 | (unsigned long) dev); | 916 | (unsigned long) dev); |
917 | 917 | ||
918 | if (dev->flags & IFF_UP) { | 918 | if (dev->flags & IFF_UP) { |
919 | if (ipoib_ib_dev_open(dev)) { | 919 | if (ipoib_ib_dev_open(dev, 1)) { |
920 | ipoib_transport_dev_cleanup(dev); | 920 | ipoib_transport_dev_cleanup(dev); |
921 | return -ENODEV; | 921 | return -ENODEV; |
922 | } | 922 | } |
@@ -1033,7 +1033,7 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
1033 | 1033 | ||
1034 | if (level == IPOIB_FLUSH_HEAVY) { | 1034 | if (level == IPOIB_FLUSH_HEAVY) { |
1035 | ipoib_ib_dev_stop(dev, 0); | 1035 | ipoib_ib_dev_stop(dev, 0); |
1036 | ipoib_ib_dev_open(dev); | 1036 | ipoib_ib_dev_open(dev, 0); |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | /* | 1039 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 35acbd41a5f7..1bf994a96860 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -114,7 +114,7 @@ int ipoib_open(struct net_device *dev) | |||
114 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) | 114 | if (!test_bit(IPOIB_PKEY_ASSIGNED, &priv->flags)) |
115 | return 0; | 115 | return 0; |
116 | 116 | ||
117 | if (ipoib_ib_dev_open(dev)) | 117 | if (ipoib_ib_dev_open(dev, 1)) |
118 | goto err_disable; | 118 | goto err_disable; |
119 | 119 | ||
120 | if (ipoib_ib_dev_up(dev)) | 120 | if (ipoib_ib_dev_up(dev)) |