public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Vladislav Zolotarov" <vladz@broadcom.com>
To: "Dave Miller" <davem@davemloft.net>
Cc: "Eilon Greenstein" <eilong@broadcom.com>,
	"netdev list" <netdev@vger.kernel.org>
Subject: [PATCH net-next] bnx2x: Resolving a possible dead-lock situation
Date: Tue, 23 Nov 2010 18:15:12 +0200	[thread overview]
Message-ID: <1290528912.15453.3.camel@lb-tlvb-vladz> (raw)

There is a possible dead-lock situation between sch_direct_xmit() 
(called from soft_IRQ context) and bnx2x_tx_int() when called from 
an ethtool self-test flow (syscall context).

To prevent a dead-lock, disable bottom-halves on a local CPU when taking
a tx_lock from bnx2x_tx_int() (use __netif_tx_lock_bh(txq)).

The flow in the bnx2x_tx_int() where tx_lock is taken should be hit
very rarely thus performance penalty of this change should be minimal.

Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/bnx2x/bnx2x_cmn.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 94d5f59..5189788 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -144,14 +144,14 @@ int bnx2x_tx_int(struct bnx2x_fastpath *fp)
 		 * stops the queue
 		 */
 
-		__netif_tx_lock(txq, smp_processor_id());
+		__netif_tx_lock_bh(txq);
 
 		if ((netif_tx_queue_stopped(txq)) &&
 		    (bp->state == BNX2X_STATE_OPEN) &&
 		    (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3))
 			netif_tx_wake_queue(txq);
 
-		__netif_tx_unlock(txq);
+		__netif_tx_unlock_bh(txq);
 	}
 	return 0;
 }
-- 
1.7.0.4





             reply	other threads:[~2010-11-23 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 16:15 Vladislav Zolotarov [this message]
2010-11-23 16:29 ` [PATCH net-next] bnx2x: Resolving a possible dead-lock situation Eric Dumazet
2010-11-23 16:36   ` Vladislav Zolotarov
2010-11-23 16:55     ` Eric Dumazet
2010-11-23 18:13       ` Vladislav Zolotarov
2010-11-23 18:15       ` Vladislav Zolotarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290528912.15453.3.camel@lb-tlvb-vladz \
    --to=vladz@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox