Skip to contentSkip to conversation

rcu_barrier: Resubmitting the the networking bits

PATCH In review Jesper Dangaard Brouer 2 participants 7 messages Jun 26, 2009

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover rcu_barrier: Resubmitting the the networking bits

(This time I don't use "stg mail --auto" as it does not seem to do appropiate double quoting of mail addresses with a "." char in. Thus hoping vger will not eat my mails again again!)

This patchset is a resubmit of the network related part of a patchseries titled "We must use rcu_barrier() on module unload". Just to make it easier for DaveM to pick it up.

If an unloadable module uses RCU callbacks, it need to use rcu_barrier() so that the module may be safely unloaded.

For documentation see:

Paul E. McKenney's Blog
http://paulmck.livejournal.com/7314.html

http://lwn.net/Articles/217484/

Documentation/RCU/rcubarrier.txt

Patchset is made on top of Linus'es tree, 4075ea8c54a7506844a69f674990241e7766357b. But I have testet is applies to net-next-2.6.

---

Jesper Dangaard Brouer (5):
decnet: Use rcu_barrier() on module unload.
ipv6: Use rcu_barrier() on module unload.
sunrpc: Use rcu_barrier() on unload.
mac80211: Use rcu_barrier() on unload.
bridge: Use rcu_barrier() instead of syncronize_net() on unload.

 net/bridge/br.c          |    2 +-
 net/decnet/af_decnet.c   |    2 ++
 net/ipv6/af_inet6.c      |    2 ++
 net/mac80211/mesh.c      |    2 +-
 net/sunrpc/sunrpc_syms.c |    1 +
 5 files changed, 7 insertions(+), 2 deletions(-)
Signature · 6 lines
Best regards,
  Jesper Brouer
  ComX Networks A/S
  Linux Network developer
  Cand. Scient Datalog / MSc.
  Author of http://adsl-optimizer.dk
#1 lore raw

PATCH 1/5 bridge: Use rcu_barrier() instead of syncronize_net() on unload.

When unloading modules that uses call_rcu() callbacks, then we must use rcu_barrier(). This module uses syncronize_net() which is not enough to be sure that all callback has been completed.

---

 net/bridge/br.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/bridge/br.c +1 -1
index 9aac521..e1241c7 100644
@@ -93,7 +93,7 @@ static void __exit br_deinit(void)
 
 	unregister_pernet_subsys(&br_net_ops);
 
-	synchronize_net();
+	rcu_barrier(); /* Wait for completion of call_rcu()'s */
 
 	br_netfilter_fini();
 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
#2 lore raw

PATCH 2/5 mac80211: Use rcu_barrier() on unload.

In reply to Jesper Dangaard Brouer

The mac80211 module uses rcu_call() thus it should use rcu_barrier() on module unload.

The rcu_barrier() is placed in mech.c ieee80211_stop_mesh() which is invoked from ieee80211_stop() in case vif.type == NL80211_IFTYPE_MESH_POINT.

---

 net/mac80211/mesh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/mesh.c +1 -1
index fc712e6..11cf45b 100644
@@ -494,7 +494,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
 	 * should it be using the interface and enqueuing
 	 * frames at this very time on another CPU.
 	 */
-	synchronize_rcu();
+	rcu_barrier(); /* Wait for RX path and call_rcu()'s */
 	skb_queue_purge(&sdata->u.mesh.skb_queue);
 }
 
#3 lore raw

PATCH 3/5 sunrpc: Use rcu_barrier() on unload.

In reply to Jesper Dangaard Brouer

The sunrpc module uses rcu_call() thus it should use rcu_barrier() on module unload.

Have not verified that the possibility for new call_rcu() callbacks has been disabled. As a hint for checking, the functions calling call_rcu() (unx_destroy_cred and generic_destroy_cred) are registered as crdestroy function pointer in struct rpc_credops.

---

 net/sunrpc/sunrpc_syms.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
net/sunrpc/sunrpc_syms.c +1 -0
index 843629f..adaa819 100644
@@ -66,6 +66,7 @@ cleanup_sunrpc(void)
 #ifdef CONFIG_PROC_FS
 	rpc_proc_exit();
 #endif
+	rcu_barrier(); /* Wait for completion of call_rcu()'s */
 }
 MODULE_LICENSE("GPL");
 module_init(init_sunrpc);
#4 lore raw

PATCH 4/5 ipv6: Use rcu_barrier() on module unload.

In reply to Jesper Dangaard Brouer

The ipv6 module uses rcu_call() thus it should use rcu_barrier() on module unload.

---

 net/ipv6/af_inet6.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv6/af_inet6.c +2 -0
index 85b3d00..caa0278 100644
@@ -1284,6 +1284,8 @@ static void __exit inet6_exit(void)
 	proto_unregister(&udplitev6_prot);
 	proto_unregister(&udpv6_prot);
 	proto_unregister(&tcpv6_prot);
+
+	rcu_barrier(); /* Wait for completion of call_rcu()'s */
 }
 module_exit(inet6_exit);
 
#5 lore raw

PATCH 5/5 decnet: Use rcu_barrier() on module unload.

In reply to Jesper Dangaard Brouer

The decnet module unloading as been disabled with a '#if 0' statement, because it have had issues.

We add a rcu_barrier() anyhow for correctness.

The maintainer (Chrissie Caulfield) will look into the unload issue when time permits.

---

 net/decnet/af_decnet.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/decnet/af_decnet.c +2 -0
index d351b8d..77d4028 100644
@@ -2413,6 +2413,8 @@ static void __exit decnet_exit(void)
 	proc_net_remove(&init_net, "decnet");
 
 	proto_unregister(&dn_proto);
+
+	rcu_barrier_bh(); /* Wait for completion of call_rcu_bh()'s */
 }
 module_exit(decnet_exit);
 #endif
maintainer
#6 lore raw
In reply to Jesper Dangaard Brouer

From: Jesper Dangaard Brouer <[email protected]>
Date: Fri, 26 Jun 2009 22:45:43 +0200

Quoted 6 lines

This patchset is a resubmit of the network related part of a patchseries titled "We must use rcu_barrier() on module unload". Just to make it easier for DaveM to pick it up.

If an unloadable module uses RCU callbacks, it need to use rcu_barrier() so that the module may be safely unloaded.

All applied, thanks a lot!