Commit 28b3ae42 authored by Uladzislau Rezki's avatar Uladzislau Rezki Committed by Paul E. McKenney
Browse files

rcu: Introduce CONFIG_RCU_EXP_CPU_STALL_TIMEOUT



Currently both expedited and regular grace period stall warnings use
a single timeout value that with units of seconds.  However, recent
Android use cases problem require a sub-100-millisecond expedited RCU CPU
stall warning.  Given that expedited RCU grace periods normally complete
in far less than a single millisecond, especially for small systems,
this is not unreasonable.

Therefore introduce the CONFIG_RCU_EXP_CPU_STALL_TIMEOUT kernel
configuration that defaults to 20 msec on Android and remains the same
as that of the non-expedited stall warnings otherwise.  It also can be
changed in run-time via: /sys/.../parameters/rcu_exp_cpu_stall_timeout.

[ paulmck: Default of zero to use CONFIG_RCU_STALL_TIMEOUT. ]

Signed-off-by: default avatarUladzislau Rezki <uladzislau.rezki@sony.com>
Signed-off-by: default avatarUladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 31231092
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -162,6 +162,26 @@ CONFIG_RCU_CPU_STALL_TIMEOUT
	Stall-warning messages may be enabled and disabled completely via
	/sys/module/rcupdate/parameters/rcu_cpu_stall_suppress.

CONFIG_RCU_EXP_CPU_STALL_TIMEOUT
--------------------------------

	Same as the CONFIG_RCU_CPU_STALL_TIMEOUT parameter but only for
	the expedited grace period. This parameter defines the period
	of time that RCU will wait from the beginning of an expedited
	grace period until it issues an RCU CPU stall warning. This time
	period is normally 20 milliseconds on Android devices.	A zero
	value causes the CONFIG_RCU_CPU_STALL_TIMEOUT value to be used,
	after conversion to milliseconds.

	This configuration parameter may be changed at runtime via the
	/sys/module/rcupdate/parameters/rcu_exp_cpu_stall_timeout, however
	this parameter is checked only at the beginning of a cycle. If you
	are in a current stall cycle, setting it to a new value will change
	the timeout for the -next- stall.

	Stall-warning messages may be enabled and disabled completely via
	/sys/module/rcupdate/parameters/rcu_cpu_stall_suppress.

RCU_STALL_DELAY_DELTA
---------------------

+12 −0
Original line number Diff line number Diff line
@@ -4893,6 +4893,18 @@

	rcupdate.rcu_cpu_stall_timeout= [KNL]
			Set timeout for RCU CPU stall warning messages.
			The value is in seconds and the maximum allowed
			value is 300 seconds.

	rcupdate.rcu_exp_cpu_stall_timeout= [KNL]
			Set timeout for expedited RCU CPU stall warning
			messages.  The value is in milliseconds
			and the maximum allowed value is 21000
			milliseconds. Please note that this value is
			adjusted to an arch timer tick resolution.
			Setting this to zero causes the value from
			rcupdate.rcu_cpu_stall_timeout to be used (after
			conversion from seconds to milliseconds).

	rcupdate.rcu_expedited= [KNL]
			Use expedited grace-period primitives, for
+14 −0
Original line number Diff line number Diff line
@@ -91,6 +91,20 @@ config RCU_CPU_STALL_TIMEOUT
	  RCU grace period persists, additional CPU stall warnings are
	  printed at more widely spaced intervals.

config RCU_EXP_CPU_STALL_TIMEOUT
	int "Expedited RCU CPU stall timeout in milliseconds"
	depends on RCU_STALL_COMMON
	range 0 21000
	default 20 if ANDROID
	default 0 if !ANDROID
	help
	  If a given expedited RCU grace period extends more than the
	  specified number of milliseconds, a CPU stall warning is printed.
	  If the RCU grace period persists, additional CPU stall warnings
	  are printed at more widely spaced intervals.  A value of zero
	  says to use the RCU_CPU_STALL_TIMEOUT value converted from
	  seconds to milliseconds.

config RCU_TRACE
	bool "Enable tracing for RCU"
	depends on DEBUG_KERNEL
+2 −0
Original line number Diff line number Diff line
@@ -210,7 +210,9 @@ static inline bool rcu_stall_is_suppressed_at_boot(void)
extern int rcu_cpu_stall_ftrace_dump;
extern int rcu_cpu_stall_suppress;
extern int rcu_cpu_stall_timeout;
extern int rcu_exp_cpu_stall_timeout;
int rcu_jiffies_till_stall_check(void);
int rcu_exp_jiffies_till_stall_check(void);

static inline bool rcu_stall_is_suppressed(void)
{
+2 −2
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ static void synchronize_rcu_expedited_wait(void)
	struct rcu_node *rnp_root = rcu_get_root();

	trace_rcu_exp_grace_period(rcu_state.name, rcu_exp_gp_seq_endval(), TPS("startwait"));
	jiffies_stall = rcu_jiffies_till_stall_check();
	jiffies_stall = rcu_exp_jiffies_till_stall_check();
	jiffies_start = jiffies;
	if (tick_nohz_full_enabled() && rcu_inkernel_boot_has_ended()) {
		if (synchronize_rcu_expedited_wait_once(1))
@@ -571,7 +571,7 @@ static void synchronize_rcu_expedited_wait(void)
				dump_cpu_task(cpu);
			}
		}
		jiffies_stall = 3 * rcu_jiffies_till_stall_check() + 3;
		jiffies_stall = 3 * rcu_exp_jiffies_till_stall_check() + 3;
	}
}

Loading