1b5b11890SPaul E. McKenney /* SPDX-License-Identifier: GPL-2.0+ */
24102adabSPaul E. McKenney /*
34102adabSPaul E. McKenney * Read-Copy Update definitions shared among RCU implementations.
44102adabSPaul E. McKenney *
54102adabSPaul E. McKenney * Copyright IBM Corporation, 2011
64102adabSPaul E. McKenney *
7b5b11890SPaul E. McKenney * Author: Paul E. McKenney <paulmck@linux.ibm.com>
84102adabSPaul E. McKenney */
94102adabSPaul E. McKenney
104102adabSPaul E. McKenney #ifndef __LINUX_RCU_H
114102adabSPaul E. McKenney #define __LINUX_RCU_H
124102adabSPaul E. McKenney
13*e160de34SZhen Lei #include <linux/slab.h>
145cb5c6e1SPaul Gortmaker #include <trace/events/rcu.h>
154102adabSPaul E. McKenney
162e8c28c2SPaul E. McKenney /*
172e8c28c2SPaul E. McKenney * Grace-period counter management.
183636d8d1SFrederic Weisbecker *
193636d8d1SFrederic Weisbecker * The two least significant bits contain the control flags.
203636d8d1SFrederic Weisbecker * The most significant bits contain the grace-period sequence counter.
213636d8d1SFrederic Weisbecker *
223636d8d1SFrederic Weisbecker * When both control flags are zero, no grace period is in progress.
233636d8d1SFrederic Weisbecker * When either bit is non-zero, a grace period has started and is in
243636d8d1SFrederic Weisbecker * progress. When the grace period completes, the control flags are reset
253636d8d1SFrederic Weisbecker * to 0 and the grace-period sequence counter is incremented.
263636d8d1SFrederic Weisbecker *
273636d8d1SFrederic Weisbecker * However some specific RCU usages make use of custom values.
283636d8d1SFrederic Weisbecker *
293636d8d1SFrederic Weisbecker * SRCU special control values:
303636d8d1SFrederic Weisbecker *
313636d8d1SFrederic Weisbecker * SRCU_SNP_INIT_SEQ : Invalid/init value set when SRCU node
323636d8d1SFrederic Weisbecker * is initialized.
333636d8d1SFrederic Weisbecker *
343636d8d1SFrederic Weisbecker * SRCU_STATE_IDLE : No SRCU gp is in progress
353636d8d1SFrederic Weisbecker *
363636d8d1SFrederic Weisbecker * SRCU_STATE_SCAN1 : State set by rcu_seq_start(). Indicates
373636d8d1SFrederic Weisbecker * we are scanning the readers on the slot
383636d8d1SFrederic Weisbecker * defined as inactive (there might well
393636d8d1SFrederic Weisbecker * be pending readers that will use that
403636d8d1SFrederic Weisbecker * index, but their number is bounded).
413636d8d1SFrederic Weisbecker *
423636d8d1SFrederic Weisbecker * SRCU_STATE_SCAN2 : State set manually via rcu_seq_set_state()
433636d8d1SFrederic Weisbecker * Indicates we are flipping the readers
443636d8d1SFrederic Weisbecker * index and then scanning the readers on the
453636d8d1SFrederic Weisbecker * slot newly designated as inactive (again,
463636d8d1SFrederic Weisbecker * the number of pending readers that will use
473636d8d1SFrederic Weisbecker * this inactive index is bounded).
483636d8d1SFrederic Weisbecker *
493636d8d1SFrederic Weisbecker * RCU polled GP special control value:
503636d8d1SFrederic Weisbecker *
513636d8d1SFrederic Weisbecker * RCU_GET_STATE_COMPLETED : State value indicating an already-completed
523636d8d1SFrederic Weisbecker * polled GP has completed. This value covers
533636d8d1SFrederic Weisbecker * both the state and the counter of the
543636d8d1SFrederic Weisbecker * grace-period sequence number.
552e8c28c2SPaul E. McKenney */
562e8c28c2SPaul E. McKenney
57f1ec57a4SPaul E. McKenney #define RCU_SEQ_CTR_SHIFT 2
58031aeee0SPaul E. McKenney #define RCU_SEQ_STATE_MASK ((1 << RCU_SEQ_CTR_SHIFT) - 1)
59031aeee0SPaul E. McKenney
60414c1238SPaul E. McKenney /* Low-order bit definition for polled grace-period APIs. */
61414c1238SPaul E. McKenney #define RCU_GET_STATE_COMPLETED 0x1
62414c1238SPaul E. McKenney
63d9ab0e63SZhen Ni extern int sysctl_sched_rt_runtime;
64d9ab0e63SZhen Ni
65031aeee0SPaul E. McKenney /*
66031aeee0SPaul E. McKenney * Return the counter portion of a sequence number previously returned
67031aeee0SPaul E. McKenney * by rcu_seq_snap() or rcu_seq_current().
68031aeee0SPaul E. McKenney */
rcu_seq_ctr(unsigned long s)69031aeee0SPaul E. McKenney static inline unsigned long rcu_seq_ctr(unsigned long s)
70031aeee0SPaul E. McKenney {
71031aeee0SPaul E. McKenney return s >> RCU_SEQ_CTR_SHIFT;
72031aeee0SPaul E. McKenney }
73031aeee0SPaul E. McKenney
74031aeee0SPaul E. McKenney /*
75031aeee0SPaul E. McKenney * Return the state portion of a sequence number previously returned
76031aeee0SPaul E. McKenney * by rcu_seq_snap() or rcu_seq_current().
77031aeee0SPaul E. McKenney */
rcu_seq_state(unsigned long s)78031aeee0SPaul E. McKenney static inline int rcu_seq_state(unsigned long s)
79031aeee0SPaul E. McKenney {
80031aeee0SPaul E. McKenney return s & RCU_SEQ_STATE_MASK;
81031aeee0SPaul E. McKenney }
82031aeee0SPaul E. McKenney
8380a7956fSPaul E. McKenney /*
8480a7956fSPaul E. McKenney * Set the state portion of the pointed-to sequence number.
8580a7956fSPaul E. McKenney * The caller is responsible for preventing conflicting updates.
8680a7956fSPaul E. McKenney */
rcu_seq_set_state(unsigned long * sp,int newstate)8780a7956fSPaul E. McKenney static inline void rcu_seq_set_state(unsigned long *sp, int newstate)
8880a7956fSPaul E. McKenney {
8980a7956fSPaul E. McKenney WARN_ON_ONCE(newstate & ~RCU_SEQ_STATE_MASK);
9080a7956fSPaul E. McKenney WRITE_ONCE(*sp, (*sp & ~RCU_SEQ_STATE_MASK) + newstate);
9180a7956fSPaul E. McKenney }
9280a7956fSPaul E. McKenney
932e8c28c2SPaul E. McKenney /* Adjust sequence number for start of update-side operation. */
rcu_seq_start(unsigned long * sp)942e8c28c2SPaul E. McKenney static inline void rcu_seq_start(unsigned long *sp)
952e8c28c2SPaul E. McKenney {
962e8c28c2SPaul E. McKenney WRITE_ONCE(*sp, *sp + 1);
972e8c28c2SPaul E. McKenney smp_mb(); /* Ensure update-side operation after counter increment. */
98031aeee0SPaul E. McKenney WARN_ON_ONCE(rcu_seq_state(*sp) != 1);
992e8c28c2SPaul E. McKenney }
1002e8c28c2SPaul E. McKenney
1019a414201SPaul E. McKenney /* Compute the end-of-grace-period value for the specified sequence number. */
rcu_seq_endval(unsigned long * sp)1029a414201SPaul E. McKenney static inline unsigned long rcu_seq_endval(unsigned long *sp)
1039a414201SPaul E. McKenney {
1049a414201SPaul E. McKenney return (*sp | RCU_SEQ_STATE_MASK) + 1;
1059a414201SPaul E. McKenney }
1069a414201SPaul E. McKenney
1072e8c28c2SPaul E. McKenney /* Adjust sequence number for end of update-side operation. */
rcu_seq_end(unsigned long * sp)1082e8c28c2SPaul E. McKenney static inline void rcu_seq_end(unsigned long *sp)
1092e8c28c2SPaul E. McKenney {
1102e8c28c2SPaul E. McKenney smp_mb(); /* Ensure update-side operation before counter increment. */
111031aeee0SPaul E. McKenney WARN_ON_ONCE(!rcu_seq_state(*sp));
1129a414201SPaul E. McKenney WRITE_ONCE(*sp, rcu_seq_endval(sp));
1132e8c28c2SPaul E. McKenney }
1142e8c28c2SPaul E. McKenney
1150d805a70SJoel Fernandes (Google) /*
1160d805a70SJoel Fernandes (Google) * rcu_seq_snap - Take a snapshot of the update side's sequence number.
1170d805a70SJoel Fernandes (Google) *
1180d805a70SJoel Fernandes (Google) * This function returns the earliest value of the grace-period sequence number
1190d805a70SJoel Fernandes (Google) * that will indicate that a full grace period has elapsed since the current
1200d805a70SJoel Fernandes (Google) * time. Once the grace-period sequence number has reached this value, it will
1210d805a70SJoel Fernandes (Google) * be safe to invoke all callbacks that have been registered prior to the
1220d805a70SJoel Fernandes (Google) * current time. This value is the current grace-period number plus two to the
1230d805a70SJoel Fernandes (Google) * power of the number of low-order bits reserved for state, then rounded up to
1240d805a70SJoel Fernandes (Google) * the next value in which the state bits are all zero.
1250d805a70SJoel Fernandes (Google) */
rcu_seq_snap(unsigned long * sp)1262e8c28c2SPaul E. McKenney static inline unsigned long rcu_seq_snap(unsigned long *sp)
1272e8c28c2SPaul E. McKenney {
1282e8c28c2SPaul E. McKenney unsigned long s;
1292e8c28c2SPaul E. McKenney
130031aeee0SPaul E. McKenney s = (READ_ONCE(*sp) + 2 * RCU_SEQ_STATE_MASK + 1) & ~RCU_SEQ_STATE_MASK;
1312e8c28c2SPaul E. McKenney smp_mb(); /* Above access must not bleed into critical section. */
1322e8c28c2SPaul E. McKenney return s;
1332e8c28c2SPaul E. McKenney }
1342e8c28c2SPaul E. McKenney
1358660b7d8SPaul E. McKenney /* Return the current value the update side's sequence number, no ordering. */
rcu_seq_current(unsigned long * sp)1368660b7d8SPaul E. McKenney static inline unsigned long rcu_seq_current(unsigned long *sp)
1378660b7d8SPaul E. McKenney {
1388660b7d8SPaul E. McKenney return READ_ONCE(*sp);
1398660b7d8SPaul E. McKenney }
1408660b7d8SPaul E. McKenney
1412e8c28c2SPaul E. McKenney /*
1422e3e5e55SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not the
1432e3e5e55SPaul E. McKenney * corresponding update-side operation has started.
1442e3e5e55SPaul E. McKenney */
rcu_seq_started(unsigned long * sp,unsigned long s)1452e3e5e55SPaul E. McKenney static inline bool rcu_seq_started(unsigned long *sp, unsigned long s)
1462e3e5e55SPaul E. McKenney {
1472e3e5e55SPaul E. McKenney return ULONG_CMP_LT((s - 1) & ~RCU_SEQ_STATE_MASK, READ_ONCE(*sp));
1482e3e5e55SPaul E. McKenney }
1492e3e5e55SPaul E. McKenney
1502e3e5e55SPaul E. McKenney /*
1512e8c28c2SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not a
1522e8c28c2SPaul E. McKenney * full update-side operation has occurred.
1532e8c28c2SPaul E. McKenney */
rcu_seq_done(unsigned long * sp,unsigned long s)1542e8c28c2SPaul E. McKenney static inline bool rcu_seq_done(unsigned long *sp, unsigned long s)
1552e8c28c2SPaul E. McKenney {
1562e8c28c2SPaul E. McKenney return ULONG_CMP_GE(READ_ONCE(*sp), s);
1572e8c28c2SPaul E. McKenney }
1582e8c28c2SPaul E. McKenney
1594102adabSPaul E. McKenney /*
1602403e804SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not a
1612403e804SPaul E. McKenney * full update-side operation has occurred, but do not allow the
1622403e804SPaul E. McKenney * (ULONG_MAX / 2) safety-factor/guard-band.
1632403e804SPaul E. McKenney */
rcu_seq_done_exact(unsigned long * sp,unsigned long s)1642403e804SPaul E. McKenney static inline bool rcu_seq_done_exact(unsigned long *sp, unsigned long s)
1652403e804SPaul E. McKenney {
1662403e804SPaul E. McKenney unsigned long cur_s = READ_ONCE(*sp);
1672403e804SPaul E. McKenney
1682403e804SPaul E. McKenney return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (2 * RCU_SEQ_STATE_MASK + 1));
1692403e804SPaul E. McKenney }
1702403e804SPaul E. McKenney
1712403e804SPaul E. McKenney /*
17267e14c1eSPaul E. McKenney * Has a grace period completed since the time the old gp_seq was collected?
17367e14c1eSPaul E. McKenney */
rcu_seq_completed_gp(unsigned long old,unsigned long new)17467e14c1eSPaul E. McKenney static inline bool rcu_seq_completed_gp(unsigned long old, unsigned long new)
17567e14c1eSPaul E. McKenney {
17667e14c1eSPaul E. McKenney return ULONG_CMP_LT(old, new & ~RCU_SEQ_STATE_MASK);
17767e14c1eSPaul E. McKenney }
17867e14c1eSPaul E. McKenney
17967e14c1eSPaul E. McKenney /*
18067e14c1eSPaul E. McKenney * Has a grace period started since the time the old gp_seq was collected?
18167e14c1eSPaul E. McKenney */
rcu_seq_new_gp(unsigned long old,unsigned long new)18267e14c1eSPaul E. McKenney static inline bool rcu_seq_new_gp(unsigned long old, unsigned long new)
18367e14c1eSPaul E. McKenney {
18467e14c1eSPaul E. McKenney return ULONG_CMP_LT((old + RCU_SEQ_STATE_MASK) & ~RCU_SEQ_STATE_MASK,
18567e14c1eSPaul E. McKenney new);
18667e14c1eSPaul E. McKenney }
18767e14c1eSPaul E. McKenney
18867e14c1eSPaul E. McKenney /*
189d7219312SPaul E. McKenney * Roughly how many full grace periods have elapsed between the collection
190d7219312SPaul E. McKenney * of the two specified grace periods?
191d7219312SPaul E. McKenney */
rcu_seq_diff(unsigned long new,unsigned long old)192d7219312SPaul E. McKenney static inline unsigned long rcu_seq_diff(unsigned long new, unsigned long old)
193d7219312SPaul E. McKenney {
1942ee5aca5SPaul E. McKenney unsigned long rnd_diff;
1952ee5aca5SPaul E. McKenney
1962ee5aca5SPaul E. McKenney if (old == new)
1972ee5aca5SPaul E. McKenney return 0;
1982ee5aca5SPaul E. McKenney /*
1992ee5aca5SPaul E. McKenney * Compute the number of grace periods (still shifted up), plus
2002ee5aca5SPaul E. McKenney * one if either of new and old is not an exact grace period.
2012ee5aca5SPaul E. McKenney */
2022ee5aca5SPaul E. McKenney rnd_diff = (new & ~RCU_SEQ_STATE_MASK) -
2032ee5aca5SPaul E. McKenney ((old + RCU_SEQ_STATE_MASK) & ~RCU_SEQ_STATE_MASK) +
2042ee5aca5SPaul E. McKenney ((new & RCU_SEQ_STATE_MASK) || (old & RCU_SEQ_STATE_MASK));
2052ee5aca5SPaul E. McKenney if (ULONG_CMP_GE(RCU_SEQ_STATE_MASK, rnd_diff))
2062ee5aca5SPaul E. McKenney return 1; /* Definitely no grace period has elapsed. */
2072ee5aca5SPaul E. McKenney return ((rnd_diff - RCU_SEQ_STATE_MASK - 1) >> RCU_SEQ_CTR_SHIFT) + 2;
208d7219312SPaul E. McKenney }
209d7219312SPaul E. McKenney
210d7219312SPaul E. McKenney /*
2114102adabSPaul E. McKenney * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
2127f87c036SPaul E. McKenney * by call_rcu() and rcu callback execution, and are therefore not part
2137f87c036SPaul E. McKenney * of the RCU API. These are in rcupdate.h because they are used by all
2147f87c036SPaul E. McKenney * RCU implementations.
2154102adabSPaul E. McKenney */
2164102adabSPaul E. McKenney
2174102adabSPaul E. McKenney #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
2184102adabSPaul E. McKenney # define STATE_RCU_HEAD_READY 0
2194102adabSPaul E. McKenney # define STATE_RCU_HEAD_QUEUED 1
2204102adabSPaul E. McKenney
221f9e62f31SStephen Boyd extern const struct debug_obj_descr rcuhead_debug_descr;
2224102adabSPaul E. McKenney
debug_rcu_head_queue(struct rcu_head * head)2234102adabSPaul E. McKenney static inline int debug_rcu_head_queue(struct rcu_head *head)
2244102adabSPaul E. McKenney {
2254102adabSPaul E. McKenney int r1;
2264102adabSPaul E. McKenney
2274102adabSPaul E. McKenney r1 = debug_object_activate(head, &rcuhead_debug_descr);
2284102adabSPaul E. McKenney debug_object_active_state(head, &rcuhead_debug_descr,
2294102adabSPaul E. McKenney STATE_RCU_HEAD_READY,
2304102adabSPaul E. McKenney STATE_RCU_HEAD_QUEUED);
2314102adabSPaul E. McKenney return r1;
2324102adabSPaul E. McKenney }
2334102adabSPaul E. McKenney
debug_rcu_head_unqueue(struct rcu_head * head)2344102adabSPaul E. McKenney static inline void debug_rcu_head_unqueue(struct rcu_head *head)
2354102adabSPaul E. McKenney {
2364102adabSPaul E. McKenney debug_object_active_state(head, &rcuhead_debug_descr,
2374102adabSPaul E. McKenney STATE_RCU_HEAD_QUEUED,
2384102adabSPaul E. McKenney STATE_RCU_HEAD_READY);
2394102adabSPaul E. McKenney debug_object_deactivate(head, &rcuhead_debug_descr);
2404102adabSPaul E. McKenney }
2414102adabSPaul E. McKenney #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
debug_rcu_head_queue(struct rcu_head * head)2424102adabSPaul E. McKenney static inline int debug_rcu_head_queue(struct rcu_head *head)
2434102adabSPaul E. McKenney {
2444102adabSPaul E. McKenney return 0;
2454102adabSPaul E. McKenney }
2464102adabSPaul E. McKenney
debug_rcu_head_unqueue(struct rcu_head * head)2474102adabSPaul E. McKenney static inline void debug_rcu_head_unqueue(struct rcu_head *head)
2484102adabSPaul E. McKenney {
2494102adabSPaul E. McKenney }
2504102adabSPaul E. McKenney #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
2514102adabSPaul E. McKenney
debug_rcu_head_callback(struct rcu_head * rhp)252*e160de34SZhen Lei static inline void debug_rcu_head_callback(struct rcu_head *rhp)
253*e160de34SZhen Lei {
254*e160de34SZhen Lei if (unlikely(!rhp->func))
255*e160de34SZhen Lei kmem_dump_obj(rhp);
256*e160de34SZhen Lei }
257*e160de34SZhen Lei
25858c53360SPaul E. McKenney extern int rcu_cpu_stall_suppress_at_boot;
25958c53360SPaul E. McKenney
rcu_stall_is_suppressed_at_boot(void)26058c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed_at_boot(void)
26158c53360SPaul E. McKenney {
26258c53360SPaul E. McKenney return rcu_cpu_stall_suppress_at_boot && !rcu_inkernel_boot_has_ended();
26358c53360SPaul E. McKenney }
26458c53360SPaul E. McKenney
2654102adabSPaul E. McKenney #ifdef CONFIG_RCU_STALL_COMMON
2664102adabSPaul E. McKenney
267cdc694b2SPaul E. McKenney extern int rcu_cpu_stall_ftrace_dump;
2684102adabSPaul E. McKenney extern int rcu_cpu_stall_suppress;
26910462d6fSPaul E. McKenney extern int rcu_cpu_stall_timeout;
27028b3ae42SUladzislau Rezki extern int rcu_exp_cpu_stall_timeout;
271be42f00bSZhen Lei extern int rcu_cpu_stall_cputime;
27292987fe8SPaul E. McKenney extern bool rcu_exp_stall_task_details __read_mostly;
2734102adabSPaul E. McKenney int rcu_jiffies_till_stall_check(void);
27428b3ae42SUladzislau Rezki int rcu_exp_jiffies_till_stall_check(void);
2754102adabSPaul E. McKenney
rcu_stall_is_suppressed(void)27658c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed(void)
27758c53360SPaul E. McKenney {
27858c53360SPaul E. McKenney return rcu_stall_is_suppressed_at_boot() || rcu_cpu_stall_suppress;
27958c53360SPaul E. McKenney }
28058c53360SPaul E. McKenney
281f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_suppress() \
282f22ce091SPaul E. McKenney do { \
283f22ce091SPaul E. McKenney if (!rcu_cpu_stall_suppress) \
284f22ce091SPaul E. McKenney rcu_cpu_stall_suppress = 3; \
285f22ce091SPaul E. McKenney } while (0)
286f22ce091SPaul E. McKenney
287f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_unsuppress() \
288f22ce091SPaul E. McKenney do { \
289f22ce091SPaul E. McKenney if (rcu_cpu_stall_suppress == 3) \
290f22ce091SPaul E. McKenney rcu_cpu_stall_suppress = 0; \
291f22ce091SPaul E. McKenney } while (0)
292f22ce091SPaul E. McKenney
293f22ce091SPaul E. McKenney #else /* #endif #ifdef CONFIG_RCU_STALL_COMMON */
29458c53360SPaul E. McKenney
rcu_stall_is_suppressed(void)29558c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed(void)
29658c53360SPaul E. McKenney {
29758c53360SPaul E. McKenney return rcu_stall_is_suppressed_at_boot();
29858c53360SPaul E. McKenney }
299f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_suppress()
300f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_unsuppress()
3014102adabSPaul E. McKenney #endif /* #ifdef CONFIG_RCU_STALL_COMMON */
3024102adabSPaul E. McKenney
3034102adabSPaul E. McKenney /*
3044102adabSPaul E. McKenney * Strings used in tracepoints need to be exported via the
3054102adabSPaul E. McKenney * tracing system such that tools like perf and trace-cmd can
3064102adabSPaul E. McKenney * translate the string address pointers to actual text.
3074102adabSPaul E. McKenney */
3084102adabSPaul E. McKenney #define TPS(x) tracepoint_string(x)
3094102adabSPaul E. McKenney
310b8989b76SPaul E. McKenney /*
311b8989b76SPaul E. McKenney * Dump the ftrace buffer, but only one time per callsite per boot.
312b8989b76SPaul E. McKenney */
313b8989b76SPaul E. McKenney #define rcu_ftrace_dump(oops_dump_mode) \
314b8989b76SPaul E. McKenney do { \
315b8989b76SPaul E. McKenney static atomic_t ___rfd_beenhere = ATOMIC_INIT(0); \
316b8989b76SPaul E. McKenney \
317b8989b76SPaul E. McKenney if (!atomic_read(&___rfd_beenhere) && \
31883b6ca1fSPaul E. McKenney !atomic_xchg(&___rfd_beenhere, 1)) { \
31983b6ca1fSPaul E. McKenney tracing_off(); \
320f22ce091SPaul E. McKenney rcu_ftrace_dump_stall_suppress(); \
321b8989b76SPaul E. McKenney ftrace_dump(oops_dump_mode); \
322f22ce091SPaul E. McKenney rcu_ftrace_dump_stall_unsuppress(); \
32383b6ca1fSPaul E. McKenney } \
324b8989b76SPaul E. McKenney } while (0)
325b8989b76SPaul E. McKenney
326aa23c6fbSPranith Kumar void rcu_early_boot_tests(void);
32752d7e48bSPaul E. McKenney void rcu_test_sync_prims(void);
328aa23c6fbSPranith Kumar
3295f6130faSLai Jiangshan /*
3305f6130faSLai Jiangshan * This function really isn't for public consumption, but RCU is special in
3315f6130faSLai Jiangshan * that context switches can allow the state machine to make progress.
3325f6130faSLai Jiangshan */
3335f6130faSLai Jiangshan extern void resched_cpu(int cpu);
3345f6130faSLai Jiangshan
3350cd7e350SPaul E. McKenney #if !defined(CONFIG_TINY_RCU)
3362b34c43cSPaul E. McKenney
3372b34c43cSPaul E. McKenney #include <linux/rcu_node_tree.h>
3382b34c43cSPaul E. McKenney
3392b34c43cSPaul E. McKenney extern int rcu_num_lvls;
340e95d68d2SPaul E. McKenney extern int num_rcu_lvl[];
3412b34c43cSPaul E. McKenney extern int rcu_num_nodes;
3422b34c43cSPaul E. McKenney static bool rcu_fanout_exact;
3432b34c43cSPaul E. McKenney static int rcu_fanout_leaf;
3442b34c43cSPaul E. McKenney
3452b34c43cSPaul E. McKenney /*
3462b34c43cSPaul E. McKenney * Compute the per-level fanout, either using the exact fanout specified
3472b34c43cSPaul E. McKenney * or balancing the tree, depending on the rcu_fanout_exact boot parameter.
3482b34c43cSPaul E. McKenney */
rcu_init_levelspread(int * levelspread,const int * levelcnt)3492b34c43cSPaul E. McKenney static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
3502b34c43cSPaul E. McKenney {
3512b34c43cSPaul E. McKenney int i;
3522b34c43cSPaul E. McKenney
35336b5dae6SPaul E. McKenney for (i = 0; i < RCU_NUM_LVLS; i++)
35436b5dae6SPaul E. McKenney levelspread[i] = INT_MIN;
3552b34c43cSPaul E. McKenney if (rcu_fanout_exact) {
3562b34c43cSPaul E. McKenney levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
3572b34c43cSPaul E. McKenney for (i = rcu_num_lvls - 2; i >= 0; i--)
3582b34c43cSPaul E. McKenney levelspread[i] = RCU_FANOUT;
3592b34c43cSPaul E. McKenney } else {
3602b34c43cSPaul E. McKenney int ccur;
3612b34c43cSPaul E. McKenney int cprv;
3622b34c43cSPaul E. McKenney
3632b34c43cSPaul E. McKenney cprv = nr_cpu_ids;
3642b34c43cSPaul E. McKenney for (i = rcu_num_lvls - 1; i >= 0; i--) {
3652b34c43cSPaul E. McKenney ccur = levelcnt[i];
3662b34c43cSPaul E. McKenney levelspread[i] = (cprv + ccur - 1) / ccur;
3672b34c43cSPaul E. McKenney cprv = ccur;
3682b34c43cSPaul E. McKenney }
3692b34c43cSPaul E. McKenney }
3702b34c43cSPaul E. McKenney }
3712b34c43cSPaul E. McKenney
372b5befe84SFrederic Weisbecker extern void rcu_init_geometry(void);
373b5befe84SFrederic Weisbecker
3747f87c036SPaul E. McKenney /* Returns a pointer to the first leaf rcu_node structure. */
375aedf4ba9SPaul E. McKenney #define rcu_first_leaf_node() (rcu_state.level[rcu_num_lvls - 1])
3765b4c11d5SPaul E. McKenney
3775b4c11d5SPaul E. McKenney /* Is this rcu_node a leaf? */
3785b4c11d5SPaul E. McKenney #define rcu_is_leaf_node(rnp) ((rnp)->level == rcu_num_lvls - 1)
3795b4c11d5SPaul E. McKenney
3805257514dSPaul E. McKenney /* Is this rcu_node the last leaf? */
381aedf4ba9SPaul E. McKenney #define rcu_is_last_leaf_node(rnp) ((rnp) == &rcu_state.node[rcu_num_nodes - 1])
3825257514dSPaul E. McKenney
383efbe451dSPaul E. McKenney /*
384aedf4ba9SPaul E. McKenney * Do a full breadth-first scan of the {s,}rcu_node structures for the
3857f87c036SPaul E. McKenney * specified state structure (for SRCU) or the only rcu_state structure
3867f87c036SPaul E. McKenney * (for RCU).
387efbe451dSPaul E. McKenney */
38895433f72SPaul E. McKenney #define _rcu_for_each_node_breadth_first(sp, rnp) \
389aedf4ba9SPaul E. McKenney for ((rnp) = &(sp)->node[0]; \
390aedf4ba9SPaul E. McKenney (rnp) < &(sp)->node[rcu_num_nodes]; (rnp)++)
391aedf4ba9SPaul E. McKenney #define rcu_for_each_node_breadth_first(rnp) \
39295433f72SPaul E. McKenney _rcu_for_each_node_breadth_first(&rcu_state, rnp)
39395433f72SPaul E. McKenney #define srcu_for_each_node_breadth_first(ssp, rnp) \
39495433f72SPaul E. McKenney _rcu_for_each_node_breadth_first(ssp->srcu_sup, rnp)
395efbe451dSPaul E. McKenney
396efbe451dSPaul E. McKenney /*
3977f87c036SPaul E. McKenney * Scan the leaves of the rcu_node hierarchy for the rcu_state structure.
3987f87c036SPaul E. McKenney * Note that if there is a singleton rcu_node tree with but one rcu_node
3997f87c036SPaul E. McKenney * structure, this loop -will- visit the rcu_node structure. It is still
4007f87c036SPaul E. McKenney * a leaf node, even if it is also the root node.
401efbe451dSPaul E. McKenney */
402aedf4ba9SPaul E. McKenney #define rcu_for_each_leaf_node(rnp) \
403aedf4ba9SPaul E. McKenney for ((rnp) = rcu_first_leaf_node(); \
404aedf4ba9SPaul E. McKenney (rnp) < &rcu_state.node[rcu_num_nodes]; (rnp)++)
405efbe451dSPaul E. McKenney
406efbe451dSPaul E. McKenney /*
407efbe451dSPaul E. McKenney * Iterate over all possible CPUs in a leaf RCU node.
408efbe451dSPaul E. McKenney */
409efbe451dSPaul E. McKenney #define for_each_leaf_node_possible_cpu(rnp, cpu) \
41082dd8419SPaul E. McKenney for (WARN_ON_ONCE(!rcu_is_leaf_node(rnp)), \
41182dd8419SPaul E. McKenney (cpu) = cpumask_next((rnp)->grplo - 1, cpu_possible_mask); \
41265963d24SPaul E. McKenney (cpu) <= rnp->grphi; \
41365963d24SPaul E. McKenney (cpu) = cpumask_next((cpu), cpu_possible_mask))
41465963d24SPaul E. McKenney
41565963d24SPaul E. McKenney /*
41665963d24SPaul E. McKenney * Iterate over all CPUs in a leaf RCU node's specified mask.
41765963d24SPaul E. McKenney */
41865963d24SPaul E. McKenney #define rcu_find_next_bit(rnp, cpu, mask) \
41965963d24SPaul E. McKenney ((rnp)->grplo + find_next_bit(&(mask), BITS_PER_LONG, (cpu)))
42065963d24SPaul E. McKenney #define for_each_leaf_node_cpu_mask(rnp, cpu, mask) \
42182dd8419SPaul E. McKenney for (WARN_ON_ONCE(!rcu_is_leaf_node(rnp)), \
42282dd8419SPaul E. McKenney (cpu) = rcu_find_next_bit((rnp), 0, (mask)); \
42365963d24SPaul E. McKenney (cpu) <= rnp->grphi; \
42465963d24SPaul E. McKenney (cpu) = rcu_find_next_bit((rnp), (cpu) + 1 - (rnp->grplo), (mask)))
425efbe451dSPaul E. McKenney
4260cd7e350SPaul E. McKenney #endif /* !defined(CONFIG_TINY_RCU) */
4270cd7e350SPaul E. McKenney
4280cd7e350SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) || defined(CONFIG_TASKS_RCU_GENERIC)
4290cd7e350SPaul E. McKenney
43083d40bd3SPaul E. McKenney /*
43183d40bd3SPaul E. McKenney * Wrappers for the rcu_node::lock acquire and release.
43283d40bd3SPaul E. McKenney *
43383d40bd3SPaul E. McKenney * Because the rcu_nodes form a tree, the tree traversal locking will observe
43483d40bd3SPaul E. McKenney * different lock values, this in turn means that an UNLOCK of one level
43583d40bd3SPaul E. McKenney * followed by a LOCK of another level does not imply a full memory barrier;
43683d40bd3SPaul E. McKenney * and most importantly transitivity is lost.
43783d40bd3SPaul E. McKenney *
43883d40bd3SPaul E. McKenney * In order to restore full ordering between tree levels, augment the regular
43983d40bd3SPaul E. McKenney * lock acquire functions with smp_mb__after_unlock_lock().
44083d40bd3SPaul E. McKenney *
44183d40bd3SPaul E. McKenney * As ->lock of struct rcu_node is a __private field, therefore one should use
44283d40bd3SPaul E. McKenney * these wrappers rather than directly call raw_spin_{lock,unlock}* on ->lock.
44383d40bd3SPaul E. McKenney */
44483d40bd3SPaul E. McKenney #define raw_spin_lock_rcu_node(p) \
44583d40bd3SPaul E. McKenney do { \
44683d40bd3SPaul E. McKenney raw_spin_lock(&ACCESS_PRIVATE(p, lock)); \
44783d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \
44883d40bd3SPaul E. McKenney } while (0)
44983d40bd3SPaul E. McKenney
4507dffe017SPaul E. McKenney #define raw_spin_unlock_rcu_node(p) \
4517dffe017SPaul E. McKenney do { \
4527dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \
4537dffe017SPaul E. McKenney raw_spin_unlock(&ACCESS_PRIVATE(p, lock)); \
4547dffe017SPaul E. McKenney } while (0)
45583d40bd3SPaul E. McKenney
45683d40bd3SPaul E. McKenney #define raw_spin_lock_irq_rcu_node(p) \
45783d40bd3SPaul E. McKenney do { \
45883d40bd3SPaul E. McKenney raw_spin_lock_irq(&ACCESS_PRIVATE(p, lock)); \
45983d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \
46083d40bd3SPaul E. McKenney } while (0)
46183d40bd3SPaul E. McKenney
46283d40bd3SPaul E. McKenney #define raw_spin_unlock_irq_rcu_node(p) \
4637dffe017SPaul E. McKenney do { \
4647dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \
4657dffe017SPaul E. McKenney raw_spin_unlock_irq(&ACCESS_PRIVATE(p, lock)); \
4667dffe017SPaul E. McKenney } while (0)
46783d40bd3SPaul E. McKenney
4684e4bea74SPaul E. McKenney #define raw_spin_lock_irqsave_rcu_node(p, flags) \
46983d40bd3SPaul E. McKenney do { \
4704e4bea74SPaul E. McKenney raw_spin_lock_irqsave(&ACCESS_PRIVATE(p, lock), flags); \
47183d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \
47283d40bd3SPaul E. McKenney } while (0)
47383d40bd3SPaul E. McKenney
4744e4bea74SPaul E. McKenney #define raw_spin_unlock_irqrestore_rcu_node(p, flags) \
4757dffe017SPaul E. McKenney do { \
4767dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \
4777dffe017SPaul E. McKenney raw_spin_unlock_irqrestore(&ACCESS_PRIVATE(p, lock), flags); \
4787dffe017SPaul E. McKenney } while (0)
47983d40bd3SPaul E. McKenney
48083d40bd3SPaul E. McKenney #define raw_spin_trylock_rcu_node(p) \
48183d40bd3SPaul E. McKenney ({ \
48283d40bd3SPaul E. McKenney bool ___locked = raw_spin_trylock(&ACCESS_PRIVATE(p, lock)); \
48383d40bd3SPaul E. McKenney \
48483d40bd3SPaul E. McKenney if (___locked) \
48583d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \
48683d40bd3SPaul E. McKenney ___locked; \
48783d40bd3SPaul E. McKenney })
48883d40bd3SPaul E. McKenney
489a32e01eeSMatthew Wilcox #define raw_lockdep_assert_held_rcu_node(p) \
490a32e01eeSMatthew Wilcox lockdep_assert_held(&ACCESS_PRIVATE(p, lock))
491a32e01eeSMatthew Wilcox
4920cd7e350SPaul E. McKenney #endif // #if !defined(CONFIG_TINY_RCU) || defined(CONFIG_TASKS_RCU_GENERIC)
4932b34c43cSPaul E. McKenney
49425c36329SPaul E. McKenney #ifdef CONFIG_TINY_RCU
49525c36329SPaul E. McKenney /* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */
rcu_gp_is_normal(void)4967414fac0SPaul E. McKenney static inline bool rcu_gp_is_normal(void) { return true; }
rcu_gp_is_expedited(void)4977414fac0SPaul E. McKenney static inline bool rcu_gp_is_expedited(void) { return false; }
rcu_async_should_hurry(void)4986efdda8bSJoel Fernandes (Google) static inline bool rcu_async_should_hurry(void) { return false; }
rcu_expedite_gp(void)4997414fac0SPaul E. McKenney static inline void rcu_expedite_gp(void) { }
rcu_unexpedite_gp(void)5007414fac0SPaul E. McKenney static inline void rcu_unexpedite_gp(void) { }
rcu_async_hurry(void)5016efdda8bSJoel Fernandes (Google) static inline void rcu_async_hurry(void) { }
rcu_async_relax(void)5026efdda8bSJoel Fernandes (Google) static inline void rcu_async_relax(void) { }
rcu_cpu_online(int cpu)503547c59c8SFrederic Weisbecker static inline bool rcu_cpu_online(int cpu) { return true; }
50425c36329SPaul E. McKenney #else /* #ifdef CONFIG_TINY_RCU */
50525c36329SPaul E. McKenney bool rcu_gp_is_normal(void); /* Internal RCU use. */
50625c36329SPaul E. McKenney bool rcu_gp_is_expedited(void); /* Internal RCU use. */
5076efdda8bSJoel Fernandes (Google) bool rcu_async_should_hurry(void); /* Internal RCU use. */
50825c36329SPaul E. McKenney void rcu_expedite_gp(void);
50925c36329SPaul E. McKenney void rcu_unexpedite_gp(void);
5106efdda8bSJoel Fernandes (Google) void rcu_async_hurry(void);
5116efdda8bSJoel Fernandes (Google) void rcu_async_relax(void);
51225c36329SPaul E. McKenney void rcupdate_announce_bootup_oddness(void);
513547c59c8SFrederic Weisbecker bool rcu_cpu_online(int cpu);
514474d0997SPaul E. McKenney #ifdef CONFIG_TASKS_RCU_GENERIC
515e21408ceSPaul E. McKenney void show_rcu_tasks_gp_kthreads(void);
516474d0997SPaul E. McKenney #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
show_rcu_tasks_gp_kthreads(void)517474d0997SPaul E. McKenney static inline void show_rcu_tasks_gp_kthreads(void) {}
518474d0997SPaul E. McKenney #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */
51925c36329SPaul E. McKenney #endif /* #else #ifdef CONFIG_TINY_RCU */
52025c36329SPaul E. McKenney
521e0a34641SArnd Bergmann #ifdef CONFIG_TASKS_RCU
522e0a34641SArnd Bergmann struct task_struct *get_rcu_tasks_gp_kthread(void);
523e0a34641SArnd Bergmann #endif // # ifdef CONFIG_TASKS_RCU
524e0a34641SArnd Bergmann
525e0a34641SArnd Bergmann #ifdef CONFIG_TASKS_RUDE_RCU
526e0a34641SArnd Bergmann struct task_struct *get_rcu_tasks_rude_gp_kthread(void);
527e0a34641SArnd Bergmann #endif // # ifdef CONFIG_TASKS_RUDE_RCU
528e0a34641SArnd Bergmann
52982118249SPaul E. McKenney #define RCU_SCHEDULER_INACTIVE 0
53082118249SPaul E. McKenney #define RCU_SCHEDULER_INIT 1
53182118249SPaul E. McKenney #define RCU_SCHEDULER_RUNNING 2
53282118249SPaul E. McKenney
533cad7b389SPaul E. McKenney enum rcutorture_type {
534cad7b389SPaul E. McKenney RCU_FLAVOR,
535cad7b389SPaul E. McKenney RCU_TASKS_FLAVOR,
5363d6e43c7SPaul E. McKenney RCU_TASKS_RUDE_FLAVOR,
537c1a76c0bSPaul E. McKenney RCU_TASKS_TRACING_FLAVOR,
538c682db55SPaul E. McKenney RCU_TRIVIAL_FLAVOR,
539cad7b389SPaul E. McKenney SRCU_FLAVOR,
540cad7b389SPaul E. McKenney INVALID_RCU_FLAVOR
541cad7b389SPaul E. McKenney };
542cad7b389SPaul E. McKenney
5433cb278e7SJoel Fernandes (Google) #if defined(CONFIG_RCU_LAZY)
5443cb278e7SJoel Fernandes (Google) unsigned long rcu_lazy_get_jiffies_till_flush(void);
5453cb278e7SJoel Fernandes (Google) void rcu_lazy_set_jiffies_till_flush(unsigned long j);
5463cb278e7SJoel Fernandes (Google) #else
rcu_lazy_get_jiffies_till_flush(void)5473cb278e7SJoel Fernandes (Google) static inline unsigned long rcu_lazy_get_jiffies_till_flush(void) { return 0; }
rcu_lazy_set_jiffies_till_flush(unsigned long j)5483cb278e7SJoel Fernandes (Google) static inline void rcu_lazy_set_jiffies_till_flush(unsigned long j) { }
5493cb278e7SJoel Fernandes (Google) #endif
5503cb278e7SJoel Fernandes (Google)
551b3e627d3SLai Jiangshan #if defined(CONFIG_TREE_RCU)
552cad7b389SPaul E. McKenney void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
553aebc8264SPaul E. McKenney unsigned long *gp_seq);
554cad7b389SPaul E. McKenney void do_trace_rcu_torture_read(const char *rcutorturename,
555cad7b389SPaul E. McKenney struct rcu_head *rhp,
556cad7b389SPaul E. McKenney unsigned long secs,
557cad7b389SPaul E. McKenney unsigned long c_old,
558cad7b389SPaul E. McKenney unsigned long c);
55955b2dcf5SPaul E. McKenney void rcu_gp_set_torture_wait(int duration);
560cad7b389SPaul E. McKenney #else
rcutorture_get_gp_data(enum rcutorture_type test_type,int * flags,unsigned long * gp_seq)561cad7b389SPaul E. McKenney static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
562aebc8264SPaul E. McKenney int *flags, unsigned long *gp_seq)
563cad7b389SPaul E. McKenney {
564cad7b389SPaul E. McKenney *flags = 0;
565aebc8264SPaul E. McKenney *gp_seq = 0;
566cad7b389SPaul E. McKenney }
567cad7b389SPaul E. McKenney #ifdef CONFIG_RCU_TRACE
568cad7b389SPaul E. McKenney void do_trace_rcu_torture_read(const char *rcutorturename,
569cad7b389SPaul E. McKenney struct rcu_head *rhp,
570cad7b389SPaul E. McKenney unsigned long secs,
571cad7b389SPaul E. McKenney unsigned long c_old,
572cad7b389SPaul E. McKenney unsigned long c);
573cad7b389SPaul E. McKenney #else
574cad7b389SPaul E. McKenney #define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
575cad7b389SPaul E. McKenney do { } while (0)
576cad7b389SPaul E. McKenney #endif
rcu_gp_set_torture_wait(int duration)57755b2dcf5SPaul E. McKenney static inline void rcu_gp_set_torture_wait(int duration) { }
578cad7b389SPaul E. McKenney #endif
579cad7b389SPaul E. McKenney
580c682db55SPaul E. McKenney #if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST)
581c682db55SPaul E. McKenney long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask);
582c682db55SPaul E. McKenney #endif
583c682db55SPaul E. McKenney
584cad7b389SPaul E. McKenney #ifdef CONFIG_TINY_SRCU
585cad7b389SPaul E. McKenney
srcutorture_get_gp_data(enum rcutorture_type test_type,struct srcu_struct * sp,int * flags,unsigned long * gp_seq)586cad7b389SPaul E. McKenney static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
587cad7b389SPaul E. McKenney struct srcu_struct *sp, int *flags,
588aebc8264SPaul E. McKenney unsigned long *gp_seq)
589cad7b389SPaul E. McKenney {
590cad7b389SPaul E. McKenney if (test_type != SRCU_FLAVOR)
591cad7b389SPaul E. McKenney return;
592cad7b389SPaul E. McKenney *flags = 0;
593aebc8264SPaul E. McKenney *gp_seq = sp->srcu_idx;
594cad7b389SPaul E. McKenney }
595cad7b389SPaul E. McKenney
596cad7b389SPaul E. McKenney #elif defined(CONFIG_TREE_SRCU)
597cad7b389SPaul E. McKenney
598cad7b389SPaul E. McKenney void srcutorture_get_gp_data(enum rcutorture_type test_type,
599cad7b389SPaul E. McKenney struct srcu_struct *sp, int *flags,
600aebc8264SPaul E. McKenney unsigned long *gp_seq);
601cad7b389SPaul E. McKenney
602cad7b389SPaul E. McKenney #endif
603cad7b389SPaul E. McKenney
604e3c8d51eSPaul E. McKenney #ifdef CONFIG_TINY_RCU
rcu_dynticks_zero_in_eqs(int cpu,int * vp)6057d0c9c50SPaul E. McKenney static inline bool rcu_dynticks_zero_in_eqs(int cpu, int *vp) { return false; }
rcu_get_gp_seq(void)60617ef2fe9SPaul E. McKenney static inline unsigned long rcu_get_gp_seq(void) { return 0; }
rcu_exp_batches_completed(void)6077414fac0SPaul E. McKenney static inline unsigned long rcu_exp_batches_completed(void) { return 0; }
6087414fac0SPaul E. McKenney static inline unsigned long
srcu_batches_completed(struct srcu_struct * sp)6097414fac0SPaul E. McKenney srcu_batches_completed(struct srcu_struct *sp) { return 0; }
rcu_force_quiescent_state(void)6107414fac0SPaul E. McKenney static inline void rcu_force_quiescent_state(void) { }
rcu_check_boost_fail(unsigned long gp_state,int * cpup)6110260b92eSPaul E. McKenney static inline bool rcu_check_boost_fail(unsigned long gp_state, int *cpup) { return true; }
show_rcu_gp_kthreads(void)6127414fac0SPaul E. McKenney static inline void show_rcu_gp_kthreads(void) { }
rcu_get_gp_kthreads_prio(void)6134babd855SJoel Fernandes (Google) static inline int rcu_get_gp_kthreads_prio(void) { return 0; }
rcu_fwd_progress_check(unsigned long j)614e0aff973SPaul E. McKenney static inline void rcu_fwd_progress_check(unsigned long j) { }
rcu_gp_slow_register(atomic_t * rgssp)61599d6a2acSPaul E. McKenney static inline void rcu_gp_slow_register(atomic_t *rgssp) { }
rcu_gp_slow_unregister(atomic_t * rgssp)61699d6a2acSPaul E. McKenney static inline void rcu_gp_slow_unregister(atomic_t *rgssp) { }
617e3c8d51eSPaul E. McKenney #else /* #ifdef CONFIG_TINY_RCU */
6187d0c9c50SPaul E. McKenney bool rcu_dynticks_zero_in_eqs(int cpu, int *vp);
61917ef2fe9SPaul E. McKenney unsigned long rcu_get_gp_seq(void);
620e3c8d51eSPaul E. McKenney unsigned long rcu_exp_batches_completed(void);
6215a0465e1SPaul E. McKenney unsigned long srcu_batches_completed(struct srcu_struct *sp);
6220260b92eSPaul E. McKenney bool rcu_check_boost_fail(unsigned long gp_state, int *cpup);
623e3c8d51eSPaul E. McKenney void show_rcu_gp_kthreads(void);
6244babd855SJoel Fernandes (Google) int rcu_get_gp_kthreads_prio(void);
625e0aff973SPaul E. McKenney void rcu_fwd_progress_check(unsigned long j);
626e3c8d51eSPaul E. McKenney void rcu_force_quiescent_state(void);
627ad7c946bSPaul E. McKenney extern struct workqueue_struct *rcu_gp_wq;
6289621fbeeSKalesh Singh #ifdef CONFIG_RCU_EXP_KTHREAD
6299621fbeeSKalesh Singh extern struct kthread_worker *rcu_exp_gp_kworker;
6309621fbeeSKalesh Singh extern struct kthread_worker *rcu_exp_par_gp_kworker;
6319621fbeeSKalesh Singh #else /* !CONFIG_RCU_EXP_KTHREAD */
63225f3d7efSPaul E. McKenney extern struct workqueue_struct *rcu_par_gp_wq;
6339621fbeeSKalesh Singh #endif /* CONFIG_RCU_EXP_KTHREAD */
63499d6a2acSPaul E. McKenney void rcu_gp_slow_register(atomic_t *rgssp);
63599d6a2acSPaul E. McKenney void rcu_gp_slow_unregister(atomic_t *rgssp);
636e3c8d51eSPaul E. McKenney #endif /* #else #ifdef CONFIG_TINY_RCU */
637e3c8d51eSPaul E. McKenney
63844c65ff2SPaul E. McKenney #ifdef CONFIG_RCU_NOCB_CPU
6395ab7ab83SPaul E. McKenney void rcu_bind_current_to_nocb(void);
6403d54f798SPaul E. McKenney #else
rcu_bind_current_to_nocb(void)6415ab7ab83SPaul E. McKenney static inline void rcu_bind_current_to_nocb(void) { }
6423d54f798SPaul E. McKenney #endif
6433d54f798SPaul E. McKenney
64427c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_RCU)
64527c0f144SPaul E. McKenney void show_rcu_tasks_classic_gp_kthread(void);
64627c0f144SPaul E. McKenney #else
show_rcu_tasks_classic_gp_kthread(void)64727c0f144SPaul E. McKenney static inline void show_rcu_tasks_classic_gp_kthread(void) {}
64827c0f144SPaul E. McKenney #endif
64927c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_RUDE_RCU)
65027c0f144SPaul E. McKenney void show_rcu_tasks_rude_gp_kthread(void);
65127c0f144SPaul E. McKenney #else
show_rcu_tasks_rude_gp_kthread(void)65227c0f144SPaul E. McKenney static inline void show_rcu_tasks_rude_gp_kthread(void) {}
65327c0f144SPaul E. McKenney #endif
65427c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_TRACE_RCU)
65527c0f144SPaul E. McKenney void show_rcu_tasks_trace_gp_kthread(void);
65627c0f144SPaul E. McKenney #else
show_rcu_tasks_trace_gp_kthread(void)65727c0f144SPaul E. McKenney static inline void show_rcu_tasks_trace_gp_kthread(void) {}
65827c0f144SPaul E. McKenney #endif
65927c0f144SPaul E. McKenney
660401b0de3SPaul E. McKenney #ifdef CONFIG_TINY_RCU
rcu_cpu_beenfullyonline(int cpu)661401b0de3SPaul E. McKenney static inline bool rcu_cpu_beenfullyonline(int cpu) { return true; }
662401b0de3SPaul E. McKenney #else
663401b0de3SPaul E. McKenney bool rcu_cpu_beenfullyonline(int cpu);
664401b0de3SPaul E. McKenney #endif
665401b0de3SPaul E. McKenney
6664102adabSPaul E. McKenney #endif /* __LINUX_RCU_H */
667