xen/console: print Xen version via keyhandler
PATCH v5 1/1 xen/console: print Xen version via keyhandler
Add Xen version printout to 'h' keyhandler output.
That is useful for debugging systems that have been left intact for a long time.
---
Changes since v4:
- switched to checking build_id_len instead of build_id_p in print_build_id()
--- xen/common/keyhandler.c | 4 ++++ xen/common/version.c | 23 +++++++++++++++++++++-- xen/drivers/char/console.c | 8 +++----- xen/include/xen/lib.h | 3 +++ 4 files changed, 31 insertions(+), 7 deletions(-)
xen/common/keyhandler.c +4 -0
@@ -129,6 +129,10 @@ static void cf_check show_handlers(unsigned char key)unsigned int i;printk ("'%c' pressed -> showing installed handlers\n" , key); + +print_version (); +print_build_id (); +for ( i =0 ; i <ARRAY_SIZE (key_table); i++ )if ( key_table[i].fn ) printk(" key '%c' (ascii '%02x') => %s\n",
xen/common/version.c +21 -2
@@ -210,9 +210,28 @@ void __init xen_build_init(void) } }#endif /* CONFIG_X86 */ -if ( !rc ) -printk (XENLOG_INFO "build-id: %*phN\n" , build_id_len, build_id_p); } + +void print_version (void ) +{ +printk ("Xen version %d.%d%s (%s@%s) (%s) %s %s\n" , +xen_major_version (),xen_minor_version (),xen_extra_version (), +xen_compile_by (),xen_compile_domain (),xen_compiler (), +xen_build_info (),xen_compile_date ()); + +printk ("Latest ChangeSet: %s\n" ,xen_changeset ()); +} + +void print_build_id (void ) +{ +/* +* NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n. +* Do not print empty build-id. +*/ +if ( build_id_len ) +printk ("build-id: %*phN\n" , build_id_len, build_id_p); +} +#endif /* BUILD_ID */ /* * Local variables:
xen/drivers/char/console.c +3 -5
@@ -1020,14 +1020,12 @@ void __init console_init_preirq(void)nrspin_lock (&console_lock);__putstr (xen_banner ());nrspin_unlock (&console_lock); -printk ("Xen version %d.%d%s (%s@%s) (%s) %s %s\n" , -xen_major_version (),xen_minor_version (),xen_extra_version (), -xen_compile_by (),xen_compile_domain (),xen_compiler (), -xen_build_info (),xen_compile_date ()); -printk ("Latest ChangeSet: %s\n" ,xen_changeset ()); + +print_version ();/* Locate and print the buildid, if applicable. */ xen_build_init (); +print_build_id ();if ( opt_sync_console ) {
xen/include/xen/lib.h +3 -0
@@ -47,6 +47,9 @@ 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_build_id (void ); +#ifdef CONFIG_DEBUG_TRACE extern void debugtrace_dump (void );extern void debugtrace_printk (const char *fmt, ...)
Signature · 1 line
2.34.1
Quoted 7 lines · On 17.02.2025 22:33, [email protected] wrote:
Add Xen version printout to 'h' keyhandler output.
That is useful for debugging systems that have been left intact for a long time.
Signed-off-by Denis Mukhin <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Hmm, wait - there's yet another issue:
xen/common/keyhandler.c static void cf_check show_handlers(unsigned char key) · line 134
Quoted 9 lines
xen/common/keyhandler.c +3
-0@@ -129,6 +129,10 @@ static void cf_check show_handlers(unsigned char key)unsigned int i;printk ("'%c' pressed -> showing installed handlers\n" , key); + +print_version (); +print_build_id ();
Here and in console_init_preirq() you expect to be able to call the two functions, no matter what the tool chain. Then ...
Quoted 21 lines
xen/common/version.c +12
-2@@ -210,9 +210,28 @@ void __init xen_build_init(void) } }#endif /* CONFIG_X86 */ -if ( !rc ) -printk (XENLOG_INFO "build-id: %*phN\n" , build_id_len, build_id_p); } + +void print_version (void ) +{ +printk ("Xen version %d.%d%s (%s@%s) (%s) %s %s\n" , +xen_major_version (),xen_minor_version (),xen_extra_version (), +xen_compile_by (),xen_compile_domain (),xen_compiler (), +xen_build_info (),xen_compile_date ()); + +printk ("Latest ChangeSet: %s\n" ,xen_changeset ()); +} + +void print_build_id (void )
xen/common/version.c void __init xen_build_init(void) · line 235
Quoted 10 lines
xen/common/version.c +9
-0+{ +/* +* NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n. +* Do not print empty build-id. +*/ +if ( build_id_len ) +printk ("build-id: %*phN\n" , build_id_len, build_id_p); +} +#endif /* BUILD_ID */
... their definitions cannot be inside an #ifdef. They want to move up:
- print_build_id() between xen_build_id() and the #ifdef BUILD_ID,
- print_version() yet higher up, perhaps after xen_build_info(). I guess I can do so while committing.
Jan
Quoted 58 lines · Jan Beulich
Quoted 7 lines · On 17.02.2025 22:33, [email protected] wrote:
Add Xen version printout to 'h' keyhandler output.
That is useful for debugging systems that have been left intact for a long time.
Signed-off-by Denis Mukhin [email protected]Reviewed-by Jan Beulich [email protected]Hmm, wait - there's yet another issue:
xen/common/keyhandler.c static void cf_check show_handlers(unsigned char key) · line 134
Quoted 9 lines
xen/common/keyhandler.c +3
-0@@ -129,6 +129,10 @@ static void cf_check show_handlers(unsigned char key)unsigned int i;printk ("'%c' pressed -> showing installed handlers\n" , key); + +print_version (); +print_build_id ();Here and in
console_init_preirq()you expect to be able to call the two functions, no matter what the tool chain. Then ...Quoted 29 lines
xen/common/version.c +20
-2@@ -210,9 +210,28 @@ void __init xen_build_init(void)} } #endif /* CONFIG_X86 */ -if ( !rc ) -printk (XENLOG_INFO "build-id: %phN\n" , build_id_len, build_id_p); } + +void print_version (void ) +{ +printk ("Xen version %d.%d%s (%s@%s) (%s) %s %s\n" , +xen_major_version (),xen_minor_version (),xen_extra_version (), +xen_compile_by (),xen_compile_domain (),xen_compiler (), +xen_build_info (),xen_compile_date ()); + +printk ("Latest ChangeSet: %s\n" ,xen_changeset ()); +} + +void print_build_id (void ) +{ + / + * NB: build_id_len may be 0 if XEN_HAS_BUILD_ID=n. + * Do not print empty build-id. + */ + if ( build_id_len ) +printk ("build-id: %phN\n" , build_id_len, build_id_p); +}
Quoted 8 lines
xen/common/version.c void __init xen_build_init(void) · line 235
Quoted 2 lines
xen/common/version.c +1
-0+#endif / BUILD_ID */ ... their definitions cannot be inside an #ifdef. They want to move up:
-print_build_id()betweenxen_build_id()and the #ifdefBUILD_ID,
-print_version()yet higher up, perhaps afterxen_build_info(). I guess I can do so while committing.
Oh, that's right.
Thanks!
Sent v6 with the fix.
Quoted 2 lines
Jan