mac80211: Fix possible race between sta_unblock and network softirq
RFC 1/1 mac80211: Fix possible race between sta_unblock and network softirq
---
I'm currently writing some code for rt2800 that requires the driver to stop sending to a specific station for a short period of time (until all AMPDUs are finished to work around a hw issue that affects rate sampling with minstrel_ht). I decided to give ieee80211_sta_block_awake a try, however, the machine sometimes locked up while running some performance tests but due to a hw watchdog I wasn't able to get any sort of backtrace :(
So, while doing some review of the ieee80211_sta_block_awake I came across this and wondered if softirqs should be disabled when delivering the buffered frames in sta_unblock.
Using this patch I cannot reproduce the lockup anymore.
So, is there any special reason this single code path in sta_unblock doesn't disable softirqs?
Thanks,
Helmut
net/mac80211/sta_info.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
net/mac80211/sta_info.c +4 -2
@@ -238,9 +238,11 @@ static void sta_unblock(struct work_struct *wk)if (sta->dead)return ; -if (!test_sta_flag (sta,WLAN_STA_PS_STA )) +if (!test_sta_flag (sta,WLAN_STA_PS_STA )) { +local_bh_disable ();ieee80211_sta_ps_deliver_wakeup (sta); -else if (test_and_clear_sta_flag (sta,WLAN_STA_PSPOLL )) { +local_bh_enable (); + }else if (test_and_clear_sta_flag (sta,WLAN_STA_PSPOLL )) {clear_sta_flag (sta,WLAN_STA_PS_DRIVER );local_bh_disable ();
Signature · 1 line
1.7.7
Johannes Berg
maintainerQuoted 11 lines · Helmut Schaa
Signed-off-by Helmut Schaa <[email protected]>---
I'm currently writing some code for rt2800 that requires the driver to stop sending to a specific station for a short period of time (until all AMPDUs are finished to work around a hw issue that affects rate sampling with
minstrel_ht). I decided to giveieee80211_sta_block_awakea try, however, the machine sometimes locked up while running some performance tests but due to a hw watchdog I wasn't able to get any sort of backtrace :(
Quoted 8 lines
So, while doing some review of the
ieee80211_sta_block_awakeI came across this and wondered if softirqs should be disabled when delivering the buffered frames insta_unblock.Using this patch I cannot reproduce the lockup anymore.
So, is there any special reason this single code path in
sta_unblockdoesn't disable softirqs?
This seems right -- not sure where the lockup would be though.
johannes
Quoted 24 lines
Thanks,
Helmutnet/mac80211/sta_info.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)net/mac80211/sta_info.c +4
-2@@ -238,9 +238,11 @@ static void sta_unblock(struct work_struct *wk)if (sta->dead)return ; -if (!test_sta_flag (sta,WLAN_STA_PS_STA )) +if (!test_sta_flag (sta,WLAN_STA_PS_STA )) { +local_bh_disable ();ieee80211_sta_ps_deliver_wakeup (sta); -else if (test_and_clear_sta_flag (sta,WLAN_STA_PSPOLL )) { +local_bh_enable (); + }else if (test_and_clear_sta_flag (sta,WLAN_STA_PSPOLL )) {clear_sta_flag (sta,WLAN_STA_PS_DRIVER );local_bh_disable ();
Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
Quoted 16 lines · Helmut Schaa
Quoted 15 lines
Signed-off-by Helmut Schaa <[email protected]>---
I'm currently writing some code for rt2800 that requires the driver to stop sending to a specific station for a short period of time (until all AMPDUs are finished to work around a hw issue that affects rate sampling with
minstrel_ht). I decided to giveieee80211_sta_block_awakea try, however, the machine sometimes locked up while running some performance tests but due to a hw watchdog I wasn't able to get any sort of backtrace :(So, while doing some review of the
ieee80211_sta_block_awakeI came across this and wondered if softirqs should be disabled when delivering the buffered frames insta_unblock.
Quoted 6 lines
Quoted 4 lines
Using this patch I cannot reproduce the lockup anymore.
So, is there any special reason this single code path in
sta_unblockdoesn't disable softirqs?This seems right
The patch or the current approach without disable_bh?
Quoted 1 line
-- not sure where the lockup would be though.
Not sure either :( unfortunately I cannot disable the hw watchdog (and that has a timeout of only 2 seconds). Maybe I can reproduce it with a regular rt2800 PCI card ...
Helmut
Johannes Berg
maintainerQuoted 17 lines · Helmut Schaa
Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
Quoted 16 lines · Helmut Schaa
Quoted 15 lines
Signed-off-by Helmut Schaa <[email protected]>---
I'm currently writing some code for rt2800 that requires the driver to stop sending to a specific station for a short period of time (until all AMPDUs are finished to work around a hw issue that affects rate sampling with
minstrel_ht). I decided to giveieee80211_sta_block_awakea try, however, the machine sometimes locked up while running some performance tests but due to a hw watchdog I wasn't able to get any sort of backtrace :(So, while doing some review of the
ieee80211_sta_block_awakeI came across this and wondered if softirqs should be disabled when delivering the buffered frames insta_unblock.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Using this patch I cannot reproduce the lockup anymore.
So, is there any special reason this single code path in
sta_unblockdoesn't disable softirqs?This seems right
The patch or the current approach without
disable_bh?
The patch.
johannes
Am Montag, 16. Januar 2012, 20:25:14 schrieb Johannes Berg:
Quoted 20 lines · Helmut Schaa
Quoted 19 lines
Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
Quoted 18 lines · Helmut Schaa
Quoted 17 lines
Signed-off-by Helmut Schaa <[email protected]>---
I'm currently writing some code for rt2800 that requires the driver to stop sending to a specific station for a short period of time (until all AMPDUs are finished to work around a hw issue that affects rate sampling with
minstrel_ht). I decided to giveieee80211_sta_block_awakea try, however, the machine sometimes locked up while running some performance tests but due to a hw watchdog I wasn't able to get any sort of backtrace :(So, while doing some review of the
ieee80211_sta_block_awakeI came across this and wondered if softirqs should be disabled when delivering the buffered frames insta_unblock.Using this patch I cannot reproduce the lockup anymore.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
So, is there any special reason this single code path in
sta_unblockdoesn't disable softirqs?This seems right
The patch or the current approach without
disable_bh?The patch.
Thanks :)