[tip:,smp/core] kernel/smp: Make csdlock_debug= resettable

Message ID 167999248681.5837.4240401894848544789.tip-bot2@tip-bot2
State New
Headers
Series [tip:,smp/core] kernel/smp: Make csdlock_debug= resettable |

Commit Message

tip-bot2 for Thomas Gleixner March 28, 2023, 8:34 a.m. UTC
  The following commit has been merged into the smp/core branch of tip:

Commit-ID:     203e435844734cfa503cd1755f35db2514db5cca
Gitweb:        https://git.kernel.org/tip/203e435844734cfa503cd1755f35db2514db5cca
Author:        Paul E. McKenney <paulmck@kernel.org>
AuthorDate:    Mon, 20 Mar 2023 17:55:16 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 24 Mar 2023 11:01:26 +01:00

kernel/smp: Make csdlock_debug= resettable

It is currently possible to set the csdlock_debug_enabled static
branch, but not to reset it.  This is an issue when several different
entities supply kernel boot parameters and also for kernels built with
CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT=y.

Therefore, make the csdlock_debug=0 kernel boot parameter turn off
debugging.  Last one wins!

Reported-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20230321005516.50558-4-paulmck@kernel.org
---
 Documentation/admin-guide/kernel-parameters.txt | 13 +++++++------
 kernel/smp.c                                    | 11 ++++++++---
 2 files changed, 15 insertions(+), 9 deletions(-)
  

Comments

Paul E. McKenney March 28, 2023, 6:16 p.m. UTC | #1
On Tue, Mar 28, 2023 at 08:34:46AM -0000, tip-bot2 for Paul E. McKenney wrote:
> The following commit has been merged into the smp/core branch of tip:
> 
> Commit-ID:     203e435844734cfa503cd1755f35db2514db5cca
> Gitweb:        https://git.kernel.org/tip/203e435844734cfa503cd1755f35db2514db5cca
> Author:        Paul E. McKenney <paulmck@kernel.org>
> AuthorDate:    Mon, 20 Mar 2023 17:55:16 -07:00
> Committer:     Peter Zijlstra <peterz@infradead.org>
> CommitterDate: Fri, 24 Mar 2023 11:01:26 +01:00
> 
> kernel/smp: Make csdlock_debug= resettable

Very good, thank you!  I have removed these from the -rcu tree's "dev"
branch, and if testing goes well will be sending the new version to -next.

							Thanx, Paul

> It is currently possible to set the csdlock_debug_enabled static
> branch, but not to reset it.  This is an issue when several different
> entities supply kernel boot parameters and also for kernels built with
> CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT=y.
> 
> Therefore, make the csdlock_debug=0 kernel boot parameter turn off
> debugging.  Last one wins!
> 
> Reported-by: Jes Sorensen <Jes.Sorensen@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Acked-by: Juergen Gross <jgross@suse.com>
> Link: https://lore.kernel.org/r/20230321005516.50558-4-paulmck@kernel.org
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 13 +++++++------
>  kernel/smp.c                                    | 11 ++++++++---
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index b15198a..5f2ec4b 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -889,12 +889,13 @@
>  	cs89x0_media=	[HW,NET]
>  			Format: { rj45 | aui | bnc }
>  
> -	csdlock_debug=	[KNL] Enable debug add-ons of cross-CPU function call
> -			handling. When switched on, additional debug data is
> -			printed to the console in case a hanging CPU is
> -			detected, and that CPU is pinged again in order to try
> -			to resolve the hang situation.  The default value of
> -			this option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
> +	csdlock_debug=	[KNL] Enable or disable debug add-ons of cross-CPU
> +			function call handling. When switched on,
> +			additional debug data is printed to the console
> +			in case a hanging CPU is detected, and that
> +			CPU is pinged again in order to try to resolve
> +			the hang situation.  The default value of this
> +			option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
>  			Kconfig option.
>  
>  	dasd=		[HW,NET]
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 7a85bcd..298ba75 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -116,11 +116,16 @@ static DEFINE_STATIC_KEY_MAYBE(CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT, csdlock_debug
>   */
>  static int __init csdlock_debug(char *str)
>  {
> +	int ret;
>  	unsigned int val = 0;
>  
> -	get_option(&str, &val);
> -	if (val)
> -		static_branch_enable(&csdlock_debug_enabled);
> +	ret = get_option(&str, &val);
> +	if (ret) {
> +		if (val)
> +			static_branch_enable(&csdlock_debug_enabled);
> +		else
> +			static_branch_disable(&csdlock_debug_enabled);
> +	}
>  
>  	return 1;
>  }
  

Patch

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b15198a..5f2ec4b 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -889,12 +889,13 @@ 
 	cs89x0_media=	[HW,NET]
 			Format: { rj45 | aui | bnc }
 
-	csdlock_debug=	[KNL] Enable debug add-ons of cross-CPU function call
-			handling. When switched on, additional debug data is
-			printed to the console in case a hanging CPU is
-			detected, and that CPU is pinged again in order to try
-			to resolve the hang situation.  The default value of
-			this option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
+	csdlock_debug=	[KNL] Enable or disable debug add-ons of cross-CPU
+			function call handling. When switched on,
+			additional debug data is printed to the console
+			in case a hanging CPU is detected, and that
+			CPU is pinged again in order to try to resolve
+			the hang situation.  The default value of this
+			option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
 			Kconfig option.
 
 	dasd=		[HW,NET]
diff --git a/kernel/smp.c b/kernel/smp.c
index 7a85bcd..298ba75 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -116,11 +116,16 @@  static DEFINE_STATIC_KEY_MAYBE(CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT, csdlock_debug
  */
 static int __init csdlock_debug(char *str)
 {
+	int ret;
 	unsigned int val = 0;
 
-	get_option(&str, &val);
-	if (val)
-		static_branch_enable(&csdlock_debug_enabled);
+	ret = get_option(&str, &val);
+	if (ret) {
+		if (val)
+			static_branch_enable(&csdlock_debug_enabled);
+		else
+			static_branch_disable(&csdlock_debug_enabled);
+	}
 
 	return 1;
 }