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

[PATCH v4] xen/common: add keyhandler to show Xen command line


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Tue, 11 Aug 2026 14:09:57 -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=E/B4OGTUik0qpSe4TEgfrHllOvR0TgzZpKxl3Uotu7Q=; b=VxmeU3vtNiFQICwmBEzc+55i9grq6nwezNswWlkfwUywfBKLl/skHzCNmmaitbGmXl7MNylx/GJsOGguaE3szLIgUx/3UlyvY1bb+E+HQFusdueDVq6SoLA7jRK6RXX13KG0JIBclhzpP/UY3ZEA9Y7Ae6D1sFBPOuKvl17nEEe0Nb3KzcPHwKeWRNP9NXBH8VVi+RJKyFBrIwqYhJN1OIteS+buZwP/FaEfOR764vF9m8d0jCvj65zczKKfd4F1kfYYSf16Nw3mafLww2Gr8+LALpPw2GW/Dw5P3MG3LvvJaLuJCDktNZ39K8CHfxdg0m80hAHTu0I+niZIUEFHYg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cPPNLwU25epAzkQlrV1gaNgLnpQ3G6R2xgC1KKWAluI/86av5Otw34UDpfdRpbGaLk4vqzwNYOJsqefRj/dDerOMrgjbGAk01sirHIbuVNOtriUjKwILPOcTBp34mCcXrRa+DhmX7KT4qxI4MniB3BacATbm3LUn4pUi4TDTFCeW0kjB0yvGLsn+xBoXd50ZctCcLhAhu+jBFChGoXWPxuFSp37QNUFtUaVEcJJXG4CkVHRqPMlAMhKHpDcvjTAF0u4Ux4VSkCemDc3HPihzlok/8w0i9VSUa7EsUsZPxdHCUIvlfWL0zUoAcPuRuD2At9FwkTdMrI2SoeHe70nH2A==
  • 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@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxxx
  • Delivery-date: Tue, 11 Aug 2026 21:12:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

Currently there's no way to print Xen command line on the emergency
console for debugging purposes when 'xl' is not unavailable.

Add new keyhander 'X' to do command line printout.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
Changes since v3:
- print built-in command line too
- change handler to print command line only

Changes since v2:
- account for CONFIG_CMDLINE_OVERRIDE case

v3: https://lore.kernel.org/xen-devel/20260810230359.671587-3-dmukhin@xxxxxxxx/
CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/2751523722
---
 xen/common/kernel.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d1bef9ac2b2b..8a43e4421002 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -5,6 +5,7 @@
  */
 
 #include <xen/init.h>
+#include <xen/keyhandler.h>
 #include <xen/lib.h>
 #include <xen/errno.h>
 #include <xen/param.h>
@@ -505,6 +506,37 @@ static int __init cf_check param_init(void)
 __initcall(param_init);
 #endif
 
+static void cf_check show_cmdline(unsigned char key)
+{
+    const char *builtin_cmdline = CONFIG_CMDLINE;
+    const char *cmdline;
+
+    printk("'%c' pressed -> showing hypervisor command line\n", key);
+
+    if ( builtin_cmdline[0] )
+        cmdline = builtin_cmdline;
+    else
+        cmdline = "<NULL>";
+
+    printk("Built-in command line: %s\n", cmdline);
+
+    if ( IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) )
+        cmdline = "<NULL> (CONFIG_CMDLINE_OVERRIDE=y)";
+    else
+        cmdline = saved_cmdline;
+
+    printk("Command line: %s\n", cmdline);
+}
+
+static int __init cf_check misc_init(void)
+{
+    register_keyhandler('X', show_cmdline,
+                        "show hypervisor command line", 0);
+
+    return 0;
+}
+__initcall(misc_init);
+
 static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     struct xen_varbuf user_str;
-- 
2.54.0




 


Rackspace

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