mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference()
@ 2010-02-23  1:04 Paul E. McKenney
  2010-02-23  1:04 ` [PATCH tip/core/rcu 01/21] rcu: introduce lockdep-based checking to RCU read-side primitives Paul E. McKenney
                   ` (22 more replies)
  0 siblings, 23 replies; 85+ messages in thread
From: Paul E. McKenney @ 2010-02-23  1:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells

Hello!

This patch series adds lockdep-based checking to the rcu_dereference()
primitive in order to flag misuses of RCU.  The first four patches put
the RCU infrastructure in place, the next eight use this infrastructure
in the net, sched, vfs, radix-tree, idr, and security subsystems, and
patch 13 documents how to use the new lockdep-checked rcu_dereference()
primitives.  The remaining eight patches are other changes that also need
to be applied, including some relatively urgent RCU_STALL patches.

The new (and default-disabled) CONFIG_PROVE_RCU makes this safe to
include in tip/core/rcu -- unlike v2 and earlier, your system won't
complain about RCU misuse unless you ask it to.  There are still several
situations that trigger on systems I have access to (and I have email
out on a couple of them), some of the remaining will be triggered only by
hardware I don't have access to and kernel features I am unfamiliar with.
So this is ready for much wider testing.

Changes since v5 (http://lkml.org/lkml/2010/2/17/271)

o	Fix a deadlock located by Thomas Gleixner that affects
	TREE_PREEMPT_RCU in some CPU-stall detection scenarios.

o	Add Dan Carpenter's cleanup to a mod_timer() in rcutorture.

o	Add a RCU_CPU_STALL_VERBOSE to enable dumping more information
	on tasks stalling the current RCU grace period.

o	Applied Acked-by lines that people have sent (thank you all!).

Changes since v4 (http://lkml.org/lkml/2010/2/11/356)

o	Apply review comments from Peter Ziljstra.

o	Another documentation update.

o	Fixes that avoid overflowing signed integers.

o	Rebased Thomas Gleixner's raw-spinlock patch on this series.
	(Thomas's original at http://lkml.org/lkml/2010/2/17/182.)

Changes since v3 (http://lkml.org/lkml/2010/1/14/505)

o	Fix a few more issues identified by the checking.

o	Add a documentation update.

o	Accelerate RCU grace periods when the current CPU is the last
	non-dyntick-idle CPU in the system, which is important for
	some multi-core battery-powered devices.

Changes since v2 (http://lkml.org/lkml/2010/1/4/496):

o	Removed references to the check condition for the non-lockdep
	version of rcu_dereference_check(), thus preventing numerous
	build errors.

o	Create a CONFIG_PROVE_RCU (default disabled) so that developers
	who want to use lockdep only to debug locks aren't bothered 
	by RCU-specific lockdep complaints that will no doubt persist
	for a little bit while some of the more obscure uses of RCU
	are reverse-engineered.

o	Fix a few more issues identified by the checking.

o	Add documentation in Documentation/RCU/lockdep.txt.

Changes since v1 (http://lkml.org/lkml/2009/12/15/553):

o	Made SRCU have per-srcu_struct lockdep maps to prevent lockdep
	from conflating independent uses of SRCU, and updated the
	rcu_dereference() checking in rcutorture to match.

o	Fix a few issues identified by the checking.

o	Disable checking within RCU list macros, RCU radix trees, and
	IDR.

^ permalink raw reply	[flat|nested] 85+ messages in thread
* [PATCH tip/core/rcu 4/8] net: add checking to rcu_dereference() primitives
@ 2010-01-05  2:04 Paul E. McKenney
  2010-01-13 10:30 ` [tip:core/rcu] net: Add " tip-bot for Paul E. McKenney
  0 siblings, 1 reply; 85+ messages in thread
From: Paul E. McKenney @ 2010-01-05  2:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, dvhltc,
	niv, tglx, peterz, rostedt, Valdis.Kletnieks, dhowells,
	Paul E. McKenney

From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

Update rcu_dereference() primitives to use new lockdep-based checking.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 net/core/dev.c         |    2 +-
 net/core/filter.c      |    6 +++---
 net/core/sock.c        |    2 +-
 net/decnet/dn_route.c  |   14 +++++++-------
 net/ipv4/route.c       |   14 +++++++-------
 net/packet/af_packet.c |    2 +-
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index b8f74cf..14ba21e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1904,7 +1904,7 @@ gso:
 	rcu_read_lock_bh();
 
 	txq = dev_pick_tx(dev, skb);
-	q = rcu_dereference(txq->qdisc);
+	q = rcu_dereference_bh(txq->qdisc);
 
 #ifdef CONFIG_NET_CLS_ACT
 	skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_EGRESS);
diff --git a/net/core/filter.c b/net/core/filter.c
index d1d779c..e3e9812 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -86,7 +86,7 @@ int sk_filter(struct sock *sk, struct sk_buff *skb)
 		return err;
 
 	rcu_read_lock_bh();
-	filter = rcu_dereference(sk->sk_filter);
+	filter = rcu_dereference_bh(sk->sk_filter);
 	if (filter) {
 		unsigned int pkt_len = sk_run_filter(skb, filter->insns,
 				filter->len);
@@ -515,7 +515,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
 	}
 
 	rcu_read_lock_bh();
-	old_fp = rcu_dereference(sk->sk_filter);
+	old_fp = rcu_dereference_bh(sk->sk_filter);
 	rcu_assign_pointer(sk->sk_filter, fp);
 	rcu_read_unlock_bh();
 
@@ -530,7 +530,7 @@ int sk_detach_filter(struct sock *sk)
 	struct sk_filter *filter;
 
 	rcu_read_lock_bh();
-	filter = rcu_dereference(sk->sk_filter);
+	filter = rcu_dereference_bh(sk->sk_filter);
 	if (filter) {
 		rcu_assign_pointer(sk->sk_filter, NULL);
 		sk_filter_delayed_uncharge(sk, filter);
diff --git a/net/core/sock.c b/net/core/sock.c
index 7626b6a..dfdb63d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1049,7 +1049,7 @@ static void __sk_free(struct sock *sk)
 	if (sk->sk_destruct)
 		sk->sk_destruct(sk);
 
-	filter = rcu_dereference(sk->sk_filter);
+	filter = rcu_dereference_bh(sk->sk_filter);
 	if (filter) {
 		sk_filter_uncharge(sk, filter);
 		rcu_assign_pointer(sk->sk_filter, NULL);
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 57662ca..1406265 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1155,8 +1155,8 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
 
 	if (!(flags & MSG_TRYHARD)) {
 		rcu_read_lock_bh();
-		for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
-			rt = rcu_dereference(rt->u.dst.dn_next)) {
+		for(rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt;
+			rt = rcu_dereference_bh(rt->u.dst.dn_next)) {
 			if ((flp->fld_dst == rt->fl.fld_dst) &&
 			    (flp->fld_src == rt->fl.fld_src) &&
 			    (flp->mark == rt->fl.mark) &&
@@ -1618,9 +1618,9 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
 		if (h > s_h)
 			s_idx = 0;
 		rcu_read_lock_bh();
-		for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
+		for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0;
 			rt;
-			rt = rcu_dereference(rt->u.dst.dn_next), idx++) {
+			rt = rcu_dereference_bh(rt->u.dst.dn_next), idx++) {
 			if (idx < s_idx)
 				continue;
 			skb_dst_set(skb, dst_clone(&rt->u.dst));
@@ -1654,12 +1654,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
 
 	for(s->bucket = dn_rt_hash_mask; s->bucket >= 0; --s->bucket) {
 		rcu_read_lock_bh();
-		rt = dn_rt_hash_table[s->bucket].chain;
+		rt = rcu_read_lock_bh(dn_rt_hash_table[s->bucket].chain);
 		if (rt)
 			break;
 		rcu_read_unlock_bh();
 	}
-	return rcu_dereference(rt);
+	return rt;
 }
 
 static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
@@ -1674,7 +1674,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
 		rcu_read_lock_bh();
 		rt = dn_rt_hash_table[s->bucket].chain;
 	}
-	return rcu_dereference(rt);
+	return rcu_dereference_bh(rt);
 }
 
 static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bb41992..3fea2d7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -287,12 +287,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
 		if (!rt_hash_table[st->bucket].chain)
 			continue;
 		rcu_read_lock_bh();
-		r = rcu_dereference(rt_hash_table[st->bucket].chain);
+		r = rcu_dereference_bh(rt_hash_table[st->bucket].chain);
 		while (r) {
 			if (dev_net(r->u.dst.dev) == seq_file_net(seq) &&
 			    r->rt_genid == st->genid)
 				return r;
-			r = rcu_dereference(r->u.dst.rt_next);
+			r = rcu_dereference_bh(r->u.dst.rt_next);
 		}
 		rcu_read_unlock_bh();
 	}
@@ -314,7 +314,7 @@ static struct rtable *__rt_cache_get_next(struct seq_file *seq,
 		rcu_read_lock_bh();
 		r = rt_hash_table[st->bucket].chain;
 	}
-	return rcu_dereference(r);
+	return rcu_dereference_bh(r);
 }
 
 static struct rtable *rt_cache_get_next(struct seq_file *seq,
@@ -2685,8 +2685,8 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
 	hash = rt_hash(flp->fl4_dst, flp->fl4_src, flp->oif, rt_genid(net));
 
 	rcu_read_lock_bh();
-	for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
-		rth = rcu_dereference(rth->u.dst.rt_next)) {
+	for (rth = rcu_dereference_bh(rt_hash_table[hash].chain); rth;
+		rth = rcu_dereference_bh(rth->u.dst.rt_next)) {
 		if (rth->fl.fl4_dst == flp->fl4_dst &&
 		    rth->fl.fl4_src == flp->fl4_src &&
 		    rth->fl.iif == 0 &&
@@ -3004,8 +3004,8 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
 		if (!rt_hash_table[h].chain)
 			continue;
 		rcu_read_lock_bh();
-		for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
-		     rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
+		for (rt = rcu_dereference_bh(rt_hash_table[h].chain), idx = 0; rt;
+		     rt = rcu_dereference_bh(rt->u.dst.rt_next), idx++) {
 			if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx)
 				continue;
 			if (rt_is_expired(rt))
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d7ecca0..da5741f 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -515,7 +515,7 @@ static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
 	struct sk_filter *filter;
 
 	rcu_read_lock_bh();
-	filter = rcu_dereference(sk->sk_filter);
+	filter = rcu_dereference_bh(sk->sk_filter);
 	if (filter != NULL)
 		res = sk_run_filter(skb, filter->insns, filter->len);
 	rcu_read_unlock_bh();
-- 
1.5.2.5


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

end of thread, other threads:[~2010-02-26  2:12 UTC | newest]

Thread overview: 85+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-23  1:04 [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 01/21] rcu: introduce lockdep-based checking to RCU read-side primitives Paul E. McKenney
2010-02-25 10:09   ` [tip:core/rcu] rcu: Introduce " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 02/21] rcu: add lockdep-enabled variants of rcu_dereference() Paul E. McKenney
2010-02-25 10:09   ` [tip:core/rcu] rcu: Add " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 03/21] rcu: integrate rcu_dereference_check() message into lockdep Paul E. McKenney
2010-02-25 10:09   ` [tip:core/rcu] rcu: Integrate " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 04/21] rcu: disable lockdep checking in RCU list-traversal primitives Paul E. McKenney
2010-02-25 10:10   ` [tip:core/rcu] rcu: Disable " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 05/21] net: add checking to rcu_dereference() primitives Paul E. McKenney
2010-02-25 10:10   ` [tip:core/rcu] net: Add " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 06/21] sched: use lockdep-based checking on rcu_dereference() Paul E. McKenney
2010-02-25 10:11   ` [tip:core/rcu] sched: Use " tip-bot for Paul E. McKenney
2010-02-25 11:06   ` [tip:core/rcu] sched, cgroups: Fix module export tip-bot for Ingo Molnar
2010-02-23  1:04 ` [PATCH tip/core/rcu 07/21] sched: better name for for_each_domain_rd Paul E. McKenney
2010-02-25 10:11   ` [tip:core/rcu] sched: Better " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 08/21] vfs: apply lockdep-based checking to rcu_dereference() uses Paul E. McKenney
2010-02-25 10:11   ` [tip:core/rcu] vfs: Apply " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 09/21] vfs: abstract rcu_dereference_check for files-fdtable use Paul E. McKenney
2010-02-25 10:11   ` [tip:core/rcu] vfs: Abstract " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 10/21] radix-tree: disable RCU lockdep checking in radix tree Paul E. McKenney
2010-02-25 10:12   ` [tip:core/rcu] radix-tree: Disable " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 11/21] idr: apply lockdep-based diagnostics to rcu_dereference() uses Paul E. McKenney
2010-02-25 10:12   ` [tip:core/rcu] idr: Apply " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 12/21] security: apply lockdep-based checking " Paul E. McKenney
2010-02-25 10:12   ` [tip:core/rcu] security: Apply " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 13/21] rcu: documentation update for CONFIG_PROVE_RCU Paul E. McKenney
2010-02-25 10:12   ` [tip:core/rcu] rcu: Documentation " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 14/21] rcu: fix citation of Mathieu's dissertation Paul E. McKenney
2010-02-25 10:13   ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23  1:04 ` [PATCH tip/core/rcu 15/21] rcu: accelerate grace period if last non-dynticked CPU Paul E. McKenney
2010-02-25 10:13   ` [tip:core/rcu] rcu: Accelerate " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 16/21] rcu: use canonical URL for Mathieu's dissertation Paul E. McKenney
2010-02-25 10:13   ` [tip:core/rcu] rcu: Use " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 17/21] rcu: stop overflowing signed integers Paul E. McKenney
2010-02-25 10:14   ` [tip:core/rcu] rcu: Stop " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 18/21] rcu: Convert to raw_spinlocks Paul E. McKenney
2010-02-25 10:14   ` [tip:core/rcu] " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 19/21] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection Paul E. McKenney
2010-02-25 10:14   ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 20/21] rcu: fix rcutorture mod_timer argument to delay one jiffy Paul E. McKenney
2010-02-25 10:14   ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23  1:05 ` [PATCH tip/core/rcu 21/21] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information Paul E. McKenney
2010-02-25 10:15   ` [tip:core/rcu] rcu: Add " tip-bot for Paul E. McKenney
2010-02-23 12:59 ` [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Arnd Bergmann
2010-02-23 13:15   ` Mathieu Desnoyers
2010-02-23 14:35     ` Paul E. McKenney
2010-02-23 15:54     ` Arnd Bergmann
2010-02-23 16:16       ` Paul E. McKenney
2010-02-23 17:15         ` Arnd Bergmann
2010-02-23 18:01           ` Paul E. McKenney
2010-02-24 20:03             ` [PATCH 00/10] __rcu annotations, first draft Arnd Bergmann
2010-02-24 22:18               ` Paul E. McKenney
2010-02-25  8:37               ` Ingo Molnar
2010-02-24 20:03             ` [PATCH 01/10] rcu: define __rcu address space modifier for sparse Arnd Bergmann
2010-02-24 20:12               ` Mathieu Desnoyers
2010-02-24 20:22                 ` Arnd Bergmann
2010-02-24 20:03             ` [PATCH 02/10] rcu: annotated list rcu code Arnd Bergmann
2010-02-24 20:15               ` Mathieu Desnoyers
2010-02-24 20:32                 ` Arnd Bergmann
2010-02-24 20:03             ` [PATCH 03/10] cgroups: __rcu annotations Arnd Bergmann
2010-02-24 20:04             ` [PATCH 04/10] credentials: rcu annotation Arnd Bergmann
2010-02-24 20:04             ` [PATCH 05/10] perf_event: __rcu annotations Arnd Bergmann
2010-02-24 20:04             ` [PATCH 06/10] audit: " Arnd Bergmann
2010-02-24 20:04             ` [PATCH 07/10] module: " Arnd Bergmann
2010-02-24 20:13               ` Alexey Dobriyan
2010-02-24 20:26                 ` Arnd Bergmann
2010-02-24 22:17                   ` Paul E. McKenney
2010-02-24 23:07                     ` Arnd Bergmann
2010-02-24 23:59                       ` Paul E. McKenney
2010-02-25 17:06                         ` Paul E. McKenney
2010-02-25 18:10                           ` Arnd Bergmann
2010-02-25 20:05                             ` Paul E. McKenney
2010-02-26  2:12                               ` Paul E. McKenney
2010-02-24 20:04             ` [PATCH 08/10] pid: " Arnd Bergmann
2010-02-24 20:04             ` [PATCH 09/10] notifiers: " Arnd Bergmann
2010-02-24 20:04             ` [PATCH 10/10] scheduler: " Arnd Bergmann
2010-02-23 13:28   ` [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Paul E. McKenney
2010-02-25 10:00 ` Ingo Molnar
2010-02-25 10:01   ` Ingo Molnar
2010-02-25 12:04     ` Ingo Molnar
2010-02-25 18:18       ` Paul E. McKenney
2010-02-25 21:36         ` Paul E. McKenney
2010-02-25 21:22       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2010-01-05  2:04 [PATCH tip/core/rcu 4/8] net: add checking to rcu_dereference() primitives Paul E. McKenney
2010-01-13 10:30 ` [tip:core/rcu] net: Add " tip-bot for Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome