* [PATCH] mac80211: Add RTNL warning for workqueue
@ 2008-06-24 17:23 Ivo van Doorn
2008-06-24 17:28 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Ivo van Doorn @ 2008-06-24 17:23 UTC (permalink / raw)
To: John Linville; +Cc: Johannes Berg, linux-wireless
The workqueue provided by mac80211 should not be used for
scheduled tasks that acquire the RTNL lock. This could be done
when the driver uses the function ieee80211_iterate_active_interfaces()
within the scheduled work. Such behavior will end in locking
dependencies problems when an interface is being removed.
This patch will add a notification about the RTNL locking and
the mac80211 workqueue to prevent driver developers from
blindly using it.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
---
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 19f1e41..02c79e6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -738,8 +738,11 @@ enum ieee80211_hw_flags {
* @conf: &struct ieee80211_conf, device configuration, don't use.
*
* @workqueue: single threaded workqueue available for driver use,
- * allocated by mac80211 on registration and flushed on
- * unregistration.
+ * allocated by mac80211 on registration and flushed when an
+ * interface is removed.
+ * NOTICE: All work performed on this workqueue should NEVER
+ * acquire the RTNL lock (i.e. Don't use the function
+ * ieee80211_iterate_active_interfaces())
*
* @priv: pointer to private area that was allocated for driver use
* along with this structure.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Add RTNL warning for workqueue
2008-06-24 17:23 [PATCH] mac80211: Add RTNL warning for workqueue Ivo van Doorn
@ 2008-06-24 17:28 ` Johannes Berg
2008-06-24 17:30 ` Johannes Berg
2008-06-24 17:32 ` Ivo van Doorn
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Berg @ 2008-06-24 17:28 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]
On Tue, 2008-06-24 at 19:23 +0200, Ivo van Doorn wrote:
> The workqueue provided by mac80211 should not be used for
> scheduled tasks that acquire the RTNL lock. This could be done
> when the driver uses the function ieee80211_iterate_active_interfaces()
> within the scheduled work. Such behavior will end in locking
> dependencies problems when an interface is being removed.
>
> This patch will add a notification about the RTNL locking and
> the mac80211 workqueue to prevent driver developers from
> blindly using it.
>
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> ---
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index 19f1e41..02c79e6 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -738,8 +738,11 @@ enum ieee80211_hw_flags {
> * @conf: &struct ieee80211_conf, device configuration, don't use.
> *
> * @workqueue: single threaded workqueue available for driver use,
> - * allocated by mac80211 on registration and flushed on
> - * unregistration.
> + * allocated by mac80211 on registration and flushed when an
> + * interface is removed.
Interesting point. Should it be there or rather be moved down a bit so
that it is actually only flushed when _all_ interfaces are stopped, i.e.
before ->stop is invoked?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Add RTNL warning for workqueue
2008-06-24 17:28 ` Johannes Berg
@ 2008-06-24 17:30 ` Johannes Berg
2008-06-24 17:32 ` Ivo van Doorn
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-06-24 17:30 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]
On Tue, 2008-06-24 at 19:28 +0200, Johannes Berg wrote:
> On Tue, 2008-06-24 at 19:23 +0200, Ivo van Doorn wrote:
> > The workqueue provided by mac80211 should not be used for
> > scheduled tasks that acquire the RTNL lock. This could be done
> > when the driver uses the function ieee80211_iterate_active_interfaces()
> > within the scheduled work. Such behavior will end in locking
> > dependencies problems when an interface is being removed.
> >
> > This patch will add a notification about the RTNL locking and
> > the mac80211 workqueue to prevent driver developers from
> > blindly using it.
> >
> > Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> Interesting point. Should it be there or rather be moved down a bit so
> that it is actually only flushed when _all_ interfaces are stopped, i.e.
> before ->stop is invoked?
Either way though, the patch is obviously correct and a follow-up patch
can change the behaviour if we want that, so for this one:
Acked-by: Johannes Berg <johannes@sipsolutions.net>
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Add RTNL warning for workqueue
2008-06-24 17:28 ` Johannes Berg
2008-06-24 17:30 ` Johannes Berg
@ 2008-06-24 17:32 ` Ivo van Doorn
1 sibling, 0 replies; 4+ messages in thread
From: Ivo van Doorn @ 2008-06-24 17:32 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
On Tuesday 24 June 2008, Johannes Berg wrote:
> On Tue, 2008-06-24 at 19:23 +0200, Ivo van Doorn wrote:
> > The workqueue provided by mac80211 should not be used for
> > scheduled tasks that acquire the RTNL lock. This could be done
> > when the driver uses the function ieee80211_iterate_active_interfaces()
> > within the scheduled work. Such behavior will end in locking
> > dependencies problems when an interface is being removed.
> >
> > This patch will add a notification about the RTNL locking and
> > the mac80211 workqueue to prevent driver developers from
> > blindly using it.
> >
> > Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > ---
> > diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> > index 19f1e41..02c79e6 100644
> > --- a/include/net/mac80211.h
> > +++ b/include/net/mac80211.h
> > @@ -738,8 +738,11 @@ enum ieee80211_hw_flags {
> > * @conf: &struct ieee80211_conf, device configuration, don't use.
> > *
> > * @workqueue: single threaded workqueue available for driver use,
> > - * allocated by mac80211 on registration and flushed on
> > - * unregistration.
> > + * allocated by mac80211 on registration and flushed when an
> > + * interface is removed.
>
> Interesting point. Should it be there or rather be moved down a bit so
> that it is actually only flushed when _all_ interfaces are stopped, i.e.
> before ->stop is invoked?
Personally I think it makes most sense when all interfaces are gone,
and thus either before or after ->stop(). But I am not sure which
drivers currently rely on the current position of flush_workqueue().
Ivo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-24 17:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 17:23 [PATCH] mac80211: Add RTNL warning for workqueue Ivo van Doorn
2008-06-24 17:28 ` Johannes Berg
2008-06-24 17:30 ` Johannes Berg
2008-06-24 17:32 ` Ivo van Doorn
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).