lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220509205815.GA1885269@paulmck-ThinkPad-P17-Gen-1>
Date:   Mon, 9 May 2022 13:58:15 -0700
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     urezki@...il.com
Cc:     rcu@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: And speaking of avoiding inconveniencing users...

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