platform/kernel/linux-rpi.git
5 years agorcu: Convert "1UL << x" to "BIT(x)"
Paul E. McKenney [Tue, 31 Jul 2018 16:49:20 +0000 (09:49 -0700)]
rcu: Convert "1UL << x" to "BIT(x)"

This commit saves a few characters by converting "1UL << x" to "BIT(x)".

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Avoid resched_cpu() when rescheduling the current CPU
Paul E. McKenney [Thu, 26 Jul 2018 20:44:00 +0000 (13:44 -0700)]
rcu: Avoid resched_cpu() when rescheduling the current CPU

The resched_cpu() interface is quite handy, but it does acquire the
specified CPU's runqueue lock, which does not come for free.  This
commit therefore substitutes the following when directing resched_cpu()
at the current CPU:

set_tsk_need_resched(current);
set_preempt_need_resched();

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
5 years agorcu: More aggressively enlist scheduler aid for nohz_full CPUs
Paul E. McKenney [Wed, 25 Jul 2018 18:49:47 +0000 (11:49 -0700)]
rcu: More aggressively enlist scheduler aid for nohz_full CPUs

Because nohz_full CPUs can leave the scheduler-clock interrupt disabled
even when in kernel mode, RCU cannot rely on rcu_check_callbacks() to
enlist the scheduler's aid in extracting a quiescent state from such CPUs.
This commit therefore more aggressively uses resched_cpu() on nohz_full
CPUs that fail to pass through a quiescent state in a timely manner.
By default, the resched_cpu() beating starts 300 milliseconds into the
quiescent state.

While in the neighborhood, add a ->last_fqs_resched field to the rcu_data
structure in order to rate-limit resched_cpu() calls from the RCU
grace-period kthread.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Compute jiffies_till_sched_qs from other kernel parameters
Paul E. McKenney [Wed, 25 Jul 2018 18:25:23 +0000 (11:25 -0700)]
rcu: Compute jiffies_till_sched_qs from other kernel parameters

The jiffies_till_sched_qs value used to determine how old a grace period
must be before RCU enlists the help of the scheduler to force a quiescent
state on the holdout CPU.  Currently, this defaults to HZ/10 regardless of
system size and may be set only at boot time.  This can be a problem for
very large systems, because if the values of the jiffies_till_first_fqs
and jiffies_till_next_fqs kernel parameters are left at their defaults,
they are calculated to increase as the number of CPUs actually configured
on the system increases.  Thus, on a sufficiently large system, RCU would
enlist the help of the scheduler before the grace-period kthread had a
chance to scan for idle CPUs, which wastes CPU time.

This commit therefore allows jiffies_till_sched_qs to be set, if desired,
but if left as default, computes is as jiffies_till_first_fqs plus twice
jiffies_till_next_fqs, thus allowing three force-quiescent-state scans
for idle CPUs.  This scales with the number of CPUs, providing sensible
default values.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Provide functions for determining if call_rcu() has been invoked
Paul E. McKenney [Tue, 24 Jul 2018 22:28:09 +0000 (15:28 -0700)]
rcu: Provide functions for determining if call_rcu() has been invoked

This commit adds rcu_head_init() and rcu_head_after_call_rcu() functions
to help RCU users detect when another CPU has passed the specified
rcu_head structure and function to call_rcu().  The rcu_head_init()
should be invoked before making the structure visible to RCU readers,
and then the rcu_head_after_call_rcu() may be invoked from within
an RCU read-side critical section on an rcu_head structure that
was obtained during a traversal of the data structure in question.
The rcu_head_after_call_rcu() function will return true if the rcu_head
structure has already been passed (with the specified function) to
call_rcu(), otherwise it will return false.

If rcu_head_init() has not been invoked on the rcu_head structure
or if the rcu_head (AKA callback) has already been invoked, then
rcu_head_after_call_rcu() will do WARN_ON_ONCE().

Reported-by: NeilBrown <neilb@suse.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Apply neilb naming feedback. ]

5 years agorcu: Eliminate ->rcu_qs_ctr from the rcu_dynticks structure
Paul E. McKenney [Wed, 11 Jul 2018 15:09:28 +0000 (08:09 -0700)]
rcu: Eliminate ->rcu_qs_ctr from the rcu_dynticks structure

The ->rcu_qs_ctr counter was intended to allow providing a lightweight
report of a quiescent state to all RCU flavors.  But now that there is
only one flavor of RCU in any one running kernel, there is no point in
having this feature.  This commit therefore removes the ->rcu_qs_ctr
field from the rcu_dynticks structure and the ->rcu_qs_ctr_snap field
from the rcu_data structure.  This results in the "rqc" option to the
rcu_fqs trace event no longer being used, so this commit also removes the
"rqc" description from the header comment.

