From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: Jan Scholz <scholz@fias.uni-frankfurt.de>,
linux-wireless <linux-wireless@vger.kernel.org>,
Bob Copeland <bcopeland@gmail.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Tomas Janousek <tomi@nomi.cz>
Subject: [PATCH 2.6.31] mac80211: fix suspend
Date: Tue, 28 Jul 2009 18:10:17 +0200 [thread overview]
Message-ID: <1248797417.13742.0.camel@johannes.local> (raw)
Jan reported that his b43-based laptop hangs during suspend.
The problem turned out to be mac80211 asking the driver to
stop the hardware before removing interfaces, and interface
removal caused b43 to touch the hardware (while down, which
causes the hang).
This patch fixes mac80211 to do reorder these operations to
have them in the correct order -- first remove interfaces
and then stop the hardware. Some more code is necessary to
be able to do so in a race-free manner, in particular it is
necessary to not process frames received during quiescing.
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13337.
Reported-by: Jan Scholz <scholz@fias.uni-frankfurt.de>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/pm.c | 24 +++++++++++++++---------
net/mac80211/rx.c | 12 ++++++++++++
2 files changed, 27 insertions(+), 9 deletions(-)
--- wireless-testing.orig/net/mac80211/pm.c 2009-07-28 17:58:11.000000000 +0200
+++ wireless-testing/net/mac80211/pm.c 2009-07-28 18:06:25.000000000 +0200
@@ -54,15 +54,6 @@ int __ieee80211_suspend(struct ieee80211
rcu_read_unlock();
- /* flush again, in case driver queued work */
- flush_workqueue(local->hw.workqueue);
-
- /* stop hardware - this must stop RX */
- if (local->open_count) {
- ieee80211_led_radio(local, false);
- drv_stop(local);
- }
-
/* remove STAs */
spin_lock_bh(&local->sta_lock);
list_for_each_entry(sta, &local->sta_list, list) {
@@ -110,7 +101,22 @@ int __ieee80211_suspend(struct ieee80211
drv_remove_interface(local, &conf);
}
+ /* stop hardware - this must stop RX */
+ if (local->open_count) {
+ ieee80211_led_radio(local, false);
+ drv_stop(local);
+ }
+
+ /*
+ * flush again, in case driver queued work -- it
+ * shouldn't be doing (or cancel everything in the
+ * stop callback) that but better safe than sorry.
+ */
+ flush_workqueue(local->hw.workqueue);
+
local->suspended = true;
+ /* need suspended to be visible before quiescing is false */
+ barrier();
local->quiescing = false;
return 0;
--- wireless-testing.orig/net/mac80211/rx.c 2009-07-28 17:58:52.000000000 +0200
+++ wireless-testing/net/mac80211/rx.c 2009-07-28 18:04:24.000000000 +0200
@@ -2441,6 +2441,18 @@ void __ieee80211_rx(struct ieee80211_hw
return;
}
+ /*
+ * If we're suspending, it is possible although not too likely
+ * that we'd be receiving frames after having already partially
+ * quiesced the stack. We can't process such frames then since
+ * that might, for example, cause stations to be added or other
+ * driver callbacks be invoked.
+ */
+ if (unlikely(local->quiescing || local->suspended)) {
+ kfree_skb(skb);
+ return;
+ }
+
if (status->flag & RX_FLAG_HT) {
/* rate_idx is MCS index */
if (WARN_ON(status->rate_idx < 0 ||
next reply other threads:[~2009-07-28 16:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200907282315.54085.rjw@sisk.pl>
2009-07-28 16:10 ` Johannes Berg [this message]
2009-07-28 23:51 ` [PATCH 2.6.31] mac80211: fix suspend Jan Scholz
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=1248797417.13742.0.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=bcopeland@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rjw@sisk.pl \
--cc=scholz@fias.uni-frankfurt.de \
--cc=tomi@nomi.cz \
/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