mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/common: add keyhandler to show Xen command line
Currently there's no way to print Xen command line on the emergency console for debugging purposes when 'xl' is unavailable. Add new print_cmdline() function to print both built-in and run-time command lines on the console. To allow built-in command printout, drop __initconst in 'opt_builtin_cmdline' declaration. Add new keyhander '?' to show command line printout. Signed-off-by: Denis Mukhin <dmukhin@ford.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
ebc00c30c6
commit
0edf0ada32
3 files changed
+29
-2
No files matched your search
+19
-1
@@ -35,7 +35,7 @@ boolean_param("dit", opt_dit);
|
||||
#endif
|
||||
|
||||
static xen_commandline_t __ro_after_init saved_cmdline;
|
||||
static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
|
||||
static const char opt_builtin_cmdline[] = CONFIG_CMDLINE;
|
||||
char __ro_after_init xen_cap_info[128];
|
||||
|
||||
static int assign_integer_param(const struct kernel_param *param, uint64_t val)
|
||||
@@ -758,6 +758,24 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
void print_cmdline(void)
|
||||
{
|
||||
const char *cmdline;
|
||||
|
||||
if ( opt_builtin_cmdline[0] )
|
||||
printk("Built-in command line: %s\n", opt_builtin_cmdline);
|
||||
|
||||
if ( IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) )
|
||||
cmdline = "<ignored> (CONFIG_CMDLINE_OVERRIDE=y)";
|
||||
else if ( saved_cmdline[0] )
|
||||
cmdline = saved_cmdline;
|
||||
else
|
||||
cmdline = NULL;
|
||||
|
||||
if ( cmdline )
|
||||
printk("Command line: %s\n", cmdline);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: 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, cf_check show_system_info;
|
||||
static irq_keyhandler_fn_t cf_check do_toggle_alt_key, cf_check dump_registers,
|
||||
cf_check reboot_machine, cf_check run_all_keyhandlers;
|
||||
|
||||
@@ -57,6 +57,7 @@ static struct keyhandler {
|
||||
IRQ_KEYHANDLER('R', reboot_machine, "reboot machine", 0),
|
||||
KEYHANDLER('t', read_clocks, "display multi-cpu clock info", 1),
|
||||
KEYHANDLER('0', dump_hwdom_registers, "dump Dom0 registers", 1),
|
||||
KEYHANDLER('?', show_system_info, "show system information", false),
|
||||
IRQ_KEYHANDLER('*', run_all_keyhandlers, "print all diagnostics", 0),
|
||||
|
||||
#ifdef CONFIG_PERF_COUNTERS
|
||||
@@ -138,6 +139,13 @@ static void cf_check show_handlers(unsigned char key)
|
||||
isprint(i) ? i : ' ', i, key_table[i].desc);
|
||||
}
|
||||
|
||||
static void cf_check show_system_info(unsigned char key)
|
||||
{
|
||||
printk("'%c' pressed -> showing system information\n", key);
|
||||
|
||||
print_cmdline();
|
||||
}
|
||||
|
||||
static cpumask_t dump_execstate_mask;
|
||||
|
||||
void cf_check dump_execstate(const struct cpu_user_regs *regs)
|
||||
|
||||
@@ -48,6 +48,7 @@ int parse_signed_integer(const char *name, const char *s, const char *e,
|
||||
int cmdline_strcmp(const char *frag, const char *name);
|
||||
|
||||
void print_version(void);
|
||||
void print_cmdline(void);
|
||||
|
||||
#ifdef CONFIG_DEBUG_TRACE
|
||||
extern void debugtrace_dump(void);
|
||||
|
||||