Skip to contentSkip to conversation

Simplify sysrq help

PATCH In review Andras Sebok 3 participants 5 messages Aug 28, 2023

Subsystems (12)
DRM drivers DRM misc PowerPC MIPS +8 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Simplify sysrq help

This patch simplyfies sysrq help menu by moving each command to a separate line and by moving the key from brackets to after a semicolon.

before:
sysrq: HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) force-fb(v) show-blocked-tasks(w) dump-ftrace-buffer(z)

after:
sysrq: HELP :
loglevel : 0-9
reboot : b
crash : c
terminate-all-tasks : e
memory-full-oom-kill : f
kill-all-tasks : i
thaw-filesystems : j
sak : k
show-backtrace-all-active-cpus : l
show-memory-usage : m
nice-all-RT-tasks : n
poweroff : o
show-registers : p
show-all-timers : q
unraw : r
sync : s
show-task-states : t
unmount : u
force-fb : v
show-blocked-tasks : w
dump-ftrace-buffer : z

---
 arch/alpha/kernel/setup.c       |  2 +-
 arch/loongarch/kernel/sysrq.c   |  2 +-
 arch/mips/kernel/sysrq.c        |  2 +-
 arch/powerpc/xmon/xmon.c        |  2 +-
 arch/sparc/kernel/process_64.c  |  4 +--
 drivers/gpu/drm/drm_fb_helper.c |  2 +-
 drivers/tty/sysrq.c             | 44 ++++++++++++++++-----------------
 kernel/debug/debug_core.c       |  2 +-
 kernel/power/poweroff.c         |  2 +-
 kernel/rcu/tree_stall.h         |  2 +-
 10 files changed, 32 insertions(+), 32 deletions(-)
arch/alpha/kernel/setup.c +1 -1
index 3d7473531ab1..d660a363fab8 100644
@@ -428,7 +428,7 @@ static void sysrq_reboot_handler(int unused)
 
 static const struct sysrq_key_op srm_sysrq_reboot_op = {
 	.handler	= sysrq_reboot_handler,
-	.help_msg       = "reboot(b)",
+	.help_msg       = "reboot : b",
 	.action_msg     = "Resetting",
 	.enable_mask    = SYSRQ_ENABLE_BOOT,
 };
arch/loongarch/kernel/sysrq.c +1 -1
index 366baef72d29..470a9017ca84 100644
@@ -53,7 +53,7 @@ static void sysrq_handle_tlbdump(int key)
 
 static struct sysrq_key_op sysrq_tlbdump_op = {
 	.handler        = sysrq_handle_tlbdump,
-	.help_msg       = "show-tlbs(x)",
+	.help_msg       = "show-tlbs : x",
 	.action_msg     = "Show TLB entries",
 	.enable_mask	= SYSRQ_ENABLE_DUMP,
 };
arch/mips/kernel/sysrq.c +1 -1
index 9c1a2019113b..ac0265a96cbe 100644
@@ -54,7 +54,7 @@ static void sysrq_handle_tlbdump(int key)
 
 static const struct sysrq_key_op sysrq_tlbdump_op = {
 	.handler        = sysrq_handle_tlbdump,
-	.help_msg       = "show-tlbs(x)",
+	.help_msg       = "show-tlbs : x",
 	.action_msg     = "Show TLB entries",
 	.enable_mask	= SYSRQ_ENABLE_DUMP,
 };
arch/powerpc/xmon/xmon.c +1 -1
index fae747cc57d2..bcfca6ccd8ae 100644
@@ -4007,7 +4007,7 @@ static void sysrq_handle_xmon(int key)
 
 static const struct sysrq_key_op sysrq_xmon_op = {
 	.handler =	sysrq_handle_xmon,
-	.help_msg =	"xmon(x)",
+	.help_msg =	"xmon : x",
 	.action_msg =	"Entering xmon",
 };
 
arch/sparc/kernel/process_64.c +2 -2
index b51d8fb0ecdc..11b85c326362 100644
@@ -302,7 +302,7 @@ static void sysrq_handle_globreg(int key)
 
 static const struct sysrq_key_op sparc_globalreg_op = {
 	.handler	= sysrq_handle_globreg,
-	.help_msg	= "global-regs(y)",
+	.help_msg	= "global-regs : y",
 	.action_msg	= "Show Global CPU Regs",
 };
 
@@ -377,7 +377,7 @@ static void sysrq_handle_globpmu(int key)
 
 static const struct sysrq_key_op sparc_globalpmu_op = {
 	.handler	= sysrq_handle_globpmu,
-	.help_msg	= "global-pmu(x)",
+	.help_msg	= "global-pmu : x",
 	.action_msg	= "Show Global PMU Regs",
 };
 
