]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/console: print Xen version via keyhandler
authorDenis Mukhin <dmukhin@ford.com>
Wed, 26 Feb 2025 11:17:01 +0000 (12:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2025 11:17:01 +0000 (12:17 +0100)
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 <dmukhin@ford.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/keyhandler.c
xen/common/version.c
xen/drivers/char/console.c
xen/include/xen/lib.h

index 6ea54838d434f9788e309c79119f1dab92fba6e3..0bb842ec001775668e9acadafa9549fd52fcf034 100644 (file)
@@ -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",
index bc3714b45fd2557af226b0c0a06e1450250a8ed3..5474b8e385be31ce44260a6eb768ca5c72df6552 100644 (file)
@@ -94,6 +94,16 @@ const char *xen_build_info(void)
     return build_info;
 }
 
+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());
+}
+
 static const void *build_id_p __read_mostly;
 static unsigned int build_id_len __read_mostly;
 
@@ -108,6 +118,16 @@ int xen_build_id(const void **p, unsigned int *len)
     return 0;
 }
 
+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);
+}
+
 #ifdef BUILD_ID
 /* Defined in linker script. */
 extern const Elf_Note __note_gnu_build_id_start[], __note_gnu_build_id_end[];
@@ -210,8 +230,6 @@ void __init xen_build_init(void)
         }
     }
 #endif /* CONFIG_X86 */
-    if ( !rc )
-        printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 }
 #endif /* BUILD_ID */
 /*
index b6a8c71928fa0f120f3082e75d18387fc1643550..eb09b6d5fd0ed670ae5723ac220847971bf534ed 100644 (file)
@@ -1037,14 +1037,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 )
     {
index 130f96791f75e0aa805e04ce0c57fd71e4dd8b38..77122606eddf33caad0db725dcb9f8e56ba01c74 100644 (file)
@@ -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, ...)