aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rcupdate.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-11 16:11:12 -0400
committerPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-11 16:11:12 -0400
commit851a67b825540a8e00c0be3ee25e4627ba8b133b (patch)
tree07afd72ad74a392cb30cefcd01acdfd9b01282d3 /include/linux/rcupdate.h
parent34a3d1e83708702ac6cb872215e68cd07dae298b (diff)
lockdep: annotate rcu_read_{,un}lock{,_bh}
lockdep annotate rcu_read_{,un}lock{,_bh} in order to catch imbalanced usage. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r--include/linux/rcupdate.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index fe17d7d750c2..76c1a530edc5 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -41,6 +41,7 @@
41#include <linux/percpu.h> 41#include <linux/percpu.h>
42#include <linux/cpumask.h> 42#include <linux/cpumask.h>
43#include <linux/seqlock.h> 43#include <linux/seqlock.h>
44#include <linux/lockdep.h>
44 45
45/** 46/**
46 * struct rcu_head - callback structure for use with RCU 47 * struct rcu_head - callback structure for use with RCU
@@ -133,6 +134,15 @@ static inline void rcu_bh_qsctr_inc(int cpu)
133extern int rcu_pending(int cpu); 134extern int rcu_pending(int cpu);
134extern int rcu_needs_cpu(int cpu); 135extern int rcu_needs_cpu(int cpu);
135 136
137#ifdef CONFIG_DEBUG_LOCK_ALLOC
138extern struct lockdep_map rcu_lock_map;
139# define rcu_read_acquire() lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
140# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
141#else
142# define rcu_read_acquire() do { } while (0)
143# define rcu_read_release() do { } while (0)
144#endif
145
136/** 146/**
137 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 147 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
138 * 148 *
@@ -166,6 +176,7 @@ extern int rcu_needs_cpu(int cpu);
166 do { \ 176 do { \
167 preempt_disable(); \ 177 preempt_disable(); \
168 __acquire(RCU); \ 178 __acquire(RCU); \
179 rcu_read_acquire(); \
169 } while(0) 180 } while(0)
170 181
171/** 182/**
@@ -175,6 +186,7 @@ extern int rcu_needs_cpu(int cpu);
175 */ 186 */
176#define rcu_read_unlock() \ 187#define rcu_read_unlock() \
177 do { \ 188 do { \
189 rcu_read_release(); \
178 __release(RCU); \ 190 __release(RCU); \
179 preempt_enable(); \ 191 preempt_enable(); \
180 } while(0) 192 } while(0)
@@ -204,6 +216,7 @@ extern int rcu_needs_cpu(int cpu);
204 do { \ 216 do { \
205 local_bh_disable(); \ 217 local_bh_disable(); \
206 __acquire(RCU_BH); \ 218 __acquire(RCU_BH); \
219 rcu_read_acquire(); \
207 } while(0) 220 } while(0)
208 221
209/* 222/*
@@ -213,6 +226,7 @@ extern int rcu_needs_cpu(int cpu);
213 */ 226 */
214#define rcu_read_unlock_bh() \ 227#define rcu_read_unlock_bh() \
215 do { \ 228 do { \
229 rcu_read_release(); \
216 __release(RCU_BH); \ 230 __release(RCU_BH); \
217 local_bh_enable(); \ 231 local_bh_enable(); \
218 } while(0) 232 } while(0)