Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Read-Copy Update mechanism for mutual exclusion (tree-based version)
0004  * Internal non-public definitions.
0005  *
0006  * Copyright IBM Corporation, 2008
0007  *
0008  * Author: Ingo Molnar <mingo@elte.hu>
0009  *     Paul E. McKenney <paulmck@linux.ibm.com>
0010  */
0011 
0012 #include <linux/cache.h>
0013 #include <linux/kthread.h>
0014 #include <linux/spinlock.h>
0015 #include <linux/rtmutex.h>
0016 #include <linux/threads.h>
0017 #include <linux/cpumask.h>
0018 #include <linux/seqlock.h>
0019 #include <linux/swait.h>
0020 #include <linux/rcu_node_tree.h>
0021 
0022 #include "rcu_segcblist.h"
0023 
0024 /* Communicate arguments to a workqueue handler. */
0025 struct rcu_exp_work {
0026     unsigned long rew_s;
0027 #ifdef CONFIG_RCU_EXP_KTHREAD
0028     struct kthread_work rew_work;
0029 #else
0030     struct work_struct rew_work;
0031 #endif /* CONFIG_RCU_EXP_KTHREAD */
0032 };
0033 
0034 /* RCU's kthread states for tracing. */
0035 #define RCU_KTHREAD_STOPPED  0
0036 #define RCU_KTHREAD_RUNNING  1
0037 #define RCU_KTHREAD_WAITING  2
0038 #define RCU_KTHREAD_OFFCPU   3
0039 #define RCU_KTHREAD_YIELDING 4
0040 #define RCU_KTHREAD_MAX      4
0041 
0042 /*
0043  * Definition for node within the RCU grace-period-detection hierarchy.
0044  */
0045 struct rcu_node {
0046     raw_spinlock_t __private lock;  /* Root rcu_node's lock protects */
0047                     /*  some rcu_state fields as well as */
0048                     /*  following. */
0049     unsigned long gp_seq;   /* Track rsp->gp_seq. */
0050     unsigned long gp_seq_needed; /* Track furthest future GP request. */
0051     unsigned long completedqs; /* All QSes done for this node. */
0052     unsigned long qsmask;   /* CPUs or groups that need to switch in */
0053                 /*  order for current grace period to proceed.*/
0054                 /*  In leaf rcu_node, each bit corresponds to */
0055                 /*  an rcu_data structure, otherwise, each */
0056                 /*  bit corresponds to a child rcu_node */
0057                 /*  structure. */
0058     unsigned long rcu_gp_init_mask; /* Mask of offline CPUs at GP init. */
0059     unsigned long qsmaskinit;
0060                 /* Per-GP initial value for qsmask. */
0061                 /*  Initialized from ->qsmaskinitnext at the */
0062                 /*  beginning of each grace period. */
0063     unsigned long qsmaskinitnext;
0064     unsigned long expmask;  /* CPUs or groups that need to check in */
0065                 /*  to allow the current expedited GP */
0066                 /*  to complete. */
0067     unsigned long expmaskinit;
0068                 /* Per-GP initial values for expmask. */
0069                 /*  Initialized from ->expmaskinitnext at the */
0070                 /*  beginning of each expedited GP. */
0071     unsigned long expmaskinitnext;
0072                 /* Online CPUs for next expedited GP. */
0073                 /*  Any CPU that has ever been online will */
0074                 /*  have its bit set. */
0075     unsigned long cbovldmask;
0076                 /* CPUs experiencing callback overload. */
0077     unsigned long ffmask;   /* Fully functional CPUs. */
0078     unsigned long grpmask;  /* Mask to apply to parent qsmask. */
0079                 /*  Only one bit will be set in this mask. */
0080     int grplo;      /* lowest-numbered CPU here. */
0081     int grphi;      /* highest-numbered CPU here. */
0082     u8  grpnum;     /* group number for next level up. */
0083     u8  level;      /* root is at level 0. */
0084     bool    wait_blkd_tasks;/* Necessary to wait for blocked tasks to */
0085                 /*  exit RCU read-side critical sections */
0086                 /*  before propagating offline up the */
0087                 /*  rcu_node tree? */
0088     struct rcu_node *parent;
0089     struct list_head blkd_tasks;
0090                 /* Tasks blocked in RCU read-side critical */
0091                 /*  section.  Tasks are placed at the head */
0092                 /*  of this list and age towards the tail. */
0093     struct list_head *gp_tasks;
0094                 /* Pointer to the first task blocking the */
0095                 /*  current grace period, or NULL if there */
0096                 /*  is no such task. */
0097     struct list_head *exp_tasks;
0098                 /* Pointer to the first task blocking the */
0099                 /*  current expedited grace period, or NULL */
0100                 /*  if there is no such task.  If there */
0101                 /*  is no current expedited grace period, */
0102                 /*  then there can cannot be any such task. */
0103     struct list_head *boost_tasks;
0104                 /* Pointer to first task that needs to be */
0105                 /*  priority boosted, or NULL if no priority */
0106                 /*  boosting is needed for this rcu_node */
0107                 /*  structure.  If there are no tasks */
0108                 /*  queued on this rcu_node structure that */
0109                 /*  are blocking the current grace period, */
0110                 /*  there can be no such task. */
0111     struct rt_mutex boost_mtx;
0112                 /* Used only for the priority-boosting */
0113                 /*  side effect, not as a lock. */
0114     unsigned long boost_time;
0115                 /* When to start boosting (jiffies). */
0116     struct mutex boost_kthread_mutex;
0117                 /* Exclusion for thread spawning and affinity */
0118                 /*  manipulation. */
0119     struct task_struct *boost_kthread_task;
0120                 /* kthread that takes care of priority */
0121                 /*  boosting for this rcu_node structure. */
0122     unsigned int boost_kthread_status;
0123                 /* State of boost_kthread_task for tracing. */
0124     unsigned long n_boosts; /* Number of boosts for this rcu_node structure. */
0125 #ifdef CONFIG_RCU_NOCB_CPU
0126     struct swait_queue_head nocb_gp_wq[2];
0127                 /* Place for rcu_nocb_kthread() to wait GP. */
0128 #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
0129     raw_spinlock_t fqslock ____cacheline_internodealigned_in_smp;
0130 
0131     spinlock_t exp_lock ____cacheline_internodealigned_in_smp;
0132     unsigned long exp_seq_rq;
0133     wait_queue_head_t exp_wq[4];
0134     struct rcu_exp_work rew;
0135     bool exp_need_flush;    /* Need to flush workitem? */
0136     raw_spinlock_t exp_poll_lock;
0137                 /* Lock and data for polled expedited grace periods. */
0138     unsigned long exp_seq_poll_rq;
0139     struct work_struct exp_poll_wq;
0140 } ____cacheline_internodealigned_in_smp;
0141 
0142 /*
0143  * Bitmasks in an rcu_node cover the interval [grplo, grphi] of CPU IDs, and
0144  * are indexed relative to this interval rather than the global CPU ID space.
0145  * This generates the bit for a CPU in node-local masks.
0146  */
0147 #define leaf_node_cpu_bit(rnp, cpu) (BIT((cpu) - (rnp)->grplo))
0148 
0149 /*
0150  * Union to allow "aggregate OR" operation on the need for a quiescent
0151  * state by the normal and expedited grace periods.
0152  */
0153 union rcu_noqs {
0154     struct {
0155         u8 norm;
0156         u8 exp;
0157     } b; /* Bits. */
0158     u16 s; /* Set of bits, aggregate OR here. */
0159 };
0160 
0161 /* Per-CPU data for read-copy update. */
0162 struct rcu_data {
0163     /* 1) quiescent-state and grace-period handling : */
0164     unsigned long   gp_seq;     /* Track rsp->gp_seq counter. */
0165     unsigned long   gp_seq_needed;  /* Track furthest future GP request. */
0166     union rcu_noqs  cpu_no_qs;  /* No QSes yet for this CPU. */
0167     bool        core_needs_qs;  /* Core waits for quiescent state. */
0168     bool        beenonline; /* CPU online at least once. */
0169     bool        gpwrap;     /* Possible ->gp_seq wrap. */
0170     bool        cpu_started;    /* RCU watching this onlining CPU. */
0171     struct rcu_node *mynode;    /* This CPU's leaf of hierarchy */
0172     unsigned long grpmask;      /* Mask to apply to leaf qsmask. */
0173     unsigned long   ticks_this_gp;  /* The number of scheduling-clock */
0174                     /*  ticks this CPU has handled */
0175                     /*  during and after the last grace */
0176                     /* period it is aware of. */
0177     struct irq_work defer_qs_iw;    /* Obtain later scheduler attention. */
0178     bool defer_qs_iw_pending;   /* Scheduler attention pending? */
0179     struct work_struct strict_work; /* Schedule readers for strict GPs. */
0180 
0181     /* 2) batch handling */
0182     struct rcu_segcblist cblist;    /* Segmented callback list, with */
0183                     /* different callbacks waiting for */
0184                     /* different grace periods. */
0185     long        qlen_last_fqs_check;
0186                     /* qlen at last check for QS forcing */
0187     unsigned long   n_cbs_invoked;  /* # callbacks invoked since boot. */
0188     unsigned long   n_force_qs_snap;
0189                     /* did other CPU force QS recently? */
0190     long        blimit;     /* Upper limit on a processed batch */
0191 
0192     /* 3) dynticks interface. */
0193     int dynticks_snap;      /* Per-GP tracking for dynticks. */
0194     bool rcu_need_heavy_qs;     /* GP old, so heavy quiescent state! */
0195     bool rcu_urgent_qs;     /* GP old need light quiescent state. */
0196     bool rcu_forced_tick;       /* Forced tick to provide QS. */
0197     bool rcu_forced_tick_exp;   /*   ... provide QS to expedited GP. */
0198 
0199     /* 4) rcu_barrier(), OOM callbacks, and expediting. */
0200     unsigned long barrier_seq_snap; /* Snap of rcu_state.barrier_sequence. */
0201     struct rcu_head barrier_head;
0202     int exp_dynticks_snap;      /* Double-check need for IPI. */
0203 
0204     /* 5) Callback offloading. */
0205 #ifdef CONFIG_RCU_NOCB_CPU
0206     struct swait_queue_head nocb_cb_wq; /* For nocb kthreads to sleep on. */
0207     struct swait_queue_head nocb_state_wq; /* For offloading state changes */
0208     struct task_struct *nocb_gp_kthread;
0209     raw_spinlock_t nocb_lock;   /* Guard following pair of fields. */
0210     atomic_t nocb_lock_contended;   /* Contention experienced. */
0211     int nocb_defer_wakeup;      /* Defer wakeup of nocb_kthread. */
0212     struct timer_list nocb_timer;   /* Enforce finite deferral. */
0213     unsigned long nocb_gp_adv_time; /* Last call_rcu() CB adv (jiffies). */
0214     struct mutex nocb_gp_kthread_mutex; /* Exclusion for nocb gp kthread */
0215                         /* spawning */
0216 
0217     /* The following fields are used by call_rcu, hence own cacheline. */
0218     raw_spinlock_t nocb_bypass_lock ____cacheline_internodealigned_in_smp;
0219     struct rcu_cblist nocb_bypass;  /* Lock-contention-bypass CB list. */
0220     unsigned long nocb_bypass_first; /* Time (jiffies) of first enqueue. */
0221     unsigned long nocb_nobypass_last; /* Last ->cblist enqueue (jiffies). */
0222     int nocb_nobypass_count;    /* # ->cblist enqueues at ^^^ time. */
0223 
0224     /* The following fields are used by GP kthread, hence own cacheline. */
0225     raw_spinlock_t nocb_gp_lock ____cacheline_internodealigned_in_smp;
0226     u8 nocb_gp_sleep;       /* Is the nocb GP thread asleep? */
0227     u8 nocb_gp_bypass;      /* Found a bypass on last scan? */
0228     u8 nocb_gp_gp;          /* GP to wait for on last scan? */
0229     unsigned long nocb_gp_seq;  /*  If so, ->gp_seq to wait for. */
0230     unsigned long nocb_gp_loops;    /* # passes through wait code. */
0231     struct swait_queue_head nocb_gp_wq; /* For nocb kthreads to sleep on. */
0232     bool nocb_cb_sleep;     /* Is the nocb CB thread asleep? */
0233     struct task_struct *nocb_cb_kthread;
0234     struct list_head nocb_head_rdp; /*
0235                      * Head of rcu_data list in wakeup chain,
0236                      * if rdp_gp.
0237                      */
0238     struct list_head nocb_entry_rdp; /* rcu_data node in wakeup chain. */
0239     struct rcu_data *nocb_toggling_rdp; /* rdp queued for (de-)offloading */
0240 
0241     /* The following fields are used by CB kthread, hence new cacheline. */
0242     struct rcu_data *nocb_gp_rdp ____cacheline_internodealigned_in_smp;
0243                     /* GP rdp takes GP-end wakeups. */
0244 #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
0245 
0246     /* 6) RCU priority boosting. */
0247     struct task_struct *rcu_cpu_kthread_task;
0248                     /* rcuc per-CPU kthread or NULL. */
0249     unsigned int rcu_cpu_kthread_status;
0250     char rcu_cpu_has_work;
0251     unsigned long rcuc_activity;
0252 
0253     /* 7) Diagnostic data, including RCU CPU stall warnings. */
0254     unsigned int softirq_snap;  /* Snapshot of softirq activity. */
0255     /* ->rcu_iw* fields protected by leaf rcu_node ->lock. */
0256     struct irq_work rcu_iw;     /* Check for non-irq activity. */
0257     bool rcu_iw_pending;        /* Is ->rcu_iw pending? */
0258     unsigned long rcu_iw_gp_seq;    /* ->gp_seq associated with ->rcu_iw. */
0259     unsigned long rcu_ofl_gp_seq;   /* ->gp_seq at last offline. */
0260     short rcu_ofl_gp_flags;     /* ->gp_flags at last offline. */
0261     unsigned long rcu_onl_gp_seq;   /* ->gp_seq at last online. */
0262     short rcu_onl_gp_flags;     /* ->gp_flags at last online. */
0263     unsigned long last_fqs_resched; /* Time of last rcu_resched(). */
0264     unsigned long last_sched_clock; /* Jiffies of last rcu_sched_clock_irq(). */
0265 
0266     int cpu;
0267 };
0268 
0269 /* Values for nocb_defer_wakeup field in struct rcu_data. */
0270 #define RCU_NOCB_WAKE_NOT   0
0271 #define RCU_NOCB_WAKE_BYPASS    1
0272 #define RCU_NOCB_WAKE       2
0273 #define RCU_NOCB_WAKE_FORCE 3
0274 
0275 #define RCU_JIFFIES_TILL_FORCE_QS (1 + (HZ > 250) + (HZ > 500))
0276                     /* For jiffies_till_first_fqs and */
0277                     /*  and jiffies_till_next_fqs. */
0278 
0279 #define RCU_JIFFIES_FQS_DIV 256 /* Very large systems need more */
0280                     /*  delay between bouts of */
0281                     /*  quiescent-state forcing. */
0282 
0283 #define RCU_STALL_RAT_DELAY 2   /* Allow other CPUs time to take */
0284                     /*  at least one scheduling clock */
0285                     /*  irq before ratting on them. */
0286 
0287 #define rcu_wait(cond)                          \
0288 do {                                    \
0289     for (;;) {                          \
0290         set_current_state(TASK_INTERRUPTIBLE);          \
0291         if (cond)                       \
0292             break;                      \
0293         schedule();                     \
0294     }                               \
0295     __set_current_state(TASK_RUNNING);              \
0296 } while (0)
0297 
0298 /*
0299  * RCU global state, including node hierarchy.  This hierarchy is
0300  * represented in "heap" form in a dense array.  The root (first level)
0301  * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
0302  * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
0303  * and the third level in ->node[m+1] and following (->node[m+1] referenced
0304  * by ->level[2]).  The number of levels is determined by the number of
0305  * CPUs and by CONFIG_RCU_FANOUT.  Small systems will have a "hierarchy"
0306  * consisting of a single rcu_node.
0307  */
0308 struct rcu_state {
0309     struct rcu_node node[NUM_RCU_NODES];    /* Hierarchy. */
0310     struct rcu_node *level[RCU_NUM_LVLS + 1];
0311                         /* Hierarchy levels (+1 to */
0312                         /*  shut bogus gcc warning) */
0313     int ncpus;              /* # CPUs seen so far. */
0314     int n_online_cpus;          /* # CPUs online for RCU. */
0315 
0316     /* The following fields are guarded by the root rcu_node's lock. */
0317 
0318     unsigned long gp_seq ____cacheline_internodealigned_in_smp;
0319                         /* Grace-period sequence #. */
0320     unsigned long gp_max;           /* Maximum GP duration in */
0321                         /*  jiffies. */
0322     struct task_struct *gp_kthread;     /* Task for grace periods. */
0323     struct swait_queue_head gp_wq;      /* Where GP task waits. */
0324     short gp_flags;             /* Commands for GP task. */
0325     short gp_state;             /* GP kthread sleep state. */
0326     unsigned long gp_wake_time;     /* Last GP kthread wake. */
0327     unsigned long gp_wake_seq;      /* ->gp_seq at ^^^. */
0328     unsigned long gp_seq_polled;        /* GP seq for polled API. */
0329     unsigned long gp_seq_polled_snap;   /* ->gp_seq_polled at normal GP start. */
0330     unsigned long gp_seq_polled_exp_snap;   /* ->gp_seq_polled at expedited GP start. */
0331 
0332     /* End of fields guarded by root rcu_node's lock. */
0333 
0334     struct mutex barrier_mutex;     /* Guards barrier fields. */
0335     atomic_t barrier_cpu_count;     /* # CPUs waiting on. */
0336     struct completion barrier_completion;   /* Wake at barrier end. */
0337     unsigned long barrier_sequence;     /* ++ at start and end of */
0338                         /*  rcu_barrier(). */
0339     /* End of fields guarded by barrier_mutex. */
0340 
0341     raw_spinlock_t barrier_lock;        /* Protects ->barrier_seq_snap. */
0342 
0343     struct mutex exp_mutex;         /* Serialize expedited GP. */
0344     struct mutex exp_wake_mutex;        /* Serialize wakeup. */
0345     unsigned long expedited_sequence;   /* Take a ticket. */
0346     atomic_t expedited_need_qs;     /* # CPUs left to check in. */
0347     struct swait_queue_head expedited_wq;   /* Wait for check-ins. */
0348     int ncpus_snap;             /* # CPUs seen last time. */
0349     u8 cbovld;              /* Callback overload now? */
0350     u8 cbovldnext;              /* ^        ^  next time? */
0351 
0352     unsigned long jiffies_force_qs;     /* Time at which to invoke */
0353                         /*  force_quiescent_state(). */
0354     unsigned long jiffies_kick_kthreads;    /* Time at which to kick */
0355                         /*  kthreads, if configured. */
0356     unsigned long n_force_qs;       /* Number of calls to */
0357                         /*  force_quiescent_state(). */
0358     unsigned long gp_start;         /* Time at which GP started, */
0359                         /*  but in jiffies. */
0360     unsigned long gp_end;           /* Time last GP ended, again */
0361                         /*  in jiffies. */
0362     unsigned long gp_activity;      /* Time of last GP kthread */
0363                         /*  activity in jiffies. */
0364     unsigned long gp_req_activity;      /* Time of last GP request */
0365                         /*  in jiffies. */
0366     unsigned long jiffies_stall;        /* Time at which to check */
0367                         /*  for CPU stalls. */
0368     unsigned long jiffies_resched;      /* Time at which to resched */
0369                         /*  a reluctant CPU. */
0370     unsigned long n_force_qs_gpstart;   /* Snapshot of n_force_qs at */
0371                         /*  GP start. */
0372     const char *name;           /* Name of structure. */
0373     char abbr;              /* Abbreviated name. */
0374 
0375     arch_spinlock_t ofl_lock ____cacheline_internodealigned_in_smp;
0376                         /* Synchronize offline with */
0377                         /*  GP pre-initialization. */
0378     int nocb_is_setup;          /* nocb is setup from boot */
0379 };
0380 
0381 /* Values for rcu_state structure's gp_flags field. */
0382 #define RCU_GP_FLAG_INIT 0x1    /* Need grace-period initialization. */
0383 #define RCU_GP_FLAG_FQS  0x2    /* Need grace-period quiescent-state forcing. */
0384 #define RCU_GP_FLAG_OVLD 0x4    /* Experiencing callback overload. */
0385 
0386 /* Values for rcu_state structure's gp_state field. */
0387 #define RCU_GP_IDLE  0  /* Initial state and no GP in progress. */
0388 #define RCU_GP_WAIT_GPS  1  /* Wait for grace-period start. */
0389 #define RCU_GP_DONE_GPS  2  /* Wait done for grace-period start. */
0390 #define RCU_GP_ONOFF     3  /* Grace-period initialization hotplug. */
0391 #define RCU_GP_INIT      4  /* Grace-period initialization. */
0392 #define RCU_GP_WAIT_FQS  5  /* Wait for force-quiescent-state time. */
0393 #define RCU_GP_DOING_FQS 6  /* Wait done for force-quiescent-state time. */
0394 #define RCU_GP_CLEANUP   7  /* Grace-period cleanup started. */
0395 #define RCU_GP_CLEANED   8  /* Grace-period cleanup complete. */
0396 
0397 /*
0398  * In order to export the rcu_state name to the tracing tools, it
0399  * needs to be added in the __tracepoint_string section.
0400  * This requires defining a separate variable tp_<sname>_varname
0401  * that points to the string being used, and this will allow
0402  * the tracing userspace tools to be able to decipher the string
0403  * address to the matching string.
0404  */
0405 #ifdef CONFIG_PREEMPT_RCU
0406 #define RCU_ABBR 'p'
0407 #define RCU_NAME_RAW "rcu_preempt"
0408 #else /* #ifdef CONFIG_PREEMPT_RCU */
0409 #define RCU_ABBR 's'
0410 #define RCU_NAME_RAW "rcu_sched"
0411 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
0412 #ifndef CONFIG_TRACING
0413 #define RCU_NAME RCU_NAME_RAW
0414 #else /* #ifdef CONFIG_TRACING */
0415 static char rcu_name[] = RCU_NAME_RAW;
0416 static const char *tp_rcu_varname __used __tracepoint_string = rcu_name;
0417 #define RCU_NAME rcu_name
0418 #endif /* #else #ifdef CONFIG_TRACING */
0419 
0420 /* Forward declarations for tree_plugin.h */
0421 static void rcu_bootup_announce(void);
0422 static void rcu_qs(void);
0423 static int rcu_preempt_blocked_readers_cgp(struct rcu_node *rnp);
0424 #ifdef CONFIG_HOTPLUG_CPU
0425 static bool rcu_preempt_has_tasks(struct rcu_node *rnp);
0426 #endif /* #ifdef CONFIG_HOTPLUG_CPU */
0427 static int rcu_print_task_exp_stall(struct rcu_node *rnp);
0428 static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
0429 static void rcu_flavor_sched_clock_irq(int user);
0430 static void dump_blkd_tasks(struct rcu_node *rnp, int ncheck);
0431 static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags);
0432 static void rcu_preempt_boost_start_gp(struct rcu_node *rnp);
0433 static bool rcu_is_callbacks_kthread(struct rcu_data *rdp);
0434 static void rcu_cpu_kthread_setup(unsigned int cpu);
0435 static void rcu_spawn_one_boost_kthread(struct rcu_node *rnp);
0436 static bool rcu_preempt_has_tasks(struct rcu_node *rnp);
0437 static bool rcu_preempt_need_deferred_qs(struct task_struct *t);
0438 static void zero_cpu_stall_ticks(struct rcu_data *rdp);
0439 static struct swait_queue_head *rcu_nocb_gp_get(struct rcu_node *rnp);
0440 static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq);
0441 static void rcu_init_one_nocb(struct rcu_node *rnp);
0442 static bool rcu_nocb_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
0443                   unsigned long j);
0444 static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
0445                 bool *was_alldone, unsigned long flags);
0446 static void __call_rcu_nocb_wake(struct rcu_data *rdp, bool was_empty,
0447                  unsigned long flags);
0448 static int rcu_nocb_need_deferred_wakeup(struct rcu_data *rdp, int level);
0449 static bool do_nocb_deferred_wakeup(struct rcu_data *rdp);
0450 static void rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp);
0451 static void rcu_spawn_cpu_nocb_kthread(int cpu);
0452 static void show_rcu_nocb_state(struct rcu_data *rdp);
0453 static void rcu_nocb_lock(struct rcu_data *rdp);
0454 static void rcu_nocb_unlock(struct rcu_data *rdp);
0455 static void rcu_nocb_unlock_irqrestore(struct rcu_data *rdp,
0456                        unsigned long flags);
0457 static void rcu_lockdep_assert_cblist_protected(struct rcu_data *rdp);
0458 #ifdef CONFIG_RCU_NOCB_CPU
0459 static void __init rcu_organize_nocb_kthreads(void);
0460 
0461 /*
0462  * Disable IRQs before checking offloaded state so that local
0463  * locking is safe against concurrent de-offloading.
0464  */
0465 #define rcu_nocb_lock_irqsave(rdp, flags)           \
0466 do {                                \
0467     local_irq_save(flags);                  \
0468     if (rcu_segcblist_is_offloaded(&(rdp)->cblist)) \
0469         raw_spin_lock(&(rdp)->nocb_lock);       \
0470 } while (0)
0471 #else /* #ifdef CONFIG_RCU_NOCB_CPU */
0472 #define rcu_nocb_lock_irqsave(rdp, flags) local_irq_save(flags)
0473 #endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
0474 
0475 static void rcu_bind_gp_kthread(void);
0476 static bool rcu_nohz_full_cpu(void);
0477 
0478 /* Forward declarations for tree_stall.h */
0479 static void record_gp_stall_check_time(void);
0480 static void rcu_iw_handler(struct irq_work *iwp);
0481 static void check_cpu_stall(struct rcu_data *rdp);
0482 static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
0483                      const unsigned long gpssdelay);
0484 
0485 /* Forward declarations for tree_exp.h. */
0486 static void sync_rcu_do_polled_gp(struct work_struct *wp);