diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-11-28 13:42:42 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-12-11 13:32:06 -0500 |
commit | 3842a0832a1d6eb0b31421f8810a813135967512 (patch) | |
tree | 67aff02fde9c32e647d7b3c4cea948d7867f664d /include/linux/rcupdate.h | |
parent | f0e7c19db8798b4b991a2c71911e71f5dfdb348f (diff) |
rcu: Document same-context read-side constraints
The intent is that a given RCU read-side critical section be confined
to a single context. For example, it is illegal to invoke rcu_read_lock()
in an exception handler and then invoke rcu_read_unlock() from the
context of the task that received the exception.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 5dd6fd8b3203..81c04f4348ec 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -265,6 +265,11 @@ extern int debug_lockdep_rcu_enabled(void); | |||
265 | * | 265 | * |
266 | * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot | 266 | * Checks debug_lockdep_rcu_enabled() to prevent false positives during boot |
267 | * and while lockdep is disabled. | 267 | * and while lockdep is disabled. |
268 | * | ||
269 | * Note that rcu_read_lock() and the matching rcu_read_unlock() must | ||
270 | * occur in the same context, for example, it is illegal to invoke | ||
271 | * rcu_read_unlock() in process context if the matching rcu_read_lock() | ||
272 | * was invoked from within an irq handler. | ||
268 | */ | 273 | */ |
269 | static inline int rcu_read_lock_held(void) | 274 | static inline int rcu_read_lock_held(void) |
270 | { | 275 | { |
@@ -689,6 +694,11 @@ static inline void rcu_read_unlock(void) | |||
689 | * critical sections in interrupt context can use just rcu_read_lock(), | 694 | * critical sections in interrupt context can use just rcu_read_lock(), |
690 | * though this should at least be commented to avoid confusing people | 695 | * though this should at least be commented to avoid confusing people |
691 | * reading the code. | 696 | * reading the code. |
697 | * | ||
698 | * Note that rcu_read_lock_bh() and the matching rcu_read_unlock_bh() | ||
699 | * must occur in the same context, for example, it is illegal to invoke | ||
700 | * rcu_read_unlock_bh() from one task if the matching rcu_read_lock_bh() | ||
701 | * was invoked from some other task. | ||
692 | */ | 702 | */ |
693 | static inline void rcu_read_lock_bh(void) | 703 | static inline void rcu_read_lock_bh(void) |
694 | { | 704 | { |
@@ -716,6 +726,11 @@ static inline void rcu_read_unlock_bh(void) | |||
716 | * are being done using call_rcu_sched() or synchronize_rcu_sched(). | 726 | * are being done using call_rcu_sched() or synchronize_rcu_sched(). |
717 | * Read-side critical sections can also be introduced by anything that | 727 | * Read-side critical sections can also be introduced by anything that |
718 | * disables preemption, including local_irq_disable() and friends. | 728 | * disables preemption, including local_irq_disable() and friends. |
729 | * | ||
730 | * Note that rcu_read_lock_sched() and the matching rcu_read_unlock_sched() | ||
731 | * must occur in the same context, for example, it is illegal to invoke | ||
732 | * rcu_read_unlock_sched() from process context if the matching | ||
733 | * rcu_read_lock_sched() was invoked from an NMI handler. | ||
719 | */ | 734 | */ |
720 | static inline void rcu_read_lock_sched(void) | 735 | static inline void rcu_read_lock_sched(void) |
721 | { | 736 | { |