xen/console: print Xen version via keyhandler
PATCH v2 1/1 xen/console: print Xen version via keyhandler
From: Denis Mukhin <[email protected]>
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 v1:
- Moved version printout to 'h' keyhandler
- Kept the build-id reporting past Xen version printout during console initialization
--- xen/common/keyhandler.c | 5 +++++ xen/common/version.c | 20 ++++++++++++++++++-- xen/drivers/char/console.c | 8 +++----- xen/include/xen/version.h | 3 +++ 4 files changed, 29 insertions(+), 7 deletions(-)
xen/common/keyhandler.c +5 -0
@@ -22,6 +22,7 @@#include <xen/mm.h> #include <xen/watchdog.h> #include <xen/init.h> +#include <xen/version.h> #include <asm/div64.h> static unsigned char keypress_key;
@@ -129,6 +130,10 @@ static void cf_check show_handlers(unsigned char key)unsigned int i;printk ("'%c' pressed -> showing installed handlers\n" , key); + +xen_print_version (); +xen_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 +18 -2
@@ -210,9 +210,25 @@ 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 xen_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 xen_print_build_id (void ) +{ +BUG_ON (!build_id_p); +BUG_ON (!build_id_len); +printk (XENLOG_INFO "build-id: %*phN\n" , build_id_len, build_id_p); +} +#endif /* BUILD_ID */ /* * Local variables:
xen/drivers/char/console.c +3 -5
@@ -1024,14 +1024,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 ()); + +xen_print_version ();/* Locate and print the buildid, if applicable. */ xen_build_init (); +xen_print_build_id ();if ( opt_sync_console ) {
xen/include/xen/version.h +3 -0
@@ -29,4 +29,7 @@ int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,static inline void xen_build_init (void ) {};#endif +void xen_print_version (void ); +void xen_print_build_id (void ); +#endif /* __XEN_VERSION_H__ */
Signature · 1 line
2.34.1
xen/include/xen/version.h int xen_build_id_check(const Elf_Note *n, unsigned int n_sz, · line 33
Quoted 8 lines · On 13.02.2025 09:28, [email protected] wrote:
xen/include/xen/version.h +2
-0@@ -29,4 +29,7 @@ int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,static inline void xen_build_init (void ) {};#endif +void xen_print_version (void ); +void xen_print_build_id (void );
Hmm, I'm sorry, as I should have thought of this earlier already: What exactly is the significance of the xen_ prefixes here? We're in Xen sources after all.
Jan
Quoted 10 lines · Jan Beulich
Quoted 6 lines · On 13.02.2025 09:28, [email protected] wrote:
xen/include/xen/version.h +0
-0@@ -29,4 +29,7 @@ int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,static inline void xen_build_init (void ) {};#endif
Quoted 6 lines
xen/include/xen/version.h int xen_build_id_check(const Elf_Note *n, unsigned int n_sz, · line 33
Quoted 2 lines
xen/include/xen/version.h +2
-0+void xen_print_version (void ); +void xen_print_build_id (void );Hmm, I'm sorry, as I should have thought of this earlier already: What exactly is the significance of the
xen_prefixes here? We're in Xen sources after all.
I followed the rest of the code in version.{h,c} which has xen_ prefixes.
I moved new definitions w/o prefix to xen/include/xen/lib.h where most of the debug tracing facilities are declared in v3.
Quoted 2 lines
Jan
Thanks,
Denis