Skip to content

Commit 203e435

Browse files
paulmckrcuPeter Zijlstra
authored andcommitted
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
1 parent 6366d06 commit 203e435

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,12 +889,13 @@
889889
cs89x0_media= [HW,NET]
890890
Format: { rj45 | aui | bnc }
891891

892-
csdlock_debug= [KNL] Enable debug add-ons of cross-CPU function call
893-
handling. When switched on, additional debug data is
894-
printed to the console in case a hanging CPU is
895-
detected, and that CPU is pinged again in order to try
896-
to resolve the hang situation. The default value of
897-
this option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
892+
csdlock_debug= [KNL] Enable or disable debug add-ons of cross-CPU
893+
function call handling. When switched on,
894+
additional debug data is printed to the console
895+
in case a hanging CPU is detected, and that
896+
CPU is pinged again in order to try to resolve
897+
the hang situation. The default value of this
898+
option depends on the CSD_LOCK_WAIT_DEBUG_DEFAULT
898899
Kconfig option.
899900

900901
dasd= [HW,NET]

kernel/smp.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,16 @@ static DEFINE_STATIC_KEY_MAYBE(CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT, csdlock_debug
116116
*/
117117
static int __init csdlock_debug(char *str)
118118
{
119+
int ret;
119120
unsigned int val = 0;
120121

121-
get_option(&str, &val);
122-
if (val)
123-
static_branch_enable(&csdlock_debug_enabled);
122+
ret = get_option(&str, &val);
123+
if (ret) {
124+
if (val)
125+
static_branch_enable(&csdlock_debug_enabled);
126+
else
127+
static_branch_disable(&csdlock_debug_enabled);
128+
}
124129

125130
return 1;
126131
}

0 commit comments

Comments
 (0)