|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1] keyhandler: add handler to show Xen command line
From: Denis Mukhin <dmukhin@xxxxxxxx> Currently there's no way to print Xen command line on the emergency console for debugging purposes. Add new keyhander 'C' to add (saved) command line printout for debugging the system. Also, fix indentation for KEYHANDLER() entries in 'keyhandler' array. Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx> --- CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/2717339023 --- xen/common/kernel.c | 5 +++++ xen/common/keyhandler.c | 18 +++++++++++++----- xen/include/xen/lib.h | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/xen/common/kernel.c b/xen/common/kernel.c index fb45f8139995..9718a89d8088 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -232,6 +232,11 @@ void __init cmdline_parse(const char *cmdline) #endif } +const char *cmdline_get(void) +{ + return saved_cmdline; +} + int parse_bool(const char *s, const char *e) { size_t len = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s); diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index cb6df2823b00..55a370ac1790 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -28,7 +28,7 @@ static unsigned char keypress_key; static bool alt_key_handling; static keyhandler_fn_t cf_check show_handlers, cf_check dump_hwdom_registers, - cf_check dump_domains, cf_check read_clocks; + cf_check dump_domains, cf_check read_clocks, show_cmdline; static irq_keyhandler_fn_t cf_check do_toggle_alt_key, cf_check dump_registers, cf_check reboot_machine, cf_check run_all_keyhandlers; @@ -60,15 +60,17 @@ static struct keyhandler { IRQ_KEYHANDLER('*', run_all_keyhandlers, "print all diagnostics", 0), #ifdef CONFIG_PERF_COUNTERS - KEYHANDLER('p', perfc_printall, "print performance counters", 1), - KEYHANDLER('P', perfc_reset, "reset performance counters", 0), + KEYHANDLER('p', perfc_printall, "print performance counters", 1), + KEYHANDLER('P', perfc_reset, "reset performance counters", 0), #endif #ifdef CONFIG_DEBUG_LOCK_PROFILE - KEYHANDLER('l', spinlock_profile_printall, "print lock profile info", 1), - KEYHANDLER('L', spinlock_profile_reset, "reset lock profile info", 0), + KEYHANDLER('l', spinlock_profile_printall, "print lock profile info", 1), + KEYHANDLER('L', spinlock_profile_reset, "reset lock profile info", 0), #endif + KEYHANDLER('C', show_cmdline, "show saved command line", 0), + #undef IRQ_KEYHANDLER #undef KEYHANDLER }; @@ -512,6 +514,12 @@ static void cf_check do_toggle_alt_key(unsigned char key, bool unused) alt_key_handling ? "alternative" : "normal"); } +static void cf_check show_cmdline(unsigned char key) +{ + printk("'%c' pressed -> showing saved command line\n", key); + printk("%s\n", cmdline_get()); +} + void __init initialize_keytable(void) { if ( num_present_cpus() > 16 ) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 3c545ff33c61..094873dc8ba6 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -19,6 +19,7 @@ struct domain; +const char *cmdline_get(void); void cmdline_parse(const char *cmdline); int parse_bool(const char *s, const char *e); -- 2.54.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |