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

Re: [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line





On 8/8/26 4:38 AM, dmukhin@xxxxxxxx wrote:
On Fri, Aug 07, 2026 at 05:44:41PM -0700, Stefano Stabellini wrote:
On Mon, 3 Aug 2026, dmukhin@xxxxxxxx wrote:
From: Denis Mukhin <dmukhin@xxxxxxxx>

Currently there's no way to print Xen command line on the emergency
console for debugging purposes (e.g. 'xl' is not available in dom0).

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

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@xxxxxxxx/

Changes since v1:
- moved implementation into kernel.c
---
  xen/common/kernel.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d1bef9ac2b2b..9f334c92e3ab 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,21 @@ static int __init cf_check param_init(void)
  __initcall(param_init);
  #endif
+static void cf_check show_hypervisor_info(unsigned char key)
+{
+    printk("'%c' pressed -> showing hypervisor information\n", key);
+    printk("Command line: %s\n", saved_cmdline);

if CONFIG_CMDLINE_OVERRIDE is defined, saved_cmdline is empty. We could
at least do this:

#ifdef CONFIG_CMDLINE_OVERRIDE
     printk("Bootloader command line ignored (CONFIG_CMDLINE_OVERRIDE=y)\n");
#else
     printk("Command line: %s\n", saved_cmdline);
#endif

Actually, CONFIG_CMDLINE can set the built-in command line which can be
non-empty.

Perhaps, something like this:

     printk("Command line (built-in): %s\n", opt_builtin_cmdline);
#ifndef CONFIG_CMDLINE_OVERRIDE
     printk("Command line: %s\n", saved_cmdline);
#endif

What do you think?

Considering that opt_builtin_cmdline is declared as __initconst won't it be an issue to print it in non-init function (show_hypervisor_info())? In other words, I expected that __init section should be freed at some point and I expect that it should be data abort here.

~ Oleksii



 


Rackspace

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