drivers/gpu/drm/drm_fb_helper.c +1 -1
index 61a5d450cc20..105b296b17db 100644
@@ -308,7 +308,7 @@ static void drm_fb_helper_sysrq(int dummy1)
 
 static const struct sysrq_key_op sysrq_drm_fb_helper_restore_op = {
 	.handler = drm_fb_helper_sysrq,
-	.help_msg = "force-fb(v)",
+	.help_msg = "force-fb : v",
 	.action_msg = "Restore framebuffer console",
 };
 #else
drivers/tty/sysrq.c +22 -22

178 lines not on this page · raw message

kernel/debug/debug_core.c +1 -1
index d5e9ccde3ab8..561721e124cd 100644
@@ -988,7 +988,7 @@ static void sysrq_handle_dbg(int key)
 
 static const struct sysrq_key_op sysrq_dbg_op = {
 	.handler	= sysrq_handle_dbg,
-	.help_msg	= "debug(g)",
+	.help_msg	= "debug : g",
 	.action_msg	= "DEBUG",
 };
 #endif
kernel/power/poweroff.c +1 -1
index 562aa0e450ed..d9c0e6ea079a 100644
@@ -31,7 +31,7 @@ static void handle_poweroff(int key)
 
 static const struct sysrq_key_op	sysrq_poweroff_op = {
 	.handler        = handle_poweroff,
-	.help_msg       = "poweroff(o)",
+	.help_msg       = "poweroff : o",
 	.action_msg     = "Power Off",
 	.enable_mask	= SYSRQ_ENABLE_BOOT,
 };
kernel/rcu/tree_stall.h +1 -1
index b10b8349bb2a..17a7bf7b0a2b 100644
@@ -1042,7 +1042,7 @@ static void sysrq_show_rcu(int key)
 
 static const struct sysrq_key_op sysrq_rcudump_op = {
 	.handler = sysrq_show_rcu,
-	.help_msg = "show-rcu(y)",
+	.help_msg = "show-rcu : y",
 	.action_msg = "Show RCU tree",
 	.enable_mask = SYSRQ_ENABLE_DUMP,
 };
Signature · 1 line
2.41.0
#1 lore raw

PATCH 2/2 Add disabled text to indicate inactive commands in sysrq help menu

This patch adds disabled text after disabled commands in sysrq help.

before:
sak : k

after:
sak : k (disabled)

---
 drivers/tty/sysrq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/tty/sysrq.c +3 -0
index 831cdadf366f..1af78f76232e 100644
@@ -617,6 +617,9 @@ void __handle_sysrq(int key, bool check_mask)
 				if (j != i)
 					continue;
 				pr_cont("%s ", sysrq_key_table[i]->help_msg);
+				if (!check_mask || (check_mask &&
+					!sysrq_on_mask(sysrq_key_table[i]->enable_mask)))
+					pr_cont("(disabled)");
 				pr_cont("\n");
 			}
 		}
Signature · 1 line
2.41.0
maintainer
#2 lore raw

Re: [PATCH 2/2] Add disabled text to indicate inactive commands in sysrq help menu

Quoted 7 lines · Andras Sebok

This patch adds disabled text after disabled commands in sysrq help.

before:
sak : k

after:
sak : k (disabled)

No need to tease people about options they can not use :(

sorry,

greg k-h

maintainer
#3 lore raw
In reply to Andras Sebok
Quoted 21 lines · Andras Sebok

This patch simplyfies sysrq help menu by moving each command to a separate line and by moving the key from brackets to after a semicolon.

before:
sysrq: HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u) force-fb(v) show-blocked-tasks(w) dump-ftrace-buffer(z)

after:
sysrq: HELP :
loglevel : 0-9
reboot : b
crash : c
terminate-all-tasks : e
memory-full-oom-kill : f
kill-all-tasks : i
thaw-filesystems : j
sak : k
show-backtrace-all-active-cpus : l
show-memory-usage : m
nice-all-RT-tasks : n
poweroff : o
show-registers : p

Quoted 8 lines

show-all-timers : q
unraw : r
sync : s
show-task-states : t
unmount : u
force-fb : v
show-blocked-tasks : w
dump-ftrace-buffer : z

So now the options all scroll off the screen? Are you sure this is wise? What problem are you trying to solve here, it just looks like you are changing one "help text format for another", and doesn't actually change much of anything.

Note the:
sysrq: HELP :

line format being different from all the others makes this not even look correct?

So I really do not see the point of this change here, why is it needed?

thanks,

greg k-h

#4 lore raw
Quoted 4 lines · Greg KH

So now the options all scroll off the screen? Are you sure this is wise? What problem are you trying to solve here, it just looks like you are changing one "help text format for another", and doesn't actually change much of anything.

Indeed, if you are using a VT console, this is a bad, Bad, BAD idea, since there is very limited console scrollback, and this would blow away a huge amount of useful information. Maybe it might be useful for novices who are using a serial console, but magic sysrq is primarily used by experts, not by novices....

- Ted