Patchwork [net-next] bnx2x: Disable local BHes to prevent a dead-lock situation

login
register
mail settings
Submitter Vladislav Zolotarov
Date Nov. 24, 2010, 1:45 p.m.
Message ID <1290606310.25676.7.camel@lb-tlvb-vladz>
Download mbox | patch
Permalink /patch/72882/
State Accepted
Delegated to: David Miller
Headers show

Comments

Vladislav Zolotarov - Nov. 24, 2010, 1:45 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>

According to Eric's suggestion:
Disable local BHes to prevent a dead-lock situation between sch_direct_xmit()
(Soft_IRQ context) and bnx2x_tx_int (called by bnx2x_run_loopback() - syscall
context), as both are taking a netif_tx_lock().

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
CCing Eric... :)

 drivers/net/bnx2x/bnx2x_ethtool.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Eric Dumazet - Nov. 24, 2010, 2:04 p.m.
Le mercredi 24 novembre 2010 à 15:45 +0200, Vladislav Zolotarov a
écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> 
> According to Eric's suggestion:
> Disable local BHes to prevent a dead-lock situation between sch_direct_xmit()
> (Soft_IRQ context) and bnx2x_tx_int (called by bnx2x_run_loopback() - syscall
> context), as both are taking a netif_tx_lock().
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
> ---
> CCing Eric... :)

Dont worry, I am subscribed to netdev ;)

Thanks !


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov - Nov. 24, 2010, 2:18 p.m.
> > CCing Eric... :)

> 

> Dont worry, I am subscribed to netdev ;)

> 

> Thanks !

> 


I'm sure u r. ;) But u see, Dave is very punctual about a formal
side and the rule says I had to add u. So I fixed myself before
Dave's remark on this... ;)

Thanks again for your help.

Regards,
vlad
David Miller - Nov. 24, 2010, 7:09 p.m.
From: "Vladislav Zolotarov" <vladz@broadcom.com>
Date: Wed, 24 Nov 2010 15:45:10 +0200

> From: Eric Dumazet <eric.dumazet@gmail.com>
> 
> According to Eric's suggestion:
> Disable local BHes to prevent a dead-lock situation between sch_direct_xmit()
> (Soft_IRQ context) and bnx2x_tx_int (called by bnx2x_run_loopback() - syscall
> context), as both are taking a netif_tx_lock().
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c
index d02ffbd..0301278 100644
--- a/drivers/net/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/bnx2x/bnx2x_ethtool.c
@@ -1499,8 +1499,15 @@  static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
 	 * updates that have been performed while interrupts were
 	 * disabled.
 	 */
-	if (bp->common.int_block == INT_BLOCK_IGU)
+	if (bp->common.int_block == INT_BLOCK_IGU) {
+		/* Disable local BHes to prevent a dead-lock situation between
+		 * sch_direct_xmit() and bnx2x_run_loopback() (calling
+		 * bnx2x_tx_int()), as both are taking netif_tx_lock().
+		 */
+		local_bh_disable();
 		bnx2x_tx_int(fp_tx);
+		local_bh_enable();
+	}
 
 	rx_idx = le16_to_cpu(*fp_rx->rx_cons_sb);
 	if (rx_idx != rx_start_idx + num_pkts)