linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@sig21.net>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Ivo van Doorn <IvDoorn@gmail.com>,
	Gertjan van Wingerde <gwingerde@gmail.com>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH v2 RFC] mac80211: fix "NOHZ: local_softirq_pending 08"
Date: Mon, 29 Nov 2010 16:51:26 +0100	[thread overview]
Message-ID: <20101129155126.GA32482@sig21.net> (raw)
In-Reply-To: <1291045056.3532.5.camel@jlt3.sipsolutions.net>

ieee80211_tx_status() documentation says "This function may not be
called in IRQ context", and it is called by rt2800usb
from a workqueue context.  However, ieee80211_tx_status() is
meant to be called from tasklets and thus uses netif_rx().
Add a new ieee80211_tx_status_ni() which does the same
thing but uses netif_rx_ni() instead of netif_rx().

This change fixes the "NOHZ: local_softirq_pending 08"
messages I've been getting with rt2800usb.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
---
v2: add ieee80211_tx_status_ni()

Note: the patch is now incomplete, rt2x00lib_txdone() is used by
several drivers and I'm currently checking if ieee80211_tx_status_ni()
can be used by all of them of if I need to split rt2x00lib_txdone()
in two versions.  An updated patch with the rt2x00
changes will follow, but I'm seeking feedback if the base
change here is OK.


 include/net/mac80211.h |   23 +++++++++++++++++++----
 net/mac80211/status.c  |   19 ++++++++++++++++---
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index eaa4aff..df42312 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2055,8 +2055,8 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
  *
  * This function may not be called in IRQ context. Calls to this function
  * for a single hardware must be synchronized against each other. Calls
- * to this function and ieee80211_tx_status_irqsafe() may not be mixed
- * for a single hardware.
+ * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
+ * may not be mixed for a single hardware.
  *
  * @hw: the hardware the frame was transmitted by
  * @skb: the frame that was transmitted, owned by mac80211 after this call
@@ -2065,13 +2065,28 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
 			 struct sk_buff *skb);
 
 /**
+ * ieee80211_tx_status_ni - transmit status callback (in process context)
+ *
+ * Like ieee80211_tx_status() but can be called in process context.
+ *
+ * Calls to this function, ieee80211_tx_status() and
+ * ieee80211_tx_status_irqsafe() may not be mixed
+ * for a single hardware.
+ *
+ * @hw: the hardware the frame was transmitted by
+ * @skb: the frame that was transmitted, owned by mac80211 after this call
+ */
+void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
+			    struct sk_buff *skb);
+
+/**
  * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
  *
  * Like ieee80211_tx_status() but can be called in IRQ context
  * (internally defers to a tasklet.)
  *
- * Calls to this function and ieee80211_tx_status() may not be mixed for a
- * single hardware.
+ * Calls to this function, ieee80211_tx_status() and
+ * ieee80211_tx_status_ni() may not be mixed for a single hardware.
  *
  * @hw: the hardware the frame was transmitted by
  * @skb: the frame that was transmitted, owned by mac80211 after this call
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index bed7e32..ce4d239 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -170,7 +170,8 @@ static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb)
  */
 #define STA_LOST_PKT_THRESHOLD	50
 
-void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
+void __ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
+			   int (*netif_rx_func)(struct sk_buff *skb))
 {
 	struct sk_buff *skb2;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -403,7 +404,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 				skb2 = skb_clone(skb, GFP_ATOMIC);
 				if (skb2) {
 					skb2->dev = prev_dev;
-					netif_rx(skb2);
+					netif_rx_func(skb2);
 				}
 			}
 
@@ -412,10 +413,22 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 	}
 	if (prev_dev) {
 		skb->dev = prev_dev;
-		netif_rx(skb);
+		netif_rx_func(skb);
 		skb = NULL;
 	}
 	rcu_read_unlock();
 	dev_kfree_skb(skb);
 }
+
+void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+	__ieee80211_tx_status(hw, skb, netif_rx);
+}
 EXPORT_SYMBOL(ieee80211_tx_status);
+
+void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
+			    struct sk_buff *skb)
+{
+	__ieee80211_tx_status(hw, skb, netif_rx_ni);
+}
+EXPORT_SYMBOL(ieee80211_tx_status_ni);

  reply	other threads:[~2010-11-29 15:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 14:54 [PATCH RFC] mac80211: fix "NOHZ: local_softirq_pending 08" Johannes Stezenbach
2010-11-29 15:09 ` Johannes Berg
2010-11-29 15:27   ` Johannes Stezenbach
2010-11-29 15:37     ` Johannes Berg
2010-11-29 15:51       ` Johannes Stezenbach [this message]
2010-11-29 15:58         ` [PATCH v2 " Johannes Berg
2010-11-29 16:13           ` [PATCH v3 RFC] mac80211: add ieee80211_tx_status_ni() Johannes Stezenbach
2010-11-30 15:49             ` [PATCH v4] mac80211/rt2x00: " Johannes Stezenbach
2010-11-30 15:53               ` Johannes Berg
2010-11-30 16:34                 ` Johannes Stezenbach
2010-11-30 16:35                   ` Johannes Berg
2010-11-30 18:38                     ` John W. Linville

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=20101129155126.GA32482@sig21.net \
    --to=js@sig21.net \
    --cc=IvDoorn@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).