diff options
-rw-r--r-- | include/linux/lockdep.h | 7 | ||||
-rw-r--r-- | include/linux/rcupdate.h | 14 | ||||
-rw-r--r-- | kernel/rcupdate.c | 8 |
3 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 9dc46db2985e..f6279f68a827 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -253,6 +253,13 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, | |||
253 | struct lock_class_key *key, int subclass); | 253 | struct lock_class_key *key, int subclass); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * To initialize a lockdep_map statically use this macro. | ||
257 | * Note that _name must not be NULL. | ||
258 | */ | ||
259 | #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ | ||
260 | { .name = (_name), .key = (void *)(_key), } | ||
261 | |||
262 | /* | ||
256 | * Reinitialize a lock key - for cases where there is special locking or | 263 | * Reinitialize a lock key - for cases where there is special locking or |
257 | * special initialization of locks so that the validator gets the scope | 264 | * special initialization of locks so that the validator gets the scope |
258 | * of dependencies wrong: they are either too broad (they need a class-split) | 265 | * of dependencies wrong: they are either too broad (they need a class-split) |
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) | |||
133 | extern int rcu_pending(int cpu); | 134 | extern int rcu_pending(int cpu); |
134 | extern int rcu_needs_cpu(int cpu); | 135 | extern int rcu_needs_cpu(int cpu); |
135 | 136 | ||
137 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
138 | extern 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) |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 2c2dd8410dc4..130214f3d229 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -49,6 +49,14 @@ | |||
49 | #include <linux/cpu.h> | 49 | #include <linux/cpu.h> |
50 | #include <linux/mutex.h> | 50 | #include <linux/mutex.h> |
51 | 51 | ||
52 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
53 | static struct lock_class_key rcu_lock_key; | ||
54 | struct lockdep_map rcu_lock_map = | ||
55 | STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key); | ||
56 | |||
57 | EXPORT_SYMBOL_GPL(rcu_lock_map); | ||
58 | #endif | ||
59 | |||
52 | /* Definition for rcupdate control block. */ | 60 | /* Definition for rcupdate control block. */ |
53 | static struct rcu_ctrlblk rcu_ctrlblk = { | 61 | static struct rcu_ctrlblk rcu_ctrlblk = { |
54 | .cur = -300, | 62 | .cur = -300, |