All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] keyhandler to show Xen command line
@ 2026-08-03  7:00 dmukhin
  2026-08-03  7:00 ` [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init dmukhin
  2026-08-03  7:00 ` [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line dmukhin
  0 siblings, 2 replies; 8+ messages in thread
From: dmukhin @ 2026-08-03  7:00 UTC (permalink / raw)
  To: xen-devel
  Cc: andrew.cooper3, anthony.perard, jbeulich, julien, michal.orzel,
	roger, sstabellini, dmukhin

Tiny series which adds new 'X' keyhandler to show Xen command
line to help debugging the system.

CI: https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/2723312941

Denis Mukhin (2):
  xen/common: annotate saved_cmdline with __ro_after_init
  xen/common: add keyhandler to show Xen command line

 xen/common/kernel.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

-- 
2.54.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init
  2026-08-03  7:00 [PATCH v2 0/2] keyhandler to show Xen command line dmukhin
@ 2026-08-03  7:00 ` dmukhin
  2026-08-03  7:03   ` Jan Beulich
  2026-08-03  7:00 ` [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line dmukhin
  1 sibling, 1 reply; 8+ messages in thread
From: dmukhin @ 2026-08-03  7:00 UTC (permalink / raw)
  To: xen-devel
  Cc: andrew.cooper3, anthony.perard, jbeulich, julien, michal.orzel,
	roger, sstabellini, dmukhin

From: Denis Mukhin <dmukhin@ford.com> 

The hypervisor command line is not modified after initialization.
Annotate saved_cmdline with __ro_after_init to place it in the
dedicated read-only-after-init section.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
Changes since v1:
- new patch
---
 xen/common/kernel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index fb45f8139995..d1bef9ac2b2b 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -34,7 +34,7 @@ bool __ro_after_init opt_dit = IS_ENABLED(CONFIG_DIT_DEFAULT);
 boolean_param("dit", opt_dit);
 #endif
 
-static xen_commandline_t saved_cmdline;
+static xen_commandline_t __ro_after_init saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
 char __ro_after_init xen_cap_info[128];
 
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line
  2026-08-03  7:00 [PATCH v2 0/2] keyhandler to show Xen command line dmukhin
  2026-08-03  7:00 ` [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init dmukhin
@ 2026-08-03  7:00 ` dmukhin
  2026-08-08  0:44   ` Stefano Stabellini
  1 sibling, 1 reply; 8+ messages in thread
From: dmukhin @ 2026-08-03  7:00 UTC (permalink / raw)
  To: xen-devel
  Cc: andrew.cooper3, anthony.perard, jbeulich, julien, michal.orzel,
	roger, sstabellini, dmukhin

From: Denis Mukhin <dmukhin@ford.com> 

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@ford.com>
---
v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@ford.com/

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);
+}
+
+static int __init cf_check misc_init(void)
+{
+    register_keyhandler('X', show_hypervisor_info,
+                        "show hypervisor information", 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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init
  2026-08-03  7:00 ` [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init dmukhin
@ 2026-08-03  7:03   ` Jan Beulich
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2026-08-03  7:03 UTC (permalink / raw)
  To: dmukhin
  Cc: andrew.cooper3, anthony.perard, julien, michal.orzel, roger,
	sstabellini, xen-devel

On 03.08.2026 09:00, dmukhin@ford.com wrote:
> From: Denis Mukhin <dmukhin@ford.com> 
> 
> The hypervisor command line is not modified after initialization.
> Annotate saved_cmdline with __ro_after_init to place it in the
> dedicated read-only-after-init section.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Denis Mukhin <dmukhin@ford.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line
  2026-08-03  7:00 ` [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line dmukhin
@ 2026-08-08  0:44   ` Stefano Stabellini
  2026-08-08  2:38     ` dmukhin
  0 siblings, 1 reply; 8+ messages in thread
From: Stefano Stabellini @ 2026-08-08  0:44 UTC (permalink / raw)
  To: dmukhin
  Cc: xen-devel, andrew.cooper3, anthony.perard, jbeulich, julien,
	michal.orzel, roger, sstabellini

On Mon, 3 Aug 2026, dmukhin@ford.com wrote:
> From: Denis Mukhin <dmukhin@ford.com> 
> 
> 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@ford.com>
> ---
> v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@ford.com/
> 
> 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

Other than that it is fine for me



> +}
> +
> +static int __init cf_check misc_init(void)
> +{
> +    register_keyhandler('X', show_hypervisor_info,
> +                        "show hypervisor information", 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
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line
  2026-08-08  0:44   ` Stefano Stabellini
@ 2026-08-08  2:38     ` dmukhin
  2026-08-10 11:50       ` Oleksii Kurochko
  2026-08-10 13:28       ` Roger Pau Monné
  0 siblings, 2 replies; 8+ messages in thread
From: dmukhin @ 2026-08-08  2:38 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: dmukhin, xen-devel, andrew.cooper3, anthony.perard, jbeulich,
	julien, michal.orzel, roger

On Fri, Aug 07, 2026 at 05:44:41PM -0700, Stefano Stabellini wrote:
> On Mon, 3 Aug 2026, dmukhin@ford.com wrote:
> > From: Denis Mukhin <dmukhin@ford.com> 
> > 
> > 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@ford.com>
> > ---
> > v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@ford.com/
> > 
> > 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?

> 
> Other than that it is fine for me
> 
> 
> 
> > +}
> > +
> > +static int __init cf_check misc_init(void)
> > +{
> > +    register_keyhandler('X', show_hypervisor_info,
> > +                        "show hypervisor information", 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
> > 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line
  2026-08-08  2:38     ` dmukhin
@ 2026-08-10 11:50       ` Oleksii Kurochko
  2026-08-10 13:28       ` Roger Pau Monné
  1 sibling, 0 replies; 8+ messages in thread
From: Oleksii Kurochko @ 2026-08-10 11:50 UTC (permalink / raw)
  To: dmukhin
  Cc: xen-devel, andrew.cooper3, anthony.perard, jbeulich, julien,
	michal.orzel, roger, Stefano Stabellini



On 8/8/26 4:38 AM, dmukhin@ford.com wrote:
> On Fri, Aug 07, 2026 at 05:44:41PM -0700, Stefano Stabellini wrote:
>> On Mon, 3 Aug 2026, dmukhin@ford.com wrote:
>>> From: Denis Mukhin <dmukhin@ford.com>
>>>
>>> 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@ford.com>
>>> ---
>>> v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@ford.com/
>>>
>>> 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line
  2026-08-08  2:38     ` dmukhin
  2026-08-10 11:50       ` Oleksii Kurochko
@ 2026-08-10 13:28       ` Roger Pau Monné
  1 sibling, 0 replies; 8+ messages in thread
From: Roger Pau Monné @ 2026-08-10 13:28 UTC (permalink / raw)
  To: dmukhin
  Cc: Stefano Stabellini, xen-devel, andrew.cooper3, anthony.perard,
	jbeulich, julien, michal.orzel

On Fri, Aug 07, 2026 at 07:38:28PM -0700, dmukhin@ford.com wrote:
> On Fri, Aug 07, 2026 at 05:44:41PM -0700, Stefano Stabellini wrote:
> > On Mon, 3 Aug 2026, dmukhin@ford.com wrote:
> > > From: Denis Mukhin <dmukhin@ford.com> 
> > > 
> > > 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@ford.com>
> > > ---
> > > v1: https://lore.kernel.org/xen-devel/20260730061459.2702672-2-dmukhin@ford.com/
> > > 
> > > 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

Aside from the remark from Oleksii, can you use IS_ENABLED() here
instead of preprocessor conditionals?

Thanks, Roger.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-10 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  7:00 [PATCH v2 0/2] keyhandler to show Xen command line dmukhin
2026-08-03  7:00 ` [PATCH v2 1/2] xen/common: annotate saved_cmdline with __ro_after_init dmukhin
2026-08-03  7:03   ` Jan Beulich
2026-08-03  7:00 ` [PATCH v2 2/2] xen/common: add keyhandler to show Xen command line dmukhin
2026-08-08  0:44   ` Stefano Stabellini
2026-08-08  2:38     ` dmukhin
2026-08-10 11:50       ` Oleksii Kurochko
2026-08-10 13:28       ` Roger Pau Monné

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.