While in the neighborhood, this commit also causes the forward-progress
request .rcu_need_heavy_qs be set one jiffies_till_sched_qs interval
later in the grace period than the first setting of .rcu_urgent_qs.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Motivate Tiny RCU forward progress
Paul E. McKenney [Fri, 20 Jul 2018 21:18:23 +0000 (14:18 -0700)]
rcu: Motivate Tiny RCU forward progress

If a long-running CPU-bound in-kernel task invokes call_rcu(), the
callback won't be invoked until the next context switch.  If there are
no other runnable tasks (which is not an uncommon situation on deep
embedded systems), the callback might never be invoked.

This commit therefore causes rcu_check_callbacks() to ask the scheduler
for a context switch if there are callbacks posted that are still waiting
for a grace period.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcutorture: Dump reader protection sequence if failures or close calls
Paul E. McKenney [Fri, 13 Jul 2018 19:09:14 +0000 (12:09 -0700)]
rcutorture: Dump reader protection sequence if failures or close calls

Now that RCU can have readers with multiple segments, it is quite
possible that a specific sequence of reader segments might result in
an rcutorture failure (reader spans a full grace period as detected
by one of the grace-period primitives) or an rcutorture close call
(reader potentially spans a full grace period based on reading out
the RCU implementation's grace-period counter, but with no ordering).
In such cases, it would clearly ease debugging if the offending specific
sequence was known.  For the first reader encountering a failure or a
close call, this commit therefore dumps out the segments, delay durations,
and whether or not the reader was preempted.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Mark variables static, as suggested by kbuild test robot. ]

5 years agorcu: Provide improved interrupt-from-idle check in rcu_check_callbacks()
Paul E. McKenney [Mon, 9 Jul 2018 22:50:16 +0000 (15:50 -0700)]
rcu: Provide improved interrupt-from-idle check in rcu_check_callbacks()

The patch making need_resched() respond to urgent RCU-QS needs used
is_idle_task(current) to detect an interrupt from idle, which does work
reasonably, but is (in theory at least) vulnerable to loops containing
need_resched() invoked from within RCU_NONIDLE() or its tracepoint
equivalent.  This commit therefore moves rcu_is_cpu_rrupt_from_idle()
to a place from which rcu_check_callbacks() can invoke it and replaces
the is_idle_task(current) with rcu_is_cpu_rrupt_from_idle().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Make need_resched() respond to urgent RCU-QS needs
Paul E. McKenney [Mon, 9 Jul 2018 20:47:30 +0000 (13:47 -0700)]
rcu: Make need_resched() respond to urgent RCU-QS needs

The per-CPU rcu_dynticks.rcu_urgent_qs variable communicates an urgent
need for an RCU quiescent state from the force-quiescent-state processing
within the grace-period kthread to context switches and to cond_resched().
Unfortunately, such urgent needs are not communicated to need_resched(),
which is sometimes used to decide when to invoke cond_resched(), for
but one example, within the KVM vcpu_run() function.  As of v4.15, this
can result in synchronize_sched() being delayed by up to ten seconds,
which can be problematic, to say nothing of annoying.

This commit therefore checks rcu_dynticks.rcu_urgent_qs from within
rcu_check_callbacks(), which is invoked from the scheduling-clock
interrupt handler.  If the current task is not an idle task and is
not executing in usermode, a context switch is forced, and either way,
the rcu_dynticks.rcu_urgent_qs variable is set to false.  If the current
task is an idle task, then RCU's dyntick-idle code will detect the
quiescent state, so no further action is required.  Similarly, if the
task is executing in usermode, other code in rcu_check_callbacks() and
its called functions will report the corresponding quiescent state.

Reported-by: Marius Hillenbrand <mhillenb@amazon.de>
Reported-by: David Woodhouse <dwmw2@infradead.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Inline _rcu_barrier() into its sole remaining caller
Paul E. McKenney [Wed, 11 Jul 2018 01:37:30 +0000 (18:37 -0700)]
rcu: Inline _rcu_barrier() into its sole remaining caller

Because rcu_barrier() is a one-line wrapper function for _rcu_barrier()
and because nothing else calls _rcu_barrier(), this commit inlines
_rcu_barrier() into rcu_barrier().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Define rcu_all_qs() only in !PREEMPT builds
Paul E. McKenney [Tue, 10 Jul 2018 21:00:14 +0000 (14:00 -0700)]
rcu: Define rcu_all_qs() only in !PREEMPT builds

