All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] mac80211: Fix possible race between sta_unblock and network softirq
@ 2012-01-16 15:42 Helmut Schaa
  2012-01-16 16:51 ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Helmut Schaa @ 2012-01-16 15:42 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Helmut Schaa


Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---

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(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 24d321f..5b4ab21 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -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();
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC] mac80211: Fix possible race between sta_unblock and network softirq
  2012-01-16 15:42 [RFC] mac80211: Fix possible race between sta_unblock and network softirq Helmut Schaa
@ 2012-01-16 16:51 ` Johannes Berg
  2012-01-16 19:22   ` Helmut Schaa
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-01-16 16:51 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless

On Mon, 2012-01-16 at 16:42 +0100, Helmut Schaa wrote:
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> ---
> 
> 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?

This seems right -- not sure where the lockup would be though.

johannes

> Thanks,
> Helmut
> 
>  net/mac80211/sta_info.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
> index 24d321f..5b4ab21 100644
> --- a/net/mac80211/sta_info.c
> +++ b/net/mac80211/sta_info.c
> @@ -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();



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [RFC] mac80211: Fix possible race between sta_unblock and network softirq
  2012-01-16 16:51 ` Johannes Berg
@ 2012-01-16 19:22   ` Helmut Schaa
  2012-01-16 19:25     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Helmut Schaa @ 2012-01-16 19:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
> On Mon, 2012-01-16 at 16:42 +0100, Helmut Schaa wrote:
> > Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> > ---
> > 
> > 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?
> 
> This seems right

The patch or the current approach without disable_bh?

> -- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [RFC] mac80211: Fix possible race between sta_unblock and network softirq
  2012-01-16 19:22   ` Helmut Schaa
@ 2012-01-16 19:25     ` Johannes Berg
  2012-01-16 19:32       ` Helmut Schaa
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-01-16 19:25 UTC (permalink / raw)
  To: Helmut Schaa; +Cc: linux-wireless

On Mon, 2012-01-16 at 20:22 +0100, Helmut Schaa wrote:
> Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
> > On Mon, 2012-01-16 at 16:42 +0100, Helmut Schaa wrote:
> > > Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> > > ---
> > > 
> > > 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?
> > 
> > This seems right
> 
> The patch or the current approach without disable_bh?

The patch.

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: Re: [RFC] mac80211: Fix possible race between sta_unblock and network softirq
  2012-01-16 19:25     ` Johannes Berg
@ 2012-01-16 19:32       ` Helmut Schaa
  0 siblings, 0 replies; 5+ messages in thread
From: Helmut Schaa @ 2012-01-16 19:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Am Montag, 16. Januar 2012, 20:25:14 schrieb Johannes Berg:
> On Mon, 2012-01-16 at 20:22 +0100, Helmut Schaa wrote:
> > Am Montag, 16. Januar 2012, 17:51:33 schrieb Johannes Berg:
> > > On Mon, 2012-01-16 at 16:42 +0100, Helmut Schaa wrote:
> > > > Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> > > > ---
> > > > 
> > > > 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?
> > > 
> > > This seems right
> > 
> > The patch or the current approach without disable_bh?
> 
> The patch.

Thanks :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-16 19:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16 15:42 [RFC] mac80211: Fix possible race between sta_unblock and network softirq Helmut Schaa
2012-01-16 16:51 ` Johannes Berg
2012-01-16 19:22   ` Helmut Schaa
2012-01-16 19:25     ` Johannes Berg
2012-01-16 19:32       ` Helmut Schaa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.