diff options
author | Josh Triplett <josht@vnet.ibm.com> | 2006-06-30 04:56:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-30 14:25:39 -0400 |
commit | 7f04ac062e92a37bb0fa3313405597244b4702c1 (patch) | |
tree | a81e9df761334ccba5b5793866f96910842a7194 /include/linux/rcupdate.h | |
parent | 7adc28ae75854d9d0940668404a14d1f006f80c0 (diff) |
[PATCH] rcu: Add lock annotations to RCU locking primitives
Add __acquire annotations to rcu_read_lock and rcu_read_lock_bh, and add
__release annotations to rcu_read_unlock and rcu_read_unlock_bh. This
allows sparse to detect improperly paired calls to these functions.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 48dfe00070c..b4ca73d6589 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -163,14 +163,22 @@ extern int rcu_needs_cpu(int cpu); | |||
163 | * | 163 | * |
164 | * It is illegal to block while in an RCU read-side critical section. | 164 | * It is illegal to block while in an RCU read-side critical section. |
165 | */ | 165 | */ |
166 | #define rcu_read_lock() preempt_disable() | 166 | #define rcu_read_lock() \ |
167 | do { \ | ||
168 | preempt_disable(); \ | ||
169 | __acquire(RCU); \ | ||
170 | } while(0) | ||
167 | 171 | ||
168 | /** | 172 | /** |
169 | * rcu_read_unlock - marks the end of an RCU read-side critical section. | 173 | * rcu_read_unlock - marks the end of an RCU read-side critical section. |
170 | * | 174 | * |
171 | * See rcu_read_lock() for more information. | 175 | * See rcu_read_lock() for more information. |
172 | */ | 176 | */ |
173 | #define rcu_read_unlock() preempt_enable() | 177 | #define rcu_read_unlock() \ |
178 | do { \ | ||
179 | __release(RCU); \ | ||
180 | preempt_enable(); \ | ||
181 | } while(0) | ||
174 | 182 | ||
175 | /* | 183 | /* |
176 | * So where is rcu_write_lock()? It does not exist, as there is no | 184 | * So where is rcu_write_lock()? It does not exist, as there is no |
@@ -193,14 +201,22 @@ extern int rcu_needs_cpu(int cpu); | |||
193 | * can use just rcu_read_lock(). | 201 | * can use just rcu_read_lock(). |
194 | * | 202 | * |
195 | */ | 203 | */ |
196 | #define rcu_read_lock_bh() local_bh_disable() | 204 | #define rcu_read_lock_bh() \ |
205 | do { \ | ||
206 | local_bh_disable(); \ | ||
207 | __acquire(RCU_BH); \ | ||
208 | } while(0) | ||
197 | 209 | ||
198 | /* | 210 | /* |
199 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section | 211 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section |
200 | * | 212 | * |
201 | * See rcu_read_lock_bh() for more information. | 213 | * See rcu_read_lock_bh() for more information. |
202 | */ | 214 | */ |
203 | #define rcu_read_unlock_bh() local_bh_enable() | 215 | #define rcu_read_unlock_bh() \ |
216 | do { \ | ||
217 | __release(RCU_BH); \ | ||
218 | local_bh_enable(); \ | ||
219 | } while(0) | ||
204 | 220 | ||
205 | /** | 221 | /** |
206 | * rcu_dereference - fetch an RCU-protected pointer in an | 222 | * rcu_dereference - fetch an RCU-protected pointer in an |