Now that rcu_all_qs() is used only in !PREEMPT builds, move it to
tree_plugin.h so that it is defined only in those builds.  This in
turn means that rcu_momentary_dyntick_idle() is only used in !PREEMPT
builds, but it is simply marked __maybe_unused in order to keep it
near the rest of the dyntick-idle code.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove !PREEMPT code from rcu_note_voluntary_context_switch()
Paul E. McKenney [Tue, 10 Jul 2018 19:53:40 +0000 (12:53 -0700)]
rcu: Remove !PREEMPT code from rcu_note_voluntary_context_switch()

Because RCU-tasks exists only in PREEMPT kernels and because RCU-sched
no longer exists in PREEMPT kernels, it is no longer necessary for the
rcu_note_voluntary_context_switch() macro to do anything for !PREEMPT
kernels.  This commit therefore removes !PREEMPT-related code from
this macro, namely, the rcu_all_qs().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in update.c
Paul E. McKenney [Sun, 8 Jul 2018 17:58:37 +0000 (10:58 -0700)]
rcu: Clean up flavor-related definitions and comments in update.c

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in tree_plugin.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in tree_plugin.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in tree_exp.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in tree_exp.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in tree.c
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in tree.c

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in tiny.c
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in tiny.c

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in srcutree.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in srcutree.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in rcutorture.c
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in rcutorture.c

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in rcu.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in rcu.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in Kconfig
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in Kconfig

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in rcupdate_wait.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in rcupdate_wait.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in rculist.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in rculist.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Clean up flavor-related definitions and comments in rcupdate.h
Paul E. McKenney [Sun, 8 Jul 2018 01:12:26 +0000 (18:12 -0700)]
rcu: Clean up flavor-related definitions and comments in rcupdate.h

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove now-unused rcutorture APIs
Paul E. McKenney [Sun, 8 Jul 2018 04:43:17 +0000 (21:43 -0700)]
rcu: Remove now-unused rcutorture APIs

This commit removes rcu_sched_get_gp_seq(), rcu_bh_get_gp_seq(),
rcu_exp_batches_completed_sched(), rcu_sched_force_quiescent_state(),
and rcu_bh_force_quiescent_state(), which are no longer used because
rcutorture no longer does "rcu_bh" and "rcu_sched" torture types.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcuperf: Remove the "rcu_bh" and "sched" torture types
Paul E. McKenney [Sun, 8 Jul 2018 01:25:10 +0000 (18:25 -0700)]
rcuperf: Remove the "rcu_bh" and "sched" torture types

Now that the RCU-bh and RCU-sched update-side functions are simple
wrappers around their RCU counterparts, there isn't a whole lot of point
in testing them.  This commit therefore removes the "rcu_bh" and "sched"
torture types from rcuperf.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcutorture: Remove the "rcu_bh" and "sched" torture types
Paul E. McKenney [Sat, 7 Jul 2018 17:28:07 +0000 (10:28 -0700)]
rcutorture: Remove the "rcu_bh" and "sched" torture types

Now that the RCU-bh and RCU-sched update-side functions are simple
wrappers around their RCU counterparts, there isn't a whole lot of point
in testing them.  This commit therefore removes the "rcu_bh" and "sched"
torture types from rcutorture.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Stop testing RCU-bh and RCU-sched
Paul E. McKenney [Sat, 7 Jul 2018 17:24:23 +0000 (10:24 -0700)]
rcu: Stop testing RCU-bh and RCU-sched

Now that the RCU-bh and RCU-sched update-side functions are simple
wrappers around their RCU counterparts, there isn't a whole lot of
point in testing them.  This commit therefore removes the self-test
capability and removes the corresponding kernel-boot parameters.
It also updates the various rcutorture .boot files to remove the
kernel boot parameters that call for testing RCU-bh and RCU-sched.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcutorture: Add RCU-bh and RCU-sched support for extended readers
Paul E. McKenney [Fri, 6 Jul 2018 22:16:12 +0000 (15:16 -0700)]
rcutorture: Add RCU-bh and RCU-sched support for extended readers

Since there is now a single consolidated RCU flavor, rcutorture
needs to test extending of RCU readers via rcu_read_lock_bh() and
rcu_read_lock_sched().  This commit adds this support, with added checks
(just like for local_bh_enable()) to ensure that rcu_read_unlock_bh()
will not be invoked while interrupts are disabled.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Consolidate RCU-sched update-side function definitions
Paul E. McKenney [Fri, 6 Jul 2018 18:46:47 +0000 (11:46 -0700)]
rcu: Consolidate RCU-sched update-side function definitions

