tree.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Read-Copy Update mechanism for mutual exclusion (tree-based version)
  4. * Internal non-public definitions.
  5. *
  6. * Copyright IBM Corporation, 2008
  7. *
  8. * Author: Ingo Molnar <mingo@elte.hu>
  9. * Paul E. McKenney <paulmck@linux.ibm.com>
  10. */
  11. #include <linux/cache.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/rtmutex.h>
  14. #include <linux/threads.h>
  15. #include <linux/cpumask.h>
  16. #include <linux/seqlock.h>
  17. #include <linux/swait.h>
  18. #include <linux/rcu_node_tree.h>
  19. #include "rcu_segcblist.h"
  20. /* Communicate arguments to a workqueue handler. */
  21. struct rcu_exp_work {
  22. unsigned long rew_s;
  23. struct work_struct rew_work;
  24. };
  25. /* RCU's kthread states for tracing. */
  26. #define RCU_KTHREAD_STOPPED 0
  27. #define RCU_KTHREAD_RUNNING 1
  28. #define RCU_KTHREAD_WAITING 2
  29. #define RCU_KTHREAD_OFFCPU 3
  30. #define RCU_KTHREAD_YIELDING 4
  31. #define RCU_KTHREAD_MAX 4
  32. /*
  33. * Definition for node within the RCU grace-period-detection hierarchy.
  34. */
  35. struct rcu_node {
  36. raw_spinlock_t __private lock; /* Root rcu_node's lock protects */
  37. /* some rcu_state fields as well as */
  38. /* following. */
  39. unsigned long gp_seq; /* Track rsp->gp_seq. */
  40. unsigned long gp_seq_needed; /* Track furthest future GP request. */
  41. unsigned long completedqs; /* All QSes done for this node. */
  42. unsigned long qsmask; /* CPUs or groups that need to switch in */
  43. /* order for current grace period to proceed.*/
  44. /* In leaf rcu_node, each bit corresponds to */
  45. /* an rcu_data structure, otherwise, each */
  46. /* bit corresponds to a child rcu_node */
  47. /* structure. */
  48. unsigned long rcu_gp_init_mask; /* Mask of offline CPUs at GP init. */
  49. unsigned long qsmaskinit;
  50. /* Per-GP initial value for qsmask. */
  51. /* Initialized from ->qsmaskinitnext at the */
  52. /* beginning of each grace period. */
  53. unsigned long qsmaskinitnext;
  54. /* Online CPUs for next grace period. */
  55. unsigned long expmask; /* CPUs or groups that need to check in */
  56. /* to allow the current expedited GP */
  57. /* to complete. */
  58. unsigned long expmaskinit;
  59. /* Per-GP initial values for expmask. */
  60. /* Initialized from ->expmaskinitnext at the */
  61. /* beginning of each expedited GP. */
  62. unsigned long expmaskinitnext;
  63. /* Online CPUs for next expedited GP. */
  64. /* Any CPU that has ever been online will */
  65. /* have its bit set. */
  66. unsigned long cbovldmask;
  67. /* CPUs experiencing callback overload. */
  68. unsigned long ffmask; /* Fully functional CPUs. */
  69. unsigned long grpmask; /* Mask to apply to parent qsmask. */
  70. /* Only one bit will be set in this mask. */
  71. int grplo; /* lowest-numbered CPU here. */
  72. int grphi; /* highest-numbered CPU here. */
  73. u8 grpnum; /* group number for next level up. */
  74. u8 level; /* root is at level 0. */
  75. bool wait_blkd_tasks;/* Necessary to wait for blocked tasks to */
  76. /* exit RCU read-side critical sections */
  77. /* before propagating offline up the */
  78. /* rcu_node tree? */
  79. struct rcu_node *parent;
  80. struct list_head blkd_tasks;
  81. /* Tasks blocked in RCU read-side critical */
  82. /* section. Tasks are placed at the head */
  83. /* of this list and age towards the tail. */
  84. struct list_head *gp_tasks;
  85. /* Pointer to the first task blocking the */
  86. /* current grace period, or NULL if there */
  87. /* is no such task. */
  88. struct list_head *exp_tasks;
  89. /* Pointer to the first task blocking the */
  90. /* current expedited grace period, or NULL */
  91. /* if there is no such task. If there */
  92. /* is no current expedited grace period, */
  93. /* then there can cannot be any such task. */
  94. struct list_head *boost_tasks;
  95. /* Pointer to first task that needs to be */
  96. /* priority boosted, or NULL if no priority */
  97. /* boosting is needed for this rcu_node */
  98. /* structure. If there are no tasks */
  99. /* queued on this rcu_node structure that */
  100. /* are blocking the current grace period, */
  101. /* there can be no such task. */
  102. struct rt_mutex boost_mtx;
  103. /* Used only for the priority-boosting */
  104. /* side effect, not as a lock. */
  105. unsigned long boost_time;
  106. /* When to start boosting (jiffies). */
  107. struct task_struct *boost_kthread_task;
  108. /* kthread that takes care of priority */
  109. /* boosting for this rcu_node structure. */
  110. unsigned int boost_kthread_status;
  111. /* State of boost_kthread_task for tracing. */
  112. #ifdef CONFIG_RCU_NOCB_CPU
  113. struct swait_queue_head nocb_gp_wq[2];
  114. /* Place for rcu_nocb_kthread() to wait GP. */
  115. #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
  116. raw_spinlock_t fqslock ____cacheline_internodealigned_in_smp;
  117. spinlock_t exp_lock ____cacheline_internodealigned_in_smp;
  118. unsigned long exp_seq_rq;
  119. wait_queue_head_t exp_wq[4];
  120. struct rcu_exp_work rew;
  121. bool exp_need_flush; /* Need to flush workitem? */
  122. } ____cacheline_internodealigned_in_smp;
  123. /*
  124. * Bitmasks in an rcu_node cover the interval [grplo, grphi] of CPU IDs, and
  125. * are indexed relative to this interval rather than the global CPU ID space.
  126. * This generates the bit for a CPU in node-local masks.
  127. */
  128. #define leaf_node_cpu_bit(rnp, cpu) (BIT((cpu) - (rnp)->grplo))
  129. /*
  130. * Union to allow "aggregate OR" operation on the need for a quiescent
  131. * state by the normal and expedited grace periods.
  132. */
  133. union rcu_noqs {
  134. struct {
  135. u8 norm;
  136. u8 exp;
  137. } b; /* Bits. */
  138. u16 s; /* Set of bits, aggregate OR here. */
  139. };
  140. /* Per-CPU data for read-copy update. */
  141. struct rcu_data {
  142. /* 1) quiescent-state and grace-period handling : */
  143. unsigned long gp_seq; /* Track rsp->gp_seq counter. */
  144. unsigned long gp_seq_needed; /* Track furthest future GP request. */
  145. union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */
  146. bool core_needs_qs; /* Core waits for quiesc state. */
  147. bool beenonline; /* CPU online at least once. */
  148. bool gpwrap; /* Possible ->gp_seq wrap. */
  149. bool exp_deferred_qs; /* This CPU awaiting a deferred QS? */
  150. bool cpu_started; /* RCU watching this onlining CPU. */
  151. struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
  152. unsigned long grpmask; /* Mask to apply to leaf qsmask. */
  153. unsigned long ticks_this_gp; /* The number of scheduling-clock */
  154. /* ticks this CPU has handled */
  155. /* during and after the last grace */
  156. /* period it is aware of. */
  157. struct irq_work defer_qs_iw; /* Obtain later scheduler attention. */
  158. bool defer_qs_iw_pending; /* Scheduler attention pending? */
  159. struct work_struct strict_work; /* Schedule readers for strict GPs. */
  160. /* 2) batch handling */
  161. struct rcu_segcblist cblist; /* Segmented callback list, with */
  162. /* different callbacks waiting for */
  163. /* different grace periods. */
  164. long qlen_last_fqs_check;
  165. /* qlen at last check for QS forcing */
  166. unsigned long n_cbs_invoked; /* # callbacks invoked since boot. */
  167. unsigned long n_force_qs_snap;
  168. /* did other CPU force QS recently? */
  169. long blimit; /* Upper limit on a processed batch */
  170. /* 3) dynticks interface. */
  171. int dynticks_snap; /* Per-GP tracking for dynticks. */
  172. long dynticks_nesting; /* Track process nesting level. */
  173. long dynticks_nmi_nesting; /* Track irq/NMI nesting level. */
  174. atomic_t dynticks; /* Even value for idle, else odd. */
  175. bool rcu_need_heavy_qs; /* GP old, so heavy quiescent state! */
  176. bool rcu_urgent_qs; /* GP old need light quiescent state. */
  177. bool rcu_forced_tick; /* Forced tick to provide QS. */
  178. bool rcu_forced_tick_exp; /* ... provide QS to expedited GP. */
  179. #ifdef CONFIG_RCU_FAST_NO_HZ
  180. unsigned long last_accelerate; /* Last jiffy CBs were accelerated. */
  181. unsigned long last_advance_all; /* Last jiffy CBs were all advanced. */
  182. int tick_nohz_enabled_snap; /* Previously seen value from sysfs. */
  183. #endif /* #ifdef CONFIG_RCU_FAST_NO_HZ */
  184. /* 4) rcu_barrier(), OOM callbacks, and expediting. */
  185. struct rcu_head barrier_head;
  186. int exp_dynticks_snap; /* Double-check need for IPI. */
  187. /* 5) Callback offloading. */
  188. #ifdef CONFIG_RCU_NOCB_CPU
  189. struct swait_queue_head nocb_cb_wq; /* For nocb kthreads to sleep on. */
  190. struct task_struct *nocb_gp_kthread;
  191. raw_spinlock_t nocb_lock; /* Guard following pair of fields. */
  192. atomic_t nocb_lock_contended; /* Contention experienced. */
  193. int nocb_defer_wakeup; /* Defer wakeup of nocb_kthread. */
  194. struct timer_list nocb_timer; /* Enforce finite deferral. */
  195. unsigned long nocb_gp_adv_time; /* Last call_rcu() CB adv (jiffies). */
  196. /* The following fields are used by call_rcu, hence own cacheline. */
  197. raw_spinlock_t nocb_bypass_lock ____cacheline_internodealigned_in_smp;
  198. struct rcu_cblist nocb_bypass; /* Lock-contention-bypass CB list. */
  199. unsigned long nocb_bypass_first; /* Time (jiffies) of first enqueue. */
  200. unsigned long nocb_nobypass_last; /* Last ->cblist enqueue (jiffies). */
  201. int nocb_nobypass_count; /* # ->cblist enqueues at ^^^ time. */
  202. /* The following fields are used by GP kthread, hence own cacheline. */
  203. raw_spinlock_t nocb_gp_lock ____cacheline_internodealigned_in_smp;
  204. struct timer_list nocb_bypass_timer; /* Force nocb_bypass flush. */
  205. u8 nocb_gp_sleep; /* Is the nocb GP thread asleep? */
  206. u8 nocb_gp_bypass; /* Found a bypass on last scan? */
  207. u8 nocb_gp_gp; /* GP to wait for on last scan? */
  208. unsigned long nocb_gp_seq; /* If so, ->gp_seq to wait for. */
  209. unsigned long nocb_gp_loops; /* # passes through wait code. */
  210. struct swait_queue_head nocb_gp_wq; /* For nocb kthreads to sleep on. */
  211. bool nocb_cb_sleep; /* Is the nocb CB thread asleep? */
  212. struct task_struct *nocb_cb_kthread;
  213. struct rcu_data *nocb_next_cb_rdp;
  214. /* Next rcu_data in wakeup chain. */
  215. /* The following fields are used by CB kthread, hence new cacheline. */
  216. struct rcu_data *nocb_gp_rdp ____cacheline_internodealigned_in_smp;
  217. /* GP rdp takes GP-end wakeups. */
  218. #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
  219. /* 6) RCU priority boosting. */
  220. struct task_struct *rcu_cpu_kthread_task;
  221. /* rcuc per-CPU kthread or NULL. */
  222. unsigned int rcu_cpu_kthread_status;
  223. char rcu_cpu_has_work;
  224. /* 7) Diagnostic data, including RCU CPU stall warnings. */
  225. unsigned int softirq_snap; /* Snapshot of softirq activity. */
  226. /* ->rcu_iw* fields protected by leaf rcu_node ->lock. */
  227. struct irq_work rcu_iw; /* Check for non-irq activity. */
  228. bool rcu_iw_pending; /* Is ->rcu_iw pending? */
  229. unsigned long rcu_iw_gp_seq; /* ->gp_seq associated with ->rcu_iw. */
  230. unsigned long rcu_ofl_gp_seq; /* ->gp_seq at last offline. */
  231. short rcu_ofl_gp_flags; /* ->gp_flags at last offline. */
  232. unsigned long rcu_onl_gp_seq; /* ->gp_seq at last online. */
  233. short rcu_onl_gp_flags; /* ->gp_flags at last online. */
  234. unsigned long last_fqs_resched; /* Time of last rcu_resched(). */
  235. int cpu;
  236. };
  237. /* Values for nocb_defer_wakeup field in struct rcu_data. */
  238. #define RCU_NOCB_WAKE_NOT 0
  239. #define RCU_NOCB_WAKE 1
  240. #define RCU_NOCB_WAKE_FORCE 2
  241. #define RCU_JIFFIES_TILL_FORCE_QS (1 + (HZ > 250) + (HZ > 500))
  242. /* For jiffies_till_first_fqs and */
  243. /* and jiffies_till_next_fqs. */
  244. #define RCU_JIFFIES_FQS_DIV 256 /* Very large systems need more */
  245. /* delay between bouts of */
  246. /* quiescent-state forcing. */
  247. #define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time to take */
  248. /* at least one scheduling clock */
  249. /* irq before ratting on them. */
  250. #define rcu_wait(cond) \
  251. do { \
  252. for (;;) { \
  253. set_current_state(TASK_INTERRUPTIBLE); \
  254. if (cond) \
  255. break; \
  256. schedule(); \
  257. } \
  258. __set_current_state(TASK_RUNNING); \
  259. } while (0)
  260. /*
  261. * RCU global state, including node hierarchy. This hierarchy is
  262. * represented in "heap" form in a dense array. The root (first level)
  263. * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
  264. * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
  265. * and the third level in ->node[m+1] and following (->node[m+1] referenced
  266. * by ->level[2]). The number of levels is determined by the number of
  267. * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy"
  268. * consisting of a single rcu_node.
  269. */
  270. struct rcu_state {
  271. struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */
  272. struct rcu_node *level[RCU_NUM_LVLS + 1];
  273. /* Hierarchy levels (+1 to */
  274. /* shut bogus gcc warning) */
  275. int ncpus; /* # CPUs seen so far. */
  276. /* The following fields are guarded by the root rcu_node's lock. */
  277. u8 boost ____cacheline_internodealigned_in_smp;
  278. /* Subject to priority boost. */
  279. unsigned long gp_seq; /* Grace-period sequence #. */
  280. unsigned long gp_max; /* Maximum GP duration in */
  281. /* jiffies. */
  282. struct task_struct *gp_kthread; /* Task for grace periods. */
  283. struct swait_queue_head gp_wq; /* Where GP task waits. */
  284. short gp_flags; /* Commands for GP task. */
  285. short gp_state; /* GP kthread sleep state. */
  286. unsigned long gp_wake_time; /* Last GP kthread wake. */
  287. unsigned long gp_wake_seq; /* ->gp_seq at ^^^. */
  288. /* End of fields guarded by root rcu_node's lock. */
  289. struct mutex barrier_mutex; /* Guards barrier fields. */
  290. atomic_t barrier_cpu_count; /* # CPUs waiting on. */
  291. struct completion barrier_completion; /* Wake at barrier end. */
  292. unsigned long barrier_sequence; /* ++ at start and end of */
  293. /* rcu_barrier(). */
  294. /* End of fields guarded by barrier_mutex. */
  295. struct mutex exp_mutex; /* Serialize expedited GP. */
  296. struct mutex exp_wake_mutex; /* Serialize wakeup. */
  297. unsigned long expedited_sequence; /* Take a ticket. */
  298. atomic_t expedited_need_qs; /* # CPUs left to check in. */
  299. struct swait_queue_head expedited_wq; /* Wait for check-ins. */
  300. int ncpus_snap; /* # CPUs seen last time. */
  301. u8 cbovld; /* Callback overload now? */
  302. u8 cbovldnext; /* ^ ^ next time? */
  303. unsigned long jiffies_force_qs; /* Time at which to invoke */
  304. /* force_quiescent_state(). */
  305. unsigned long jiffies_kick_kthreads; /* Time at which to kick */
  306. /* kthreads, if configured. */
  307. unsigned long n_force_qs; /* Number of calls to */
  308. /* force_quiescent_state(). */
  309. unsigned long gp_start; /* Time at which GP started, */
  310. /* but in jiffies. */
  311. unsigned long gp_end; /* Time last GP ended, again */
  312. /* in jiffies. */
  313. unsigned long gp_activity; /* Time of last GP kthread */
  314. /* activity in jiffies. */
  315. unsigned long gp_req_activity; /* Time of last GP request */
  316. /* in jiffies. */
  317. unsigned long jiffies_stall; /* Time at which to check */
  318. /* for CPU stalls. */
  319. unsigned long jiffies_resched; /* Time at which to resched */
  320. /* a reluctant CPU. */
  321. unsigned long n_force_qs_gpstart; /* Snapshot of n_force_qs at */
  322. /* GP start. */
  323. const char *name; /* Name of structure. */
  324. char abbr; /* Abbreviated name. */
  325. raw_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
  326. /* Synchronize offline with */
  327. /* GP pre-initialization. */
  328. };
  329. /* Values for rcu_state structure's gp_flags field. */
  330. #define RCU_GP_FLAG_INIT 0x1 /* Need grace-period initialization. */
  331. #define RCU_GP_FLAG_FQS 0x2 /* Need grace-period quiescent-state forcing. */
  332. #define RCU_GP_FLAG_OVLD 0x4 /* Experiencing callback overload. */
  333. /* Values for rcu_state structure's gp_state field. */
  334. #define RCU_GP_IDLE 0 /* Initial state and no GP in progress. */
  335. #define RCU_GP_WAIT_GPS 1 /* Wait for grace-period start. */
  336. #define RCU_GP_DONE_GPS 2 /* Wait done for grace-period start. */
  337. #define RCU_GP_ONOFF 3 /* Grace-period initialization hotplug. */
  338. #define RCU_GP_INIT 4 /* Grace-period initialization. */
  339. #define RCU_GP_WAIT_FQS 5 /* Wait for force-quiescent-state time. */
  340. #define RCU_GP_DOING_FQS 6 /* Wait done for force-quiescent-state time. */
  341. #define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */
  342. #define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */
  343. /*
  344. * In order to export the rcu_state name to the tracing tools, it
  345. * needs to be added in the __tracepoint_string section.
  346. * This requires defining a separate variable tp_<sname>_varname
  347. * that points to the string being used, and this will allow
  348. * the tracing userspace tools to be able to decipher the string
  349. * address to the matching string.
  350. */
  351. #ifdef CONFIG_PREEMPT_RCU
  352. #define RCU_ABBR 'p'
  353. #define RCU_NAME_RAW "rcu_preempt"
  354. #else /* #ifdef CONFIG_PREEMPT_RCU */
  355. #define RCU_ABBR 's'
  356. #define RCU_NAME_RAW "rcu_sched"
  357. #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
  358. #ifndef CONFIG_TRACING
  359. #define RCU_NAME RCU_NAME_RAW
  360. #else /* #ifdef CONFIG_TRACING */
  361. static char rcu_name[] = RCU_NAME_RAW;
  362. static const char *tp_rcu_varname __used __tracepoint_string = rcu_name;
  363. #define RCU_NAME rcu_name
  364. #endif /* #else #ifdef CONFIG_TRACING */
  365. /* Forward declarations for tree_plugin.h */
  366. static void rcu_bootup_announce(void);
  367. static void rcu_qs(void);
  368. static int rcu_preempt_blocked_readers_cgp(struct rcu_node *rnp);
  369. #ifdef CONFIG_HOTPLUG_CPU
  370. static bool rcu_preempt_has_tasks(struct rcu_node *rnp);
  371. #endif /* #ifdef CONFIG_HOTPLUG_CPU */
  372. static int rcu_print_task_exp_stall(struct rcu_node *rnp);
  373. static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
  374. static void rcu_flavor_sched_clock_irq(int user);
  375. static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck);
  376. static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags);
  377. static void rcu_preempt_boost_start_gp(struct rcu_node *rnp);
  378. static bool rcu_is_callbacks_kthread(void);
  379. static void rcu_cpu_kthread_setup(unsigned int cpu);
  380. static void __init rcu_spawn_boost_kthreads(void);
  381. static void rcu_prepare_kthreads(int cpu);
  382. static void rcu_cleanup_after_idle(void);
  383. static void rcu_prepare_for_idle(void);
  384. static bool rcu_preempt_has_tasks(struct rcu_node *rnp);
  385. static bool rcu_preempt_need_deferred_qs(struct task_struct *t);
  386. static void rcu_preempt_deferred_qs(struct task_struct *t);
  387. static void zero_cpu_stall_ticks(struct rcu_data *rdp);
  388. static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp);
  389. static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq);
  390. static void rcu_init_one_nocb(struct rcu_node *rnp);
  391. static bool rcu_nocb_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
  392. unsigned long j);
  393. static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
  394. bool *was_alldone, unsigned long flags);
  395. static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_empty,
  396. unsigned long flags);
  397. static int rcu_nocb_need_deferred_wakeup(struct rcu_data *rdp);
  398. static void do_nocb_deferred_wakeup(struct rcu_data *rdp);
  399. static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp);
  400. static void rcu_spawn_cpu_nocb_kthread(int cpu);
  401. static void __init rcu_spawn_nocb_kthreads(void);
  402. static void show_rcu_nocb_state(struct rcu_data *rdp);
  403. static void rcu_nocb_lock(struct rcu_data *rdp);
  404. static void rcu_nocb_unlock(struct rcu_data *rdp);
  405. static void rcu_nocb_unlock_irqrestore(struct rcu_data *rdp,
  406. unsigned long flags);
  407. static void rcu_lockdep_assert_cblist_protected(struct rcu_data *rdp);
  408. #ifdef CONFIG_RCU_NOCB_CPU
  409. static void __init rcu_organize_nocb_kthreads(void);
  410. #define rcu_nocb_lock_irqsave(rdp, flags) \
  411. do { \
  412. if (!rcu_segcblist_is_offloaded(&(rdp)->cblist)) \
  413. local_irq_save(flags); \
  414. else \
  415. raw_spin_lock_irqsave(&(rdp)->nocb_lock, (flags)); \
  416. } while (0)
  417. #else /* #ifdef CONFIG_RCU_NOCB_CPU */
  418. #define rcu_nocb_lock_irqsave(rdp, flags) local_irq_save(flags)
  419. #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
  420. static void rcu_bind_gp_kthread(void);
  421. static bool rcu_nohz_full_cpu(void);
  422. static void rcu_dynticks_task_enter(void);
  423. static void rcu_dynticks_task_exit(void);
  424. static void rcu_dynticks_task_trace_enter(void);
  425. static void rcu_dynticks_task_trace_exit(void);
  426. /* Forward declarations for tree_stall.h */
  427. static void record_gp_stall_check_time(void);
  428. static void rcu_iw_handler(struct irq_work *iwp);
  429. static void check_cpu_stall(struct rcu_data *rdp);
  430. static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
  431. const unsigned long gpssdelay);