* [PATCH] mac80211: use synchronize_rcu() with rcu_barrier()
@ 2013-04-18 22:04 Bob Copeland
2013-04-18 22:20 ` Paul E. McKenney
2013-04-18 22:26 ` [PATCH v2] " Bob Copeland
0 siblings, 2 replies; 4+ messages in thread
From: Bob Copeland @ 2013-04-18 22:04 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, paulmck
The RCU docs used to state that rcu_barrier() included a wait
for an RCU grace period; however the comments for rcu_barrier()
as of commit f0a0e6f... "rcu: Clarify memory-ordering properties
of grace-period primitives" contradict this.
So add back synchronize_{rcu,net}() to where they once were,
but keep the rcu_barrier()s for the call_rcu() callbacks.
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bob Copeland <bob@cozybit.com>
---
net/mac80211/iface.c | 5 +++--
net/mac80211/pm.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b6abaaa..c634aff 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -836,11 +836,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
*
* sta_info_flush_cleanup() requires rcu_barrier()
* first to wait for the station call_rcu() calls
- * to complete, here we need at least sychronize_rcu()
- * it to wait for the RX path in case it is using the
+ * to complete, and we also need synchronize_rcu()
+ * to wait for the RX path in case it is using the
* interface and enqueuing frames at this very time on
* another CPU.
*/
+ synchronize_rcu();
rcu_barrier();
sta_info_flush_cleanup(sdata);
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 4431f0f..7fc5d0d 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -38,6 +38,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
IEEE80211_QUEUE_STOP_REASON_SUSPEND);
/* flush out all packets and station cleanup call_rcu()s */
+ synchronize_net();
rcu_barrier();
ieee80211_flush_queues(local, NULL);
--
1.7.10.4
--
Bob Copeland %% www.bobcopeland.com
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: use synchronize_rcu() with rcu_barrier()
2013-04-18 22:04 [PATCH] mac80211: use synchronize_rcu() with rcu_barrier() Bob Copeland
@ 2013-04-18 22:20 ` Paul E. McKenney
2013-04-18 22:26 ` [PATCH v2] " Bob Copeland
1 sibling, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2013-04-18 22:20 UTC (permalink / raw)
To: Bob Copeland; +Cc: johannes, linux-wireless
On Thu, Apr 18, 2013 at 06:04:43PM -0400, Bob Copeland wrote:
> The RCU docs used to state that rcu_barrier() included a wait
> for an RCU grace period; however the comments for rcu_barrier()
> as of commit f0a0e6f... "rcu: Clarify memory-ordering properties
> of grace-period primitives" contradict this.
>
> So add back synchronize_{rcu,net}() to where they once were,
> but keep the rcu_barrier()s for the call_rcu() callbacks.
>
> Cc: stable <stable@vger.kernel.org>
> Signed-off-by: Bob Copeland <bob@cozybit.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> net/mac80211/iface.c | 5 +++--
> net/mac80211/pm.c | 1 +
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index b6abaaa..c634aff 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -836,11 +836,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
> *
> * sta_info_flush_cleanup() requires rcu_barrier()
> * first to wait for the station call_rcu() calls
> - * to complete, here we need at least sychronize_rcu()
> - * it to wait for the RX path in case it is using the
> + * to complete, and we also need synchronize_rcu()
> + * to wait for the RX path in case it is using the
> * interface and enqueuing frames at this very time on
> * another CPU.
> */
> + synchronize_rcu();
> rcu_barrier();
> sta_info_flush_cleanup(sdata);
>
> diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
> index 4431f0f..7fc5d0d 100644
> --- a/net/mac80211/pm.c
> +++ b/net/mac80211/pm.c
> @@ -38,6 +38,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
> IEEE80211_QUEUE_STOP_REASON_SUSPEND);
>
> /* flush out all packets and station cleanup call_rcu()s */
> + synchronize_net();
> rcu_barrier();
>
> ieee80211_flush_queues(local, NULL);
> --
> 1.7.10.4
>
> --
> Bob Copeland %% www.bobcopeland.com
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] mac80211: use synchronize_rcu() with rcu_barrier()
2013-04-18 22:04 [PATCH] mac80211: use synchronize_rcu() with rcu_barrier() Bob Copeland
2013-04-18 22:20 ` Paul E. McKenney
@ 2013-04-18 22:26 ` Bob Copeland
2013-04-22 13:41 ` Johannes Berg
1 sibling, 1 reply; 4+ messages in thread
From: Bob Copeland @ 2013-04-18 22:26 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, paulmck
The RCU docs used to state that rcu_barrier() included a wait
for an RCU grace period; however the comments for rcu_barrier()
as of commit f0a0e6f... "rcu: Clarify memory-ordering properties
of grace-period primitives" contradict this.
So add back synchronize_{rcu,net}() to where they once were,
but keep the rcu_barrier()s for the call_rcu() callbacks.
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bob Copeland <bob@cozybit.com>
---
v2: also in cfg.c
net/mac80211/cfg.c | 1 +
net/mac80211/iface.c | 5 +++--
net/mac80211/pm.c | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 72ab1c0..dcffca4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1043,6 +1043,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
sta_info_flush_defer(vlan);
sta_info_flush_defer(sdata);
+ synchronize_net();
rcu_barrier();
list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
sta_info_flush_cleanup(vlan);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index b6abaaa..c634aff 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -836,11 +836,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
*
* sta_info_flush_cleanup() requires rcu_barrier()
* first to wait for the station call_rcu() calls
- * to complete, here we need at least sychronize_rcu()
- * it to wait for the RX path in case it is using the
+ * to complete, and we also need synchronize_rcu()
+ * to wait for the RX path in case it is using the
* interface and enqueuing frames at this very time on
* another CPU.
*/
+ synchronize_rcu();
rcu_barrier();
sta_info_flush_cleanup(sdata);
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 4431f0f..7fc5d0d 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -38,6 +38,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
IEEE80211_QUEUE_STOP_REASON_SUSPEND);
/* flush out all packets and station cleanup call_rcu()s */
+ synchronize_net();
rcu_barrier();
ieee80211_flush_queues(local, NULL);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mac80211: use synchronize_rcu() with rcu_barrier()
2013-04-18 22:26 ` [PATCH v2] " Bob Copeland
@ 2013-04-22 13:41 ` Johannes Berg
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2013-04-22 13:41 UTC (permalink / raw)
To: Bob Copeland; +Cc: linux-wireless, paulmck
On Thu, 2013-04-18 at 18:26 -0400, Bob Copeland wrote:
> The RCU docs used to state that rcu_barrier() included a wait
> for an RCU grace period; however the comments for rcu_barrier()
> as of commit f0a0e6f... "rcu: Clarify memory-ordering properties
> of grace-period primitives" contradict this.
>
> So add back synchronize_{rcu,net}() to where they once were,
> but keep the rcu_barrier()s for the call_rcu() callbacks.
Applied, thanks for spotting this!
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-22 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 22:04 [PATCH] mac80211: use synchronize_rcu() with rcu_barrier() Bob Copeland
2013-04-18 22:20 ` Paul E. McKenney
2013-04-18 22:26 ` [PATCH v2] " Bob Copeland
2013-04-22 13:41 ` Johannes Berg
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).