This commit saves a few lines by consolidating the RCU-sched function
definitions at the end of include/linux/rcupdate.h.  This consolidation
also makes it easier to remove them all when the time comes.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Consolidate RCU-bh update-side function definitions
Paul E. McKenney [Fri, 6 Jul 2018 16:54:25 +0000 (09:54 -0700)]
rcu: Consolidate RCU-bh update-side function definitions

This commit saves a few lines by consolidating the RCU-bh function
definitions at the end of include/linux/rcupdate.h.  This consolidation
also makes it easier to remove them all when the time comes.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Pull rcu_gp_kthread() FQS loop into separate function
Paul E. McKenney [Fri, 6 Jul 2018 01:23:23 +0000 (18:23 -0700)]
rcu: Pull rcu_gp_kthread() FQS loop into separate function

The rcu_gp_kthread() function is long and deeply indented, so this
commit pulls the loop that repeatedly invokes rcu_gp_fqs() into a new
rcu_gp_fqs_loop() function.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Inline increment_cpu_stall_ticks() into its sole caller
Paul E. McKenney [Fri, 6 Jul 2018 00:59:36 +0000 (17:59 -0700)]
rcu: Inline increment_cpu_stall_ticks() into its sole caller

Consolidation of the RCU flavors into one makes increment_cpu_stall_ticks()
a trivial one-line function with only one caller.  This commit therefore
inlines it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Fix typo in force_qs_rnp()'s parameter's parameter
Paul E. McKenney [Fri, 6 Jul 2018 00:55:14 +0000 (17:55 -0700)]
rcu: Fix typo in force_qs_rnp()'s parameter's parameter

Pointers to rcu_data structures should be named rdp, not rsp.  This
commit therefore makes this change.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate initialization-time use of rsp
Paul E. McKenney [Fri, 6 Jul 2018 00:47:45 +0000 (17:47 -0700)]
rcu: Eliminate initialization-time use of rsp

Now that there is only one rcu_state structure, there is less point in
maintaining a pointer to it.  This commit therefore replaces rsp with
&rcu_state in rcu_cpu_starting() and rcu_init_one().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate RCU-barrier use of rsp
Paul E. McKenney [Thu, 5 Jul 2018 23:26:12 +0000 (16:26 -0700)]
rcu: Eliminate RCU-barrier use of rsp

Now that there is only one rcu_state structure, there is less point
in maintaining a pointer to it.  This commit therefore replaces rsp
with &rcu_state in rcu_barrier_callback(), rcu_barrier_func(), and
_rcu_barrier().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate quiescent-state and grace-period-nonstart use of rsp
Paul E. McKenney [Thu, 5 Jul 2018 23:15:38 +0000 (16:15 -0700)]
rcu: Eliminate quiescent-state and grace-period-nonstart use of rsp

Now that there is only one rcu_state structure, there is less point in
maintaining a pointer to it.  This commit therefore replaces rsp with
&rcu_state in rcu_report_qs_rnp(), force_quiescent_state(), and
rcu_check_gp_start_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate callback-invocation/invocation use of rsp
Paul E. McKenney [Thu, 5 Jul 2018 22:54:02 +0000 (15:54 -0700)]
rcu: Eliminate callback-invocation/invocation use of rsp

Now that there is only one rcu_state structure, there is less point in
maintaining a pointer to it.  This commit therefore replaces rsp with
&rcu_state in rcu_do_batch(), invoke_rcu_callbacks(), and __call_rcu().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate grace-period management code use of rsp
Paul E. McKenney [Thu, 5 Jul 2018 22:47:01 +0000 (15:47 -0700)]
rcu: Eliminate grace-period management code use of rsp

Now that there is only one rcu_state structure, there is less point
in maintaining a pointer to it.  This commit therefore replaces
rsp with &rcu_state in rcu_start_this_gp(), rcu_accelerate_cbs(),
__note_gp_changes(), rcu_gp_init(), rcu_gp_fqs(), rcu_gp_cleanup(),
rcu_gp_kthread(), and rcu_report_qs_rsp().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate stall-warning use of rsp
Paul E. McKenney [Thu, 5 Jul 2018 07:02:29 +0000 (00:02 -0700)]
rcu: Eliminate stall-warning use of rsp

