aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-12-16 05:43:41 -0500
committerIngo Molnar <mingo@kernel.org>2013-12-16 05:43:41 -0500
commit73a7ac2808fa52bdab1781646568b6f90c3d7034 (patch)
treeb3a79f3ce811167c37e9c0e65aeb8a7c70bed4c8 /include/linux
parent319e2e3f63c348a9b66db4667efa73178e18b17d (diff)
parent0d3c55bc9fd58393bd3bd9974991ec1f815e1326 (diff)
Merge branch 'rcu/next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
Pull v3.14 RCU updates from Paul E. McKenney. The main changes: * Update RCU documentation. * Miscellaneous fixes. * Add RCU torture scripts. * Static-analysis improvements. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/rculist.h4
-rw-r--r--include/linux/rcupdate.h153
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/rcutree.h36
4 files changed, 104 insertions, 91 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 45a0a9e81478..dbaf99084112 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -55,8 +55,8 @@ static inline void __list_add_rcu(struct list_head *new,
55 next->prev = new; 55 next->prev = new;
56} 56}
57#else 57#else
58extern void __list_add_rcu(struct list_head *new, 58void __list_add_rcu(struct list_head *new,
59 struct list_head *prev, struct list_head *next); 59 struct list_head *prev, struct list_head *next);
60#endif 60#endif
61 61
62/** 62/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 39cbb889e20d..3e355c688618 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -50,13 +50,13 @@ extern int rcutorture_runnable; /* for sysctl */
50#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 50#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
51 51
52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
53extern void rcutorture_record_test_transition(void); 53void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(const char *rcutorturename, 55void do_trace_rcu_torture_read(const char *rcutorturename,
56 struct rcu_head *rhp, 56 struct rcu_head *rhp,
57 unsigned long secs, 57 unsigned long secs,
58 unsigned long c_old, 58 unsigned long c_old,
59 unsigned long c); 59 unsigned long c);
60#else 60#else
61static inline void rcutorture_record_test_transition(void) 61static inline void rcutorture_record_test_transition(void)
62{ 62{
@@ -65,11 +65,11 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65{ 65{
66} 66}
67#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
68extern void do_trace_rcu_torture_read(const char *rcutorturename, 68void do_trace_rcu_torture_read(const char *rcutorturename,
69 struct rcu_head *rhp, 69 struct rcu_head *rhp,
70 unsigned long secs, 70 unsigned long secs,
71 unsigned long c_old, 71 unsigned long c_old,
72 unsigned long c); 72 unsigned long c);
73#else 73#else
74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \ 74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
75 do { } while (0) 75 do { } while (0)
@@ -118,8 +118,8 @@ extern void do_trace_rcu_torture_read(const char *rcutorturename,
118 * if CPU A and CPU B are the same CPU (but again only if the system has 118 * if CPU A and CPU B are the same CPU (but again only if the system has
119 * more than one CPU). 119 * more than one CPU).
120 */ 120 */
121extern void call_rcu(struct rcu_head *head, 121void call_rcu(struct rcu_head *head,
122 void (*func)(struct rcu_head *head)); 122 void (*func)(struct rcu_head *head));
123 123
124#else /* #ifdef CONFIG_PREEMPT_RCU */ 124#else /* #ifdef CONFIG_PREEMPT_RCU */
125 125
@@ -149,8 +149,8 @@ extern void call_rcu(struct rcu_head *head,
149 * See the description of call_rcu() for more detailed information on 149 * See the description of call_rcu() for more detailed information on
150 * memory ordering guarantees. 150 * memory ordering guarantees.
151 */ 151 */
152extern void call_rcu_bh(struct rcu_head *head, 152void call_rcu_bh(struct rcu_head *head,
153 void (*func)(struct rcu_head *head)); 153 void (*func)(struct rcu_head *head));
154 154
155/** 155/**
156 * call_rcu_sched() - Queue an RCU for invocation after sched grace period. 156 * call_rcu_sched() - Queue an RCU for invocation after sched grace period.
@@ -171,16 +171,16 @@ extern void call_rcu_bh(struct rcu_head *head,
171 * See the description of call_rcu() for more detailed information on 171 * See the description of call_rcu() for more detailed information on
172 * memory ordering guarantees. 172 * memory ordering guarantees.
173 */ 173 */
174extern void call_rcu_sched(struct rcu_head *head, 174void call_rcu_sched(struct rcu_head *head,
175 void (*func)(struct rcu_head *rcu)); 175 void (*func)(struct rcu_head *rcu));
176 176
177extern void synchronize_sched(void); 177void synchronize_sched(void);
178 178
179#ifdef CONFIG_PREEMPT_RCU 179#ifdef CONFIG_PREEMPT_RCU
180 180
181extern void __rcu_read_lock(void); 181void __rcu_read_lock(void);
182extern void __rcu_read_unlock(void); 182void __rcu_read_unlock(void);
183extern void rcu_read_unlock_special(struct task_struct *t); 183void rcu_read_unlock_special(struct task_struct *t);
184void synchronize_rcu(void); 184void synchronize_rcu(void);
185 185
186/* 186/*
@@ -216,19 +216,19 @@ static inline int rcu_preempt_depth(void)
216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
217 217
218/* Internal to kernel */ 218/* Internal to kernel */
219extern void rcu_init(void); 219void rcu_init(void);
220extern void rcu_sched_qs(int cpu); 220void rcu_sched_qs(int cpu);
221extern void rcu_bh_qs(int cpu); 221void rcu_bh_qs(int cpu);
222extern void rcu_check_callbacks(int cpu, int user); 222void rcu_check_callbacks(int cpu, int user);
223struct notifier_block; 223struct notifier_block;
224extern void rcu_idle_enter(void); 224void rcu_idle_enter(void);
225extern void rcu_idle_exit(void); 225void rcu_idle_exit(void);
226extern void rcu_irq_enter(void); 226void rcu_irq_enter(void);
227extern void rcu_irq_exit(void); 227void rcu_irq_exit(void);
228 228
229#ifdef CONFIG_RCU_USER_QS 229#ifdef CONFIG_RCU_USER_QS
230extern void rcu_user_enter(void); 230void rcu_user_enter(void);
231extern void rcu_user_exit(void); 231void rcu_user_exit(void);
232#else 232#else
233static inline void rcu_user_enter(void) { } 233static inline void rcu_user_enter(void) { }
234static inline void rcu_user_exit(void) { } 234static inline void rcu_user_exit(void) { }
@@ -262,7 +262,7 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
262 } while (0) 262 } while (0)
263 263
264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
265extern bool __rcu_is_watching(void); 265bool __rcu_is_watching(void);
266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267 267
268/* 268/*
@@ -289,8 +289,8 @@ void wait_rcu_gp(call_rcu_func_t crf);
289 * initialization. 289 * initialization.
290 */ 290 */
291#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD 291#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
292extern void init_rcu_head_on_stack(struct rcu_head *head); 292void init_rcu_head_on_stack(struct rcu_head *head);
293extern void destroy_rcu_head_on_stack(struct rcu_head *head); 293void destroy_rcu_head_on_stack(struct rcu_head *head);
294#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 294#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
295static inline void init_rcu_head_on_stack(struct rcu_head *head) 295static inline void init_rcu_head_on_stack(struct rcu_head *head)
296{ 296{
@@ -325,6 +325,7 @@ static inline void rcu_lock_release(struct lockdep_map *map)
325extern struct lockdep_map rcu_lock_map; 325extern struct lockdep_map rcu_lock_map;
326extern struct lockdep_map rcu_bh_lock_map; 326extern struct lockdep_map rcu_bh_lock_map;
327extern struct lockdep_map rcu_sched_lock_map; 327extern struct lockdep_map rcu_sched_lock_map;
328extern struct lockdep_map rcu_callback_map;
328extern int debug_lockdep_rcu_enabled(void); 329extern int debug_lockdep_rcu_enabled(void);
329 330
330/** 331/**
@@ -362,7 +363,7 @@ static inline int rcu_read_lock_held(void)
362 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file 363 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
363 * hell. 364 * hell.
364 */ 365 */
365extern int rcu_read_lock_bh_held(void); 366int rcu_read_lock_bh_held(void);
366 367
367/** 368/**
368 * rcu_read_lock_sched_held() - might we be in RCU-sched read-side critical section? 369 * rcu_read_lock_sched_held() - might we be in RCU-sched read-side critical section?
@@ -448,7 +449,7 @@ static inline int rcu_read_lock_sched_held(void)
448 449
449#ifdef CONFIG_PROVE_RCU 450#ifdef CONFIG_PROVE_RCU
450 451
451extern int rcu_my_thread_group_empty(void); 452int rcu_my_thread_group_empty(void);
452 453
453/** 454/**
454 * rcu_lockdep_assert - emit lockdep splat if specified condition not met 455 * rcu_lockdep_assert - emit lockdep splat if specified condition not met
@@ -548,10 +549,48 @@ static inline void rcu_preempt_sleep_check(void)
548 smp_read_barrier_depends(); \ 549 smp_read_barrier_depends(); \
549 (_________p1); \ 550 (_________p1); \
550 }) 551 })
551#define __rcu_assign_pointer(p, v, space) \ 552
553/**
554 * RCU_INITIALIZER() - statically initialize an RCU-protected global variable
555 * @v: The value to statically initialize with.
556 */
557#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
558
559/**
560 * rcu_assign_pointer() - assign to RCU-protected pointer
561 * @p: pointer to assign to
562 * @v: value to assign (publish)
563 *
564 * Assigns the specified value to the specified RCU-protected
565 * pointer, ensuring that any concurrent RCU readers will see
566 * any prior initialization.
567 *
568 * Inserts memory barriers on architectures that require them
569 * (which is most of them), and also prevents the compiler from
570 * reordering the code that initializes the structure after the pointer
571 * assignment. More importantly, this call documents which pointers
572 * will be dereferenced by RCU read-side code.
573 *
574 * In some special cases, you may use RCU_INIT_POINTER() instead
575 * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
576 * to the fact that it does not constrain either the CPU or the compiler.
577 * That said, using RCU_INIT_POINTER() when you should have used
578 * rcu_assign_pointer() is a very bad thing that results in
579 * impossible-to-diagnose memory corruption. So please be careful.
580 * See the RCU_INIT_POINTER() comment header for details.
581 *
582 * Note that rcu_assign_pointer() evaluates each of its arguments only
583 * once, appearances notwithstanding. One of the "extra" evaluations
584 * is in typeof() and the other visible only to sparse (__CHECKER__),
585 * neither of which actually execute the argument. As with most cpp
586 * macros, this execute-arguments-only-once property is important, so
587 * please be careful when making changes to rcu_assign_pointer() and the
588 * other macros that it invokes.
589 */
590#define rcu_assign_pointer(p, v) \
552 do { \ 591 do { \
553 smp_wmb(); \ 592 smp_wmb(); \
554 (p) = (typeof(*v) __force space *)(v); \ 593 ACCESS_ONCE(p) = RCU_INITIALIZER(v); \
555 } while (0) 594 } while (0)
556 595
557 596
@@ -890,32 +929,6 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
890} 929}
891 930
892/** 931/**
893 * rcu_assign_pointer() - assign to RCU-protected pointer
894 * @p: pointer to assign to
895 * @v: value to assign (publish)
896 *
897 * Assigns the specified value to the specified RCU-protected
898 * pointer, ensuring that any concurrent RCU readers will see
899 * any prior initialization.
900 *
901 * Inserts memory barriers on architectures that require them
902 * (which is most of them), and also prevents the compiler from
903 * reordering the code that initializes the structure after the pointer
904 * assignment. More importantly, this call documents which pointers
905 * will be dereferenced by RCU read-side code.
906 *
907 * In some special cases, you may use RCU_INIT_POINTER() instead
908 * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
909 * to the fact that it does not constrain either the CPU or the compiler.
910 * That said, using RCU_INIT_POINTER() when you should have used
911 * rcu_assign_pointer() is a very bad thing that results in
912 * impossible-to-diagnose memory corruption. So please be careful.
913 * See the RCU_INIT_POINTER() comment header for details.
914 */
915#define rcu_assign_pointer(p, v) \
916 __rcu_assign_pointer((p), (v), __rcu)
917
918/**
919 * RCU_INIT_POINTER() - initialize an RCU protected pointer 932 * RCU_INIT_POINTER() - initialize an RCU protected pointer
920 * 933 *
921 * Initialize an RCU-protected pointer in special cases where readers 934 * Initialize an RCU-protected pointer in special cases where readers
@@ -949,7 +962,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
949 */ 962 */
950#define RCU_INIT_POINTER(p, v) \ 963#define RCU_INIT_POINTER(p, v) \
951 do { \ 964 do { \
952 p = (typeof(*v) __force __rcu *)(v); \ 965 p = RCU_INITIALIZER(v); \
953 } while (0) 966 } while (0)
954 967
955/** 968/**
@@ -958,7 +971,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
958 * GCC-style initialization for an RCU-protected pointer in a structure field. 971 * GCC-style initialization for an RCU-protected pointer in a structure field.
959 */ 972 */
960#define RCU_POINTER_INITIALIZER(p, v) \ 973#define RCU_POINTER_INITIALIZER(p, v) \
961 .p = (typeof(*v) __force __rcu *)(v) 974 .p = RCU_INITIALIZER(v)
962 975
963/* 976/*
964 * Does the specified offset indicate that the corresponding rcu_head 977 * Does the specified offset indicate that the corresponding rcu_head
@@ -1005,7 +1018,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
1005 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 1018 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
1006 1019
1007#ifdef CONFIG_RCU_NOCB_CPU 1020#ifdef CONFIG_RCU_NOCB_CPU
1008extern bool rcu_is_nocb_cpu(int cpu); 1021bool rcu_is_nocb_cpu(int cpu);
1009#else 1022#else
1010static inline bool rcu_is_nocb_cpu(int cpu) { return false; } 1023static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1011#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ 1024#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
@@ -1013,8 +1026,8 @@ static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1013 1026
1014/* Only for use by adaptive-ticks code. */ 1027/* Only for use by adaptive-ticks code. */
1015#ifdef CONFIG_NO_HZ_FULL_SYSIDLE 1028#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016extern bool rcu_sys_is_idle(void); 1029bool rcu_sys_is_idle(void);
1017extern void rcu_sysidle_force_exit(void); 1030void rcu_sysidle_force_exit(void);
1018#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */ 1031#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019 1032
1020static inline bool rcu_sys_is_idle(void) 1033static inline bool rcu_sys_is_idle(void)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 09ebcbe9fd78..6f01771b571c 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -125,7 +125,7 @@ static inline void exit_rcu(void)
125 125
126#ifdef CONFIG_DEBUG_LOCK_ALLOC 126#ifdef CONFIG_DEBUG_LOCK_ALLOC
127extern int rcu_scheduler_active __read_mostly; 127extern int rcu_scheduler_active __read_mostly;
128extern void rcu_scheduler_starting(void); 128void rcu_scheduler_starting(void);
129#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 129#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
130static inline void rcu_scheduler_starting(void) 130static inline void rcu_scheduler_starting(void)
131{ 131{
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 4b9c81548742..72137ee8c603 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,9 +30,9 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33extern void rcu_note_context_switch(int cpu); 33void rcu_note_context_switch(int cpu);
34extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); 34int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
35extern void rcu_cpu_stall_reset(void); 35void rcu_cpu_stall_reset(void);
36 36
37/* 37/*
38 * Note a virtualization-based context switch. This is simply a 38 * Note a virtualization-based context switch. This is simply a
@@ -44,9 +44,9 @@ static inline void rcu_virt_note_context_switch(int cpu)
44 rcu_note_context_switch(cpu); 44 rcu_note_context_switch(cpu);
45} 45}
46 46
47extern void synchronize_rcu_bh(void); 47void synchronize_rcu_bh(void);
48extern void synchronize_sched_expedited(void); 48void synchronize_sched_expedited(void);
49extern void synchronize_rcu_expedited(void); 49void synchronize_rcu_expedited(void);
50 50
51void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); 51void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
52 52
@@ -71,25 +71,25 @@ static inline void synchronize_rcu_bh_expedited(void)
71 synchronize_sched_expedited(); 71 synchronize_sched_expedited();
72} 72}
73 73
74extern void rcu_barrier(void); 74void rcu_barrier(void);
75extern void rcu_barrier_bh(void); 75void rcu_barrier_bh(void);
76extern void rcu_barrier_sched(void); 76void rcu_barrier_sched(void);
77 77
78extern unsigned long rcutorture_testseq; 78extern unsigned long rcutorture_testseq;
79extern unsigned long rcutorture_vernum; 79extern unsigned long rcutorture_vernum;
80extern long rcu_batches_completed(void); 80long rcu_batches_completed(void);
81extern long rcu_batches_completed_bh(void); 81long rcu_batches_completed_bh(void);
82extern long rcu_batches_completed_sched(void); 82long rcu_batches_completed_sched(void);
83 83
84extern void rcu_force_quiescent_state(void); 84void rcu_force_quiescent_state(void);
85extern void rcu_bh_force_quiescent_state(void); 85void rcu_bh_force_quiescent_state(void);
86extern void rcu_sched_force_quiescent_state(void); 86void rcu_sched_force_quiescent_state(void);
87 87
88extern void exit_rcu(void); 88void exit_rcu(void);
89 89
90extern void rcu_scheduler_starting(void); 90void rcu_scheduler_starting(void);
91extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
92 92
93extern bool rcu_is_watching(void); 93bool rcu_is_watching(void);
94 94
95#endif /* __LINUX_RCUTREE_H */ 95#endif /* __LINUX_RCUTREE_H */