* [PATCH] mac80211: Properly kill tasklets before shutdown
@ 2007-03-06 18:01 Michael Buesch
2007-03-08 1:26 ` Johannes Berg
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Michael Buesch @ 2007-03-06 18:01 UTC (permalink / raw)
To: Jiri Benc; +Cc: John Linville, linux-wireless, Johannes Berg
We need to do tasklet_kill() on any tasklet on unregister
to make sure the tasklet is not running _and_ scheduled anymore.
(tasklet_disable() only ensures it's not running anymore).
This fixes the tasklet related crash that was reported some time ago.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Index: bu3sch-wireless-dev/net/mac80211/ieee80211.c
===================================================================
--- bu3sch-wireless-dev.orig/net/mac80211/ieee80211.c 2007-03-06 15:55:53.000000000 +0100
+++ bu3sch-wireless-dev/net/mac80211/ieee80211.c 2007-03-06 15:58:10.000000000 +0100
@@ -4761,8 +4761,8 @@
struct ieee80211_sub_if_data *sdata, *tmp;
int i;
- tasklet_disable(&local->tasklet);
- /* TODO: skb_queue should be empty here, no need to do anything? */
+ tasklet_kill(&local->tx_pending_tasklet);
+ tasklet_kill(&local->tasklet);
rtnl_lock();
local->reg_state = IEEE80211_DEV_UNREGISTERED;
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-06 18:01 [PATCH] mac80211: Properly kill tasklets before shutdown Michael Buesch
@ 2007-03-08 1:26 ` Johannes Berg
2007-03-08 15:39 ` Michael Buesch
2007-03-16 18:22 ` Michael Buesch
2007-03-23 17:17 ` Jiri Benc
2 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2007-03-08 1:26 UTC (permalink / raw)
To: Michael Buesch; +Cc: Jiri Benc, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 596 bytes --]
On Tue, 2007-03-06 at 19:01 +0100, Michael Buesch wrote:
> This fixes the tasklet related crash that was reported some time ago.
I agree with that :)
> - tasklet_disable(&local->tasklet);
> - /* TODO: skb_queue should be empty here, no need to do anything? */
> + tasklet_kill(&local->tx_pending_tasklet);
> + tasklet_kill(&local->tasklet);
But I'm not sure this is sufficient. I think we can then leak pending
skbs. In my tests I've often gotten that warning message about the skb
queue not being empty (right before the crash). Or is that handled
elsewhere now?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-08 1:26 ` Johannes Berg
@ 2007-03-08 15:39 ` Michael Buesch
2007-03-08 15:43 ` Johannes Berg
0 siblings, 1 reply; 10+ messages in thread
From: Michael Buesch @ 2007-03-08 15:39 UTC (permalink / raw)
To: Johannes Berg; +Cc: Jiri Benc, John Linville, linux-wireless
On Thursday 08 March 2007 02:26, Johannes Berg wrote:
> On Tue, 2007-03-06 at 19:01 +0100, Michael Buesch wrote:
>
> > This fixes the tasklet related crash that was reported some time ago.
>
> I agree with that :)
>
> > - tasklet_disable(&local->tasklet);
> > - /* TODO: skb_queue should be empty here, no need to do anything? */
> > + tasklet_kill(&local->tx_pending_tasklet);
> > + tasklet_kill(&local->tasklet);
>
> But I'm not sure this is sufficient. I think we can then leak pending
> skbs.
I don't think so. tasklet_kill does actually waiting, not killing.
It waits until the (maybe) scheduled tasklet did run and then waits
for it to finish running.
It doesn't rip off a scheduled tasklet without letting it run.
> In my tests I've often gotten that warning message about the skb
> queue not being empty (right before the crash). Or is that handled
> elsewhere now?
Uh, didn't get that. The assertion for this is in the same function
some lines down.
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-08 15:39 ` Michael Buesch
@ 2007-03-08 15:43 ` Johannes Berg
0 siblings, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2007-03-08 15:43 UTC (permalink / raw)
To: Michael Buesch; +Cc: Jiri Benc, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
On Thu, 2007-03-08 at 16:39 +0100, Michael Buesch wrote:
> I don't think so. tasklet_kill does actually waiting, not killing.
> It waits until the (maybe) scheduled tasklet did run and then waits
> for it to finish running.
> It doesn't rip off a scheduled tasklet without letting it run.
Ah ok.
> Uh, didn't get that. The assertion for this is in the same function
> some lines down.
I used to get that but probably using tasklet_kill for that tasklet
fixes this then.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-06 18:01 [PATCH] mac80211: Properly kill tasklets before shutdown Michael Buesch
2007-03-08 1:26 ` Johannes Berg
@ 2007-03-16 18:22 ` Michael Buesch
2007-03-23 17:17 ` Jiri Benc
2 siblings, 0 replies; 10+ messages in thread
From: Michael Buesch @ 2007-03-16 18:22 UTC (permalink / raw)
To: Jiri Benc; +Cc: John Linville, linux-wireless, Johannes Berg
Just want to make sure this crash fix patch is not lost,
as I didn't see it showing up in some git tree, yet.
On Tuesday 06 March 2007 19:01, Michael Buesch wrote:
> We need to do tasklet_kill() on any tasklet on unregister
> to make sure the tasklet is not running _and_ scheduled anymore.
> (tasklet_disable() only ensures it's not running anymore).
>
> This fixes the tasklet related crash that was reported some time ago.
>
> Signed-off-by: Michael Buesch <mb@bu3sch.de>
>
> Index: bu3sch-wireless-dev/net/mac80211/ieee80211.c
> ===================================================================
> --- bu3sch-wireless-dev.orig/net/mac80211/ieee80211.c 2007-03-06 15:55:53.000000000 +0100
> +++ bu3sch-wireless-dev/net/mac80211/ieee80211.c 2007-03-06 15:58:10.000000000 +0100
> @@ -4761,8 +4761,8 @@
> struct ieee80211_sub_if_data *sdata, *tmp;
> int i;
>
> - tasklet_disable(&local->tasklet);
> - /* TODO: skb_queue should be empty here, no need to do anything? */
> + tasklet_kill(&local->tx_pending_tasklet);
> + tasklet_kill(&local->tasklet);
>
> rtnl_lock();
> local->reg_state = IEEE80211_DEV_UNREGISTERED;
>
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-06 18:01 [PATCH] mac80211: Properly kill tasklets before shutdown Michael Buesch
2007-03-08 1:26 ` Johannes Berg
2007-03-16 18:22 ` Michael Buesch
@ 2007-03-23 17:17 ` Jiri Benc
2007-03-23 17:22 ` Michael Buesch
2 siblings, 1 reply; 10+ messages in thread
From: Jiri Benc @ 2007-03-23 17:17 UTC (permalink / raw)
To: Michael Buesch; +Cc: John Linville, linux-wireless, Johannes Berg
On Tue, 6 Mar 2007 19:01:59 +0100, Michael Buesch wrote:
> We need to do tasklet_kill() on any tasklet on unregister
> to make sure the tasklet is not running _and_ scheduled anymore.
> (tasklet_disable() only ensures it's not running anymore).
>
> This fixes the tasklet related crash that was reported some time ago.
>
> Signed-off-by: Michael Buesch <mb@bu3sch.de>
>
> Index: bu3sch-wireless-dev/net/mac80211/ieee80211.c
> ===================================================================
> --- bu3sch-wireless-dev.orig/net/mac80211/ieee80211.c 2007-03-06 15:55:53.000000000 +0100
> +++ bu3sch-wireless-dev/net/mac80211/ieee80211.c 2007-03-06 15:58:10.000000000 +0100
> @@ -4761,8 +4761,8 @@
> struct ieee80211_sub_if_data *sdata, *tmp;
> int i;
>
> - tasklet_disable(&local->tasklet);
I think this tasklet_disable should not be removed.
> - /* TODO: skb_queue should be empty here, no need to do anything? */
> + tasklet_kill(&local->tx_pending_tasklet);
> + tasklet_kill(&local->tasklet);
>
> rtnl_lock();
> local->reg_state = IEEE80211_DEV_UNREGISTERED;
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-23 17:17 ` Jiri Benc
@ 2007-03-23 17:22 ` Michael Buesch
2007-03-23 17:32 ` Jiri Benc
0 siblings, 1 reply; 10+ messages in thread
From: Michael Buesch @ 2007-03-23 17:22 UTC (permalink / raw)
To: Jiri Benc; +Cc: John Linville, linux-wireless, Johannes Berg
On Friday 23 March 2007 18:17, Jiri Benc wrote:
> On Tue, 6 Mar 2007 19:01:59 +0100, Michael Buesch wrote:
> > We need to do tasklet_kill() on any tasklet on unregister
> > to make sure the tasklet is not running _and_ scheduled anymore.
> > (tasklet_disable() only ensures it's not running anymore).
> >
> > This fixes the tasklet related crash that was reported some time ago.
> >
> > Signed-off-by: Michael Buesch <mb@bu3sch.de>
> >
> > Index: bu3sch-wireless-dev/net/mac80211/ieee80211.c
> > ===================================================================
> > --- bu3sch-wireless-dev.orig/net/mac80211/ieee80211.c 2007-03-06 15:55:53.000000000 +0100
> > +++ bu3sch-wireless-dev/net/mac80211/ieee80211.c 2007-03-06 15:58:10.000000000 +0100
> > @@ -4761,8 +4761,8 @@
> > struct ieee80211_sub_if_data *sdata, *tmp;
> > int i;
> >
> > - tasklet_disable(&local->tasklet);
>
> I think this tasklet_disable should not be removed.
Why?...
> > - /* TODO: skb_queue should be empty here, no need to do anything? */
> > + tasklet_kill(&local->tx_pending_tasklet);
> > + tasklet_kill(&local->tasklet);
...We kill it here.
kill == (make sure it's not scheduled anymore) && disable
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-23 17:22 ` Michael Buesch
@ 2007-03-23 17:32 ` Jiri Benc
2007-03-23 18:36 ` Michael Buesch
0 siblings, 1 reply; 10+ messages in thread
From: Jiri Benc @ 2007-03-23 17:32 UTC (permalink / raw)
To: Michael Buesch; +Cc: John Linville, linux-wireless, Johannes Berg
On Fri, 23 Mar 2007 18:22:50 +0100, Michael Buesch wrote:
> kill == (make sure it's not scheduled anymore) && disable
Are you sure? I cannot find anything in tasklet_kill which disables the
tasklet.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-23 17:32 ` Jiri Benc
@ 2007-03-23 18:36 ` Michael Buesch
2007-03-23 20:16 ` Jiri Benc
0 siblings, 1 reply; 10+ messages in thread
From: Michael Buesch @ 2007-03-23 18:36 UTC (permalink / raw)
To: Jiri Benc; +Cc: John Linville, linux-wireless, Johannes Berg
On Friday 23 March 2007 18:32, Jiri Benc wrote:
> On Fri, 23 Mar 2007 18:22:50 +0100, Michael Buesch wrote:
> > kill == (make sure it's not scheduled anymore) && disable
>
> Are you sure? I cannot find anything in tasklet_kill which disables the
> tasklet.
It doesn't bounce the count, but it waits for the tasklet to finish
and makes sure it's not scheduled anymore.
Why do you want to inc the count? There is no point in that.
disable does: Wait for it to finish running && inc the count
kill does: make sure it's not scheduled, wait for it to finish.
Why disable it? If there's anything scheduling the tasklet while
we have unregistered we _want_ it to crash, as that's a real bug
in the first place. (And I don't think it's possible to
schedule it after unregister).
--
Greetings Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] mac80211: Properly kill tasklets before shutdown
2007-03-23 18:36 ` Michael Buesch
@ 2007-03-23 20:16 ` Jiri Benc
0 siblings, 0 replies; 10+ messages in thread
From: Jiri Benc @ 2007-03-23 20:16 UTC (permalink / raw)
To: Michael Buesch; +Cc: John Linville, linux-wireless, Johannes Berg
On Fri, 23 Mar 2007 19:36:42 +0100, Michael Buesch wrote:
> Why disable it? If there's anything scheduling the tasklet while
> we have unregistered we _want_ it to crash, as that's a real bug
> in the first place. (And I don't think it's possible to
> schedule it after unregister).
Hm, yes, sorry. Applied.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-03-23 20:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 18:01 [PATCH] mac80211: Properly kill tasklets before shutdown Michael Buesch
2007-03-08 1:26 ` Johannes Berg
2007-03-08 15:39 ` Michael Buesch
2007-03-08 15:43 ` Johannes Berg
2007-03-16 18:22 ` Michael Buesch
2007-03-23 17:17 ` Jiri Benc
2007-03-23 17:22 ` Michael Buesch
2007-03-23 17:32 ` Jiri Benc
2007-03-23 18:36 ` Michael Buesch
2007-03-23 20:16 ` Jiri Benc
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).