Now that there is only one rcu_state structure, there is less point
in maintaining a pointer to it.  This commit therefore replaces rsp
with &rcu_state in print_other_cpu_stall(), print_cpu_stall(), and
check_cpu_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Restructure rcu_check_gp_kthread_starvation()
Paul E. McKenney [Thu, 5 Jul 2018 01:25:59 +0000 (18:25 -0700)]
rcu: Restructure rcu_check_gp_kthread_starvation()

This commit removes the rsp and gpa local variables, repurposes the j
local variable and adds a gpk (GP kthread) local to improve readability.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Simplify rcutorture_get_gp_data()
Paul E. McKenney [Wed, 4 Jul 2018 22:39:40 +0000 (15:39 -0700)]
rcu: Simplify rcutorture_get_gp_data()

This commit restructures rcutorture_get_gp_data() to take advantage of
the fact that there is only one flavor of RCU.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove for_each_rcu_flavor() flavor-traversal macro
Paul E. McKenney [Wed, 4 Jul 2018 22:35:00 +0000 (15:35 -0700)]
rcu: Remove for_each_rcu_flavor() flavor-traversal macro

Now that there is only ever a single flavor of RCU in a given kernel
build, there isn't a whole lot of point in having a flavor-traversal
macro.  This commit therefore removes it and converts calls to it to
straightline code, inlining trivial functions as appropriate.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove last non-flavor-traversal rsp local variable from tree_plugin.h
Paul E. McKenney [Wed, 4 Jul 2018 21:52:04 +0000 (14:52 -0700)]
rcu: Remove last non-flavor-traversal rsp local variable from tree_plugin.h

This commit removes the last non-flavor-traversal rsp local variable from
kernel/rcu/tree_plugin.h in favor of &rcu_state.  The flavor-traversal
locals will be removed with the removal of flavor traversal.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rcu_data structure's ->rsp field
Paul E. McKenney [Wed, 4 Jul 2018 21:45:00 +0000 (14:45 -0700)]
rcu: Remove rcu_data structure's ->rsp field

Now that there is only one rcu_state structure, there is no need for the
rcu_data structure to indicate which it corresponds to.  This commit
therefore removes the rcu_data structure's ->rsp field, replacing all
remaining uses of it with &rcu_state.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_node tree accessor macros
Paul E. McKenney [Wed, 4 Jul 2018 21:33:59 +0000 (14:33 -0700)]
rcu: Remove rsp parameter from rcu_node tree accessor macros

There now is only one rcu_state structure in a given build of the Linux
kernel, so there is no need to pass it as a parameter to RCU's rcu_node
tree's accessor macros.  This commit therefore removes the rsp parameter
from those macros in kernel/rcu/rcu.h, and removes some now-unused rsp
local variables while in the area.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from expedited grace-period functions
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from expedited grace-period functions

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to
RCU's functions.  This commit therefore removes the rsp parameter
from the code in kernel/rcu/tree_exp.h, and removes all of the
rsp local variables while in the area.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from no-CBs CPU functions
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from no-CBs CPU functions

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to
RCU's functions.  This commit therefore removes the rsp parameter
from rcu_nocb_cpu_needs_barrier(), rcu_spawn_one_nocb_kthread(),
rcu_organize_nocb_kthreads(), rcu_nocb_cpu_needs_barrier(), and
rcu_nohz_full_cpu().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from print_cpu_stall_info()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from print_cpu_stall_info()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
print_cpu_stall_info().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_spawn_one_boost_kthread()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_spawn_one_boost_kthread()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_spawn_one_boost_kthread().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from dump_blkd_tasks() and friend
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from dump_blkd_tasks() and friend

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
dump_blkd_tasks() and rcu_preempt_blocked_readers_cgp().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_print_detail_task_stall()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_print_detail_task_stall()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_print_detail_task_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_init_one() and friends
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_init_one() and friends

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_init_one() and rcu_dump_rcu_node_tree().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_boot_init_percpu_data() and friends
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_boot_init_percpu_data() and friends

There now is only one rcu_state structure in a given build of
the Linux kernel, so there is no need to pass it as a parameter
to RCU's functions.  This commit therefore removes the rsp
parameter from rcu_boot_init_percpu_data(), rcu_init_percpu_data(),
rcu_cleanup_dying_idle_cpu(), and rcu_migrate_callbacks().  While in
the neighborhood, line the last three into rcutree_prepare_cpu(),
rcu_report_dead() and rcutree_migrate_callbacks(), respectively.
This also gets rid of the for_each_rcu_flavor() calls that were in
those tree functions.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from _rcu_barrier() and friends
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from _rcu_barrier() and friends

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
_rcu_barrier_trace() and _rcu_barrier().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from __rcu_pending()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from __rcu_pending()

