xen/boot: Print the build-id along with the changeset information
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Apr 2019 14:26:31 +0000 (14:26 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 21 May 2019 09:41:47 +0000 (10:41 +0100)
During initcalls is ok, but is a rather random place to find the build-id:

  (XEN) Parked 2 CPUs
  (XEN) build-id: 7ff05f78ebc8141000b9feee4370a408bd935dec
  (XEN) Running stub recovery selftests...

Logically, it is version information, so print with the changeset information
in console_init_preirq():

  (XEN) Xen version 4.13-unstable (andrewcoop@andrecoop) (gcc (Debian 4.9.2-10+deb8u2) 4.9.2) debug=y  Fri Apr 12 18:24:52 BST 2019
  (XEN) Latest ChangeSet: Fri Apr 5 14:39:42 2019 git:fc6c7ae-dirty
  (XEN) build-id: 7ff05f78ebc8141000b9feee4370a408bd935dec
  (XEN) PVH start info: (pa 0000ffc0)

Nothing has ever cared about xen_build_init()'s return value, so convert it to
void rather than include errno.h into the !BUILD_ID case of version.h

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/version.c
xen/drivers/char/console.c
xen/include/xen/version.h

index 223cb52e69013ee69f2ab0293ff77745e7affbe0..937eb1281c70af2e78e91721f4b11e2b91fdea13 100644 (file)
@@ -140,7 +140,7 @@ struct cv_info_pdb70
     char pdb_filename[];
 };
 
-static int __init xen_build_init(void)
+void __init xen_build_init(void)
 {
     const Elf_Note *n = __note_gnu_build_id_start;
     unsigned int sz;
@@ -148,11 +148,11 @@ static int __init xen_build_init(void)
 
     /* --build-id invoked with wrong parameters. */
     if ( __note_gnu_build_id_end <= &n[0] )
-        return -ENODATA;
+        return;
 
     /* Check for full Note header. */
     if ( &n[1] >= __note_gnu_build_id_end )
-        return -ENODATA;
+        return;
 
     sz = (void *)__note_gnu_build_id_end - (void *)n;
 
@@ -188,10 +188,7 @@ static int __init xen_build_init(void)
 #endif
     if ( !rc )
         printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
-
-    return rc;
 }
-__initcall(xen_build_init);
 #endif
 /*
  * Local variables:
index 9bbcb0f57a843d41823962b3e098d6d573b17afc..38ecd9c015b0a5a50dd5a609a11cac5fe161deaa 100644 (file)
@@ -934,6 +934,9 @@ void __init console_init_preirq(void)
            xen_compiler(), debug_build() ? 'y' : 'n', xen_compile_date());
     printk("Latest ChangeSet: %s\n", xen_changeset());
 
+    /* Locate and print the buildid, if applicable. */
+    xen_build_init();
+
     if ( opt_sync_console )
     {
         serial_start_sync(sercon_handle);
index 97c247a5ebe72823242fcf47427501ead901a3dc..9ac926d0e1eddd7ecc437d4f2e63e456ba1cd3f7 100644 (file)
@@ -19,8 +19,11 @@ const char *xen_deny(void);
 int xen_build_id(const void **p, unsigned int *len);
 
 #ifdef BUILD_ID
+void xen_build_init(void);
 int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
                        const void **p, unsigned int *len);
+#else
+static inline void xen_build_init(void) {};
 #endif
 
 #endif /* __XEN_VERSION_H__ */