Skip to contentSkip to conversation

mac80211: avoid calling ieee80211_work_work unconditionally

PATCH In review Herton Ronaldo Krzesinski 3 participants 4 messages Dec 13, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: avoid calling ieee80211_work_work unconditionally

On suspend, there might be usb wireless drivers which wrongly trigger the warning in ieee80211_work_work. If an usb driver doesn't have a suspend hook, the usb stack will disconnect the device. On disconnect, a mac80211 driver calls ieee80211_unregister_hw, which calls dev_close, which calls ieee80211_stop, and in the end calls ieee80211_work_purge-> ieee80211_work_work.

The problem is that this call to ieee80211_work_purge comes after mac80211 is suspended, triggering the warning even when we don't have work queued in work_list (the expected case when already suspended), because it always calls ieee80211_work_work.

So, just call ieee80211_work_work in ieee80211_work_purge if we really have to abort work. This addresses the warning reported at
https://bugzilla.kernel.org/show_bug.cgi?id=24402

---
 net/mac80211/work.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/mac80211/work.c +4 -1
index de43753..36305e0 100644
@@ -1074,11 +1074,13 @@ void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_work *wk;
+	bool cleanup = false;
 
 	mutex_lock(&local->mtx);
 	list_for_each_entry(wk, &local->work_list, list) {
 		if (wk->sdata != sdata)
 			continue;
+		cleanup = true;
 		wk->type = IEEE80211_WORK_ABORT;
 		wk->started = true;
 		wk->timeout = jiffies;
@@ -1086,7 +1088,8 @@ void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata)
 	mutex_unlock(&local->mtx);
 
 	/* run cleanups etc. */
-	ieee80211_work_work(&local->work_work);
+	if (cleanup)
+		ieee80211_work_work(&local->work_work);
 
 	mutex_lock(&local->mtx);
 	list_for_each_entry(wk, &local->work_list, list) {
Signature · 1 line
1.7.3.3
#1 lore raw
Quoted 12 lines · Herton Ronaldo Krzesinski

On suspend, there might be usb wireless drivers which wrongly trigger the warning in ieee80211_work_work. If an usb driver doesn't have a suspend hook, the usb stack will disconnect the device. On disconnect, a mac80211 driver calls ieee80211_unregister_hw, which calls dev_close, which calls ieee80211_stop, and in the end calls ieee80211_work_purge-> ieee80211_work_work.

The problem is that this call to ieee80211_work_purge comes after mac80211 is suspended, triggering the warning even when we don't have work queued in work_list (the expected case when already suspended), because it always calls ieee80211_work_work.

Quoted 5 lines

So, just call ieee80211_work_work in ieee80211_work_purge if we really have to abort work. This addresses the warning reported at
https://bugzilla.kernel.org/show_bug.cgi?id=24402

Luis

maintainer
#2 lore raw
Quoted 14 lines · Luis R. Rodriguez
Quoted 12 lines · Herton Ronaldo Krzesinski

On suspend, there might be usb wireless drivers which wrongly trigger the warning in ieee80211_work_work. If an usb driver doesn't have a suspend hook, the usb stack will disconnect the device. On disconnect, a mac80211 driver calls ieee80211_unregister_hw, which calls dev_close, which calls ieee80211_stop, and in the end calls ieee80211_work_purge-> ieee80211_work_work.

The problem is that this call to ieee80211_work_purge comes after mac80211 is suspended, triggering the warning even when we don't have work queued in work_list (the expected case when already suspended), because it always calls ieee80211_work_work.

Quoted 7 lines
Quoted 5 lines

So, just call ieee80211_work_work in ieee80211_work_purge if we really have to abort work. This addresses the warning reported at
https://bugzilla.kernel.org/show_bug.cgi?id=24402

It's just a warning, do we really want to bother?

johannes

#3 lore raw
Quoted 19 lines · Johannes Berg
Quoted 18 lines · Luis R. Rodriguez
Quoted 16 lines · Herton Ronaldo Krzesinski

On suspend, there might be usb wireless drivers which wrongly trigger the warning in ieee80211_work_work. If an usb driver doesn't have a suspend hook, the usb stack will disconnect the device. On disconnect, a mac80211 driver calls ieee80211_unregister_hw, which calls dev_close, which calls ieee80211_stop, and in the end calls ieee80211_work_purge-> ieee80211_work_work.

The problem is that this call to ieee80211_work_purge comes after mac80211 is suspended, triggering the warning even when we don't have work queued in work_list (the expected case when already suspended), because it always calls ieee80211_work_work.

So, just call ieee80211_work_work in ieee80211_work_purge if we really have to abort work. This addresses the warning reported at
https://bugzilla.kernel.org/show_bug.cgi?id=24402

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

It's just a warning, do we really want to bother?

Why not, it pollutes logs.

Luis