There now is only one rcu_state structure in a given build of the Linux
kernel, so there is no need to pass it as a parameter to RCU's functions.
This commit therefore removes the rsp parameter from __rcu_pending(),
and also inlines it into rcu_pending(), removing the for_each_rcu_flavor()
while in the neighborhood..

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from __call_rcu() and friend
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from __call_rcu() and friend

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
__call_rcu_core() and __call_rcu().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from __rcu_process_callbacks()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from __rcu_process_callbacks()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
__rcu_process_callbacks(), and also inlines it into rcu_process_callbacks(),
removing the for_each_rcu_flavor() while in the neighborhood.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_check_gp_start_stall()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_check_gp_start_stall()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_check_gp_start_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from force-quiescent-state functions
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from force-quiescent-state functions

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
force_qs_rnp() and force_quiescent_state().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_do_batch()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_do_batch()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_do_batch().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from CPU hotplug functions
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from CPU hotplug functions

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_cleanup_dying_cpu() and rcu_cleanup_dead_cpu().  And, as long as
we are in the neighborhood, inlines them into rcutree_dying_cpu() and
rcutree_dead_cpu(), respectively.  This also eliminates a pair of
for_each_rcu_flavor() loops.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_check_quiescent_state()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_check_quiescent_state()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_check_quiescent_state().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_gp_kthread() and friends
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_gp_kthread() and friends

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_gp_init(), rcu_gp_fqs_check_wake(), rcu_gp_fqs(), rcu_gp_cleanup(),
and rcu_gp_kthread().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_gp_slow()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_gp_slow()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_gp_slow().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from note_gp_changes()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from note_gp_changes()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
note_gp_changes().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from __note_gp_changes()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from __note_gp_changes()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
__note_gp_changes().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_advance_cbs()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_advance_cbs()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_advance_cbs().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_accelerate_cbs_unlocked()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_accelerate_cbs_unlocked()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_accelerate_cbs_unlocked().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_accelerate_cbs()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_accelerate_cbs()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_accelerate_cbs().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_gp_kthread_wake()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_gp_kthread_wake()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_gp_kthread_wake().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_future_gp_cleanup()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_future_gp_cleanup()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_future_gp_cleanup().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from check_cpu_stall()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from check_cpu_stall()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
check_cpu_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from print_cpu_stall()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from print_cpu_stall()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
print_cpu_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from print_other_cpu_stall()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from print_other_cpu_stall()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
print_other_cpu_stall().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_stall_kick_kthreads()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_stall_kick_kthreads()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_stall_kick_kthreads().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_dump_cpu_stacks()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_dump_cpu_stacks()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_dump_cpu_stacks().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_check_gp_kthread_starvation()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_check_gp_kthread_starvation()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_check_gp_kthread_starvation().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from record_gp_stall_check_time()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from record_gp_stall_check_time()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
record_gp_stall_check_time().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_get_root()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_get_root()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_get_root().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_gp_in_progress()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_gp_in_progress()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_gp_in_progress().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_report_qs_rdp()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_report_qs_rdp()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_report_qs_rdp().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_report_unblock_qs_rnp()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_report_unblock_qs_rnp()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_report_unblock_qs_rnp(), which is particularly appropriate in
this case given that this parameter is no longer used.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_report_qs_rsp()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_report_qs_rsp()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_report_qs_rsp().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rsp parameter from rcu_report_qs_rnp()
Paul E. McKenney [Wed, 4 Jul 2018 00:22:34 +0000 (17:22 -0700)]
rcu: Remove rsp parameter from rcu_report_qs_rnp()

There now is only one rcu_state structure in a given build of the
Linux kernel, so there is no need to pass it as a parameter to RCU's
functions.  This commit therefore removes the rsp parameter from
rcu_report_qs_rnp().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rcu_data_p pointer to default rcu_data structure
Paul E. McKenney [Tue, 3 Jul 2018 22:54:39 +0000 (15:54 -0700)]
rcu: Remove rcu_data_p pointer to default rcu_data structure

The rcu_data_p pointer references the default set of per-CPU rcu_data
structures, that is, those that call_rcu() uses, as opposed to
call_rcu_bh() and sometimes call_rcu_sched().  But there is now only one
set of per-CPU rcu_data structures, so that one set is by definition
the default, which means that the rcu_data_p pointer no longer serves
any useful purpose.  This commit therefore removes it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rcu_state_p pointer to default rcu_state structure
Paul E. McKenney [Tue, 3 Jul 2018 22:54:39 +0000 (15:54 -0700)]
rcu: Remove rcu_state_p pointer to default rcu_state structure

