All of lore.kernel.org
 help / color / mirror / Atom feed
* And speaking of avoiding inconveniencing users...
@ 2022-05-09 20:58 Paul E. McKenney
  2022-05-10 20:46 ` Uladzislau Rezki
  0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2022-05-09 20:58 UTC (permalink / raw)
  To: urezki; +Cc: rcu, linux-kernel

Hello, Uladzislau,

And I wasn't paying attention when reviewing this patch:

084e1c049a8e ("rcu: Introduce CONFIG_RCU_EXP_CPU_STALL_TIMEOUT")

Distros specifying 60 seconds for the stall timeout get hit with a silent
change to 21 seconds for the expedited stall timeout.

Unless you tell me otherwise, I will merge the following diff into the
above commit.  So please let me know if this will cause any problems.

							Thanx, Paul

------------------------------------------------------------------------

diff --git a/Documentation/RCU/stallwarn.rst b/Documentation/RCU/stallwarn.rst
index 1d863b04727c3..794837eb519b9 100644
--- a/Documentation/RCU/stallwarn.rst
+++ b/Documentation/RCU/stallwarn.rst
@@ -166,10 +166,12 @@ 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.
+	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
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 34d44648f3f5d..ca9db809beda3 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4936,6 +4936,9 @@
 			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
diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
index 39dd4b9d647f8..9b64e55d4f615 100644
--- a/kernel/rcu/Kconfig.debug
+++ b/kernel/rcu/Kconfig.debug
@@ -85,15 +85,16 @@ config RCU_CPU_STALL_TIMEOUT
 config RCU_EXP_CPU_STALL_TIMEOUT
 	int "Expedited RCU CPU stall timeout in milliseconds"
 	depends on RCU_STALL_COMMON
-	range 1 21000
+	range 0 21000
 	default 20 if ANDROID
-	default 21000 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.
+	  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"
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index 0a25a4ea6eef8..2464b0eccfd02 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -31,15 +31,17 @@ int rcu_exp_jiffies_till_stall_check(void)
 	int exp_stall_delay_delta = 0;
 	int till_stall_check;
 
-	/*
-	 * Limit check must be consistent with the Kconfig limits for
-	 * CONFIG_RCU_EXP_CPU_STALL_TIMEOUT, so check the allowed range.
-	 * The minimum clamped value is "2UL", because at least one full
-	 * tick has to be guaranteed.
-	 */
+	// Zero says to use rcu_cpu_stall_timeout, but in milliseconds.
+	if (!cpu_stall_timeout)
+		cpu_stall_timeout = jiffies_to_msecs(rcu_jiffies_till_stall_check());
+
+	// Limit check must be consistent with the Kconfig limits for
+	// CONFIG_RCU_EXP_CPU_STALL_TIMEOUT, so check the allowed range.
+	// The minimum clamped value is "2UL", because at least one full
+	// tick has to be guaranteed.
 	till_stall_check = clamp(msecs_to_jiffies(cpu_stall_timeout), 2UL, 21UL * HZ);
 
-	if (jiffies_to_msecs(till_stall_check) != cpu_stall_timeout)
+	if (cpu_stall_timeout && jiffies_to_msecs(till_stall_check) != cpu_stall_timeout)
 		WRITE_ONCE(rcu_exp_cpu_stall_timeout, jiffies_to_msecs(till_stall_check));
 
 #ifdef CONFIG_PROVE_RCU

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: And speaking of avoiding inconveniencing users...
  2022-05-09 20:58 And speaking of avoiding inconveniencing users Paul E. McKenney
@ 2022-05-10 20:46 ` Uladzislau Rezki
  0 siblings, 0 replies; 2+ messages in thread
From: Uladzislau Rezki @ 2022-05-10 20:46 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: RCU, LKML

Hello, Paul.

Indeed the changed switched to 21 seconds. What is about just set the
60 000 for !ANDROID?

default 60000 if !ANDROID

On Mon, May 9, 2022 at 10:58 PM Paul E. McKenney <paulmck@kernel.org> wrote:
>
> Hello, Uladzislau,
>
> And I wasn't paying attention when reviewing this patch:
>
> 084e1c049a8e ("rcu: Introduce CONFIG_RCU_EXP_CPU_STALL_TIMEOUT")
>
> Distros specifying 60 seconds for the stall timeout get hit with a silent
> change to 21 seconds for the expedited stall timeout.
>
> Unless you tell me otherwise, I will merge the following diff into the
> above commit.  So please let me know if this will cause any problems.
>
>                                                         Thanx, Paul
>
> ------------------------------------------------------------------------
>
> diff --git a/Documentation/RCU/stallwarn.rst b/Documentation/RCU/stallwarn.rst
> index 1d863b04727c3..794837eb519b9 100644
> --- a/Documentation/RCU/stallwarn.rst
> +++ b/Documentation/RCU/stallwarn.rst
> @@ -166,10 +166,12 @@ 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.
> +       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
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 34d44648f3f5d..ca9db809beda3 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -4936,6 +4936,9 @@
>                         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
> diff --git a/kernel/rcu/Kconfig.debug b/kernel/rcu/Kconfig.debug
> index 39dd4b9d647f8..9b64e55d4f615 100644
> --- a/kernel/rcu/Kconfig.debug
> +++ b/kernel/rcu/Kconfig.debug
> @@ -85,15 +85,16 @@ config RCU_CPU_STALL_TIMEOUT
>  config RCU_EXP_CPU_STALL_TIMEOUT
>         int "Expedited RCU CPU stall timeout in milliseconds"
>         depends on RCU_STALL_COMMON
> -       range 1 21000
> +       range 0 21000
>         default 20 if ANDROID
> -       default 21000 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.
> +         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"
> diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
> index 0a25a4ea6eef8..2464b0eccfd02 100644
> --- a/kernel/rcu/tree_stall.h
> +++ b/kernel/rcu/tree_stall.h
> @@ -31,15 +31,17 @@ int rcu_exp_jiffies_till_stall_check(void)
>         int exp_stall_delay_delta = 0;
>         int till_stall_check;
>
> -       /*
> -        * Limit check must be consistent with the Kconfig limits for
> -        * CONFIG_RCU_EXP_CPU_STALL_TIMEOUT, so check the allowed range.
> -        * The minimum clamped value is "2UL", because at least one full
> -        * tick has to be guaranteed.
> -        */
> +       // Zero says to use rcu_cpu_stall_timeout, but in milliseconds.
> +       if (!cpu_stall_timeout)
> +               cpu_stall_timeout = jiffies_to_msecs(rcu_jiffies_till_stall_check());
> +
> +       // Limit check must be consistent with the Kconfig limits for
> +       // CONFIG_RCU_EXP_CPU_STALL_TIMEOUT, so check the allowed range.
> +       // The minimum clamped value is "2UL", because at least one full
> +       // tick has to be guaranteed.
>         till_stall_check = clamp(msecs_to_jiffies(cpu_stall_timeout), 2UL, 21UL * HZ);
>
> -       if (jiffies_to_msecs(till_stall_check) != cpu_stall_timeout)
> +       if (cpu_stall_timeout && jiffies_to_msecs(till_stall_check) != cpu_stall_timeout)
>                 WRITE_ONCE(rcu_exp_cpu_stall_timeout, jiffies_to_msecs(till_stall_check));
>
>  #ifdef CONFIG_PROVE_RCU



-- 
Uladzislau Rezki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-10 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 20:58 And speaking of avoiding inconveniencing users Paul E. McKenney
2022-05-10 20:46 ` Uladzislau Rezki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.