[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1] keyhandler: add handler to show Xen command line


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 29 Jul 2026 23:15:00 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sjCjhJ26VF+1qPOCp45hylXgxWwgLMWRt5jQ8dGvmEg=; b=XY84uD8Z1HwuhbyMXzT4i4wWjI/JkZR4mO4Ys/JsXmWnUHRxx3DrfFXttA7ufPaRa46PHf6RBy1zV5CL3feZeGY7YNmhfMwqyhLTMc5OQKNcHbwGW9n9k6rWRGJv9I268v8UzH0jphxWofSqqsrToE6sxc6+V0/5RnVtkwG0lz7I9AnDcybNgEXZQv63fbm6E4zLbeJIfNhncasqgvc1RzfwKua0SwFHzhuc0xV+0jr07w0pg/iJ+UZrmGass02BfoIj+AJG+8ZGMArtZXt6J19TtdOgmmko/GuXtGwG9S+SA7y1O1NYo4D80HTz1ESD7pFfv5FkM4264wxMBsOgYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Uw+q38XXP6FAUPrVJqVonnO20kUzJYNHR+4QKcxSm+7g3aIAG9Xuhhve72ocMFTATO07+HY5/PejaQ7+Syotghz9zUFb3d0B4kTq/5o6RGw1tPRvwTwPHwkP08WcZF7D4i/h2sh+JdvxYHcag0er3TTnf9ZLvTIgmkbs1QA5T2+8w02wQ3GAsBbhRmRZbvmpOfVr1E9nlbRvzP6M1cUiKnu6lXriyEoTcmeh3Lukyv4I2WcUPRhNWUUWDXBu582R61wWGEHwjW3dUGOqZ4+0/wCpu/t/kNYYsfbAAAzU2VoM6Tw8APq53hz+tlOiep08DboKScGQT4Xw1t8BV8zw8g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:Message-ID:MIME-Version:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:Message-ID:MIME-Version:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:Message-ID:MIME-Version:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger.pau@xxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxxx
  • Delivery-date: Thu, 30 Jul 2026 06:16:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.