The rcu_state_p pointer references the default rcu_state structure,
that is, the one that call_rcu() uses, as opposed to call_rcu_bh()
and sometimes call_rcu_sched().  But there is now only one rcu_state
structure, so that one structure is by definition the default, which
means that the rcu_state_p pointer no longer serves any useful purpose.
This commit therefore removes it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove rcu_state structure's ->rda field
Paul E. McKenney [Tue, 3 Jul 2018 22:37:16 +0000 (15:37 -0700)]
rcu: Remove rcu_state structure's ->rda field

The rcu_state structure's ->rda field was used to find the per-CPU
rcu_data structures corresponding to that rcu_state structure.  But now
there is only one rcu_state structure (creatively named "rcu_state")
and one set of per-CPU rcu_data structures (creatively named "rcu_data").
Therefore, uses of the ->rda field can always be replaced by "rcu_data,
and this commit makes that change and removes the ->rda field.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Eliminate rcu_state structure's ->call field
Paul E. McKenney [Tue, 3 Jul 2018 22:02:28 +0000 (15:02 -0700)]
rcu: Eliminate rcu_state structure's ->call field

The rcu_state structure's ->call field references the corresponding RCU
flavor's call_rcu() function.  However, now that there is only ever one
rcu_state structure in a given build of the Linux kernel, and that flavor
uses plain old call_rcu(), there is not a lot of point in continuing to
have the ->call field.  This commit therefore removes it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Remove RCU_STATE_INITIALIZER()
Paul E. McKenney [Tue, 3 Jul 2018 21:15:31 +0000 (14:15 -0700)]
rcu: Remove RCU_STATE_INITIALIZER()

Now that a given build of the Linux kernel has only one set of rcu_state,
rcu_node, and rcu_data structures, there is no point in creating a macro
to declare and compile-time initialize them.  This commit therefore
just does normal declaration and compile-time initialization of these
structures.  While in the area, this commit also removes #ifndefs of
the no-longer-ever-defined preprocessor macro RCU_TREE_NONCORE.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Express Tiny RCU updates in terms of RCU rather than RCU-sched
Paul E. McKenney [Tue, 3 Jul 2018 17:44:44 +0000 (10:44 -0700)]
rcu: Express Tiny RCU updates in terms of RCU rather than RCU-sched

This commit renames Tiny RCU functions so that the lowest level of
functionality is RCU (e.g., synchronize_rcu()) rather than RCU-sched
(e.g., synchronize_sched()).  This provides greater naming compatibility
with Tree RCU, which will in turn permit more LoC removal once
the RCU-sched and RCU-bh update-side API is removed.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Fix Tiny call_rcu()'s EXPORT_SYMBOL() in response to a bug
  report from kbuild test robot. ]

5 years agorcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds
Paul E. McKenney [Mon, 2 Jul 2018 21:30:37 +0000 (14:30 -0700)]
rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds

Now that RCU-preempt knows about preemption disabling, its implementation
of synchronize_rcu() works for synchronize_sched(), and likewise for the
other RCU-sched update-side API members.  This commit therefore confines
the RCU-sched update-side code to CONFIG_PREEMPT=n builds, and defines
RCU-sched's update-side API members in terms of those of RCU-preempt.

This means that any given build of the Linux kernel has only one
update-side flavor of RCU, namely RCU-preempt for CONFIG_PREEMPT=y builds
and RCU-sched for CONFIG_PREEMPT=n builds.  This in turn means that kernels
built with CONFIG_RCU_NOCB_CPU=y have only one rcuo kthread per CPU.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
5 years agorcu: Fix typo in rcu_get_gp_kthreads_prio() header comment
Paul E. McKenney [Mon, 2 Jul 2018 19:15:25 +0000 (12:15 -0700)]
rcu: Fix typo in rcu_get_gp_kthreads_prio() header comment

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Drop "wake" parameter from rcu_report_exp_rdp()
Paul E. McKenney [Mon, 2 Jul 2018 16:17:57 +0000 (09:17 -0700)]
rcu: Drop "wake" parameter from rcu_report_exp_rdp()

The rcu_report_exp_rdp() function is always invoked with its "wake"
argument set to "true", so this commit drops this parameter.  The only
potential call site that would use "false" is in the code driving the
expedited grace period, and that code uses rcu_report_exp_cpu_mult()
instead, which therefore retains its "wake" parameter.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Update comments and help text for no more RCU-bh updaters
Paul E. McKenney [Mon, 2 Jul 2018 16:04:27 +0000 (09:04 -0700)]
rcu: Update comments and help text for no more RCU-bh updaters

