Patchwork [138/150] sfc: Disable soft interrupt handling during efx_device_detach_sync()

login
register
mail settings
Submitter Luis Henriques
Date March 26, 2013, 3:20 p.m.
Message ID <1364311249-14454-139-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/231377/
State New
Headers show

Comments

Luis Henriques - March 26, 2013, 3:20 p.m.
3.5.7.9 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Hutchings <bhutchings@solarflare.com>

commit 35205b211c8d17a8a0b5e8926cb7c73e9a7ef1ad upstream.

efx_device_detach_sync() locks all TX queues before marking the device
detached and thus disabling further TX scheduling.  But it can still
be interrupted by TX completions which then result in TX scheduling in
soft interrupt context.  This will deadlock when it tries to acquire
a TX queue lock that efx_device_detach_sync() already acquired.

To avoid deadlock, we must use netif_tx_{,un}lock_bh().

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/ethernet/sfc/efx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Ben Hutchings - March 27, 2013, 12:34 a.m.
On Tue, 2013-03-26 at 15:20 +0000, Luis Henriques wrote:
> 3.5.7.9 -stable review patch.  If anyone has any objections, please let me know.
[...]

I applied all 16 of the sfc patches on top of 3.5.7.8 and the result
passed our standard 'overnight' test suite for in-tree drivers.

Ben.
Luis Henriques - March 27, 2013, 9:36 a.m.
On Wed, Mar 27, 2013 at 12:34:15AM +0000, Ben Hutchings wrote:
> On Tue, 2013-03-26 at 15:20 +0000, Luis Henriques wrote:
> > 3.5.7.9 -stable review patch.  If anyone has any objections, please let me know.
> [...]
> 
> I applied all 16 of the sfc patches on top of 3.5.7.8 and the result
> passed our standard 'overnight' test suite for in-tree drivers.
> 

Great, thanks a lot for reporting that Ben.

Cheers,
--
Luis

Patch

diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index 320cf7b..7db0e5b 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -170,9 +170,9 @@  static inline void efx_device_detach_sync(struct efx_nic *efx)
 	 * TX scheduler is stopped when we're done and before
 	 * netif_device_present() becomes false.
 	 */
-	netif_tx_lock(dev);
+	netif_tx_lock_bh(dev);
 	netif_device_detach(dev);
-	netif_tx_unlock(dev);
+	netif_tx_unlock_bh(dev);
 }
 
 #endif /* EFX_EFX_H */