33 #include <linux/types.h>
34 #include <linux/kernel.h>
39 #include <linux/sched.h>
41 #include <linux/bitops.h>
46 #include <linux/export.h>
50 #define CREATE_TRACE_POINTS
55 #ifdef CONFIG_PREEMPT_RCU
62 void __rcu_read_lock(
void)
64 current->rcu_read_lock_nesting++;
76 void __rcu_read_unlock(
void)
80 if (t->rcu_read_lock_nesting != 1) {
81 --t->rcu_read_lock_nesting;
84 t->rcu_read_lock_nesting =
INT_MIN;
85 #ifdef CONFIG_PROVE_RCU_DELAY
90 rcu_read_unlock_special(t);
92 t->rcu_read_lock_nesting = 0;
94 #ifdef CONFIG_PROVE_LOCKING
116 t->rcu_read_lock_nesting = 1;
118 t->rcu_read_unlock_special = RCU_READ_UNLOCK_BLOCKED;
130 #ifdef CONFIG_DEBUG_LOCK_ALLOC
132 struct lockdep_map rcu_lock_map =
133 STATIC_LOCKDEP_MAP_INIT(
"rcu_read_lock", &rcu_lock_key);
137 struct lockdep_map rcu_bh_lock_map =
138 STATIC_LOCKDEP_MAP_INIT(
"rcu_read_lock_bh", &rcu_bh_lock_key);
142 struct lockdep_map rcu_sched_lock_map =
143 STATIC_LOCKDEP_MAP_INIT(
"rcu_read_lock_sched", &rcu_sched_lock_key);
147 #ifdef CONFIG_DEBUG_LOCK_ALLOC
149 int debug_lockdep_rcu_enabled(
void)
152 current->lockdep_recursion == 0;
171 int rcu_read_lock_bh_held(
void)
173 if (!debug_lockdep_rcu_enabled())
177 if (!rcu_lockdep_current_cpu_online())
206 init_rcu_head_on_stack(&rcu.
head);
209 crf(&rcu.
head, wakeme_after_rcu);
212 destroy_rcu_head_on_stack(&rcu.
head);
216 #ifdef CONFIG_PROVE_RCU
220 int rcu_my_thread_group_empty(
void)
222 return thread_group_empty(
current);
227 #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
228 static inline void debug_init_rcu_head(
struct rcu_head *
head)
233 static inline void debug_rcu_head_free(
struct rcu_head *
head)
256 #ifndef CONFIG_PREEMPT
281 static int rcuhead_fixup_activate(
void *addr,
enum debug_obj_state state)
305 #ifndef CONFIG_PREEMPT
342 #ifndef CONFIG_PREEMPT
371 void init_rcu_head_on_stack(
struct rcu_head *head)
388 void destroy_rcu_head_on_stack(
struct rcu_head *head)
396 .fixup_init = rcuhead_fixup_init,
397 .fixup_activate = rcuhead_fixup_activate,
398 .fixup_free = rcuhead_fixup_free,
403 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) || defined(CONFIG_RCU_TRACE)
410 #define do_trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)