This commit updates comments and help text to account for the fact that
RCU-bh update-side functions are now simple wrappers for their RCU or
RCU-sched counterparts.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Define RCU-bh update API in terms of RCU
Paul E. McKenney [Sun, 1 Jul 2018 14:40:52 +0000 (07:40 -0700)]
rcu: Define RCU-bh update API in terms of RCU

Now that the main RCU API knows about softirq disabling and softirq's
quiescent states, the RCU-bh update code can be dispensed with.
This commit therefore removes the RCU-bh update-side implementation and
defines RCU-bh's update-side API in terms of that of either RCU-preempt or
RCU-sched, depending on the setting of the CONFIG_PREEMPT Kconfig option.

In kernels built with CONFIG_RCU_NOCB_CPU=y this has the knock-on effect
of reducing by one the number of rcuo kthreads per CPU.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Report expedited grace periods at context-switch time
Paul E. McKenney [Sat, 30 Jun 2018 22:23:37 +0000 (15:23 -0700)]
rcu: Report expedited grace periods at context-switch time

This commit reduces the latency of expedited RCU grace periods by
reporting a quiescent state for the CPU at context-switch time.
In CONFIG_PREEMPT=y kernels, if the outgoing task is still within an
RCU read-side critical section (and thus still blocking some grace
period, perhaps including this expedited grace period), then that task
will already have been placed on one of the leaf rcu_node structures'
->blkd_tasks list.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
5 years agorcu: Apply RCU-bh QSes to RCU-sched and RCU-preempt when safe
Paul E. McKenney [Thu, 28 Jun 2018 21:45:25 +0000 (14:45 -0700)]
rcu: Apply RCU-bh QSes to RCU-sched and RCU-preempt when safe

One necessary step towards consolidating the three flavors of RCU is to
make sure that the resulting consolidated "one flavor to rule them all"
correctly handles networking denial-of-service attacks.  One thing that
allows RCU-bh to do so is that __do_softirq() invokes rcu_bh_qs() every
so often, and so something similar has to happen for consolidated RCU.

This must be done carefully.  For example, if a preemption-disabled
region of code takes an interrupt which does softirq processing before
returning, consolidated RCU must ignore the resulting rcu_bh_qs()
invocations -- preemption is still disabled, and that means an RCU
reader for the consolidated flavor.

This commit therefore creates a new rcu_softirq_qs() that is called only
from the ksoftirqd task, thus avoiding the interrupted-a-preempted-region
problem.  This new rcu_softirq_qs() function invokes rcu_sched_qs(),
rcu_preempt_qs(), and rcu_preempt_deferred_qs().  The latter call handles
any deferred quiescent states.

Note that __do_softirq() still invokes rcu_bh_qs().  It will continue to
do so until a later stage of cleanup when the RCU-bh flavor is removed.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
[ paulmck: Fix !SMP issue located by kbuild test robot. ]

5 years agorcu: Add warning to detect half-interrupts
Paul E. McKenney [Thu, 28 Jun 2018 19:45:23 +0000 (12:45 -0700)]
rcu: Add warning to detect half-interrupts

RCU's dyntick-idle code is written to tolerate half-interrupts, that it,
either an interrupt that invokes rcu_irq_enter() but never invokes the
corresponding rcu_irq_exit() on the one hand, or an interrupt that never
invokes rcu_irq_enter() but does invoke the "corresponding" rcu_irq_exit()
on the other.  These things really did happen at one time, as evidenced
by this ca-2011 LKML post:

http://lkml.kernel.org/r/20111014170019.GE2428@linux.vnet.ibm.com

The reason why RCU tolerates half-interrupts is that usermode helpers
used exceptions to invoke a system call from within the kernel such that
the system call did a normal return (not a return from exception) to
the calling context.  This caused rcu_irq_enter() to be invoked without
a matching rcu_irq_exit().  However, usermode helpers have since been
rewritten to make much more housebroken use of workqueues, kernel threads,
and do_execve(), and therefore should no longer produce half-interrupts.
No one knows of any other source of half-interrupts, but then again,
no one seems insane enough to go audit the entire kernel to verify that
half-interrupts really are a relic of the past.

This commit therefore adds a pair of WARN_ON_ONCE() calls that will
trigger in the presence of half interrupts, which the code will continue
to handle correctly.  If neither of these WARN_ON_ONCE() trigger by
mid-2021, then perhaps RCU can stop handling half-interrupts, which
would be a considerable simplification.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Reported-by: Joel Fernandes <joel@joelfernandes.org>
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>