All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Julien Grall" <julien.grall@arm.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] xen/boot: Print the build-id along with the changeset information
Date: Fri, 17 May 2019 20:17:18 +0100	[thread overview]
Message-ID: <1558120638-3610-1-git-send-email-andrew.cooper3@citrix.com> (raw)
Message-ID: <20190517191718.oQws9XGBDyw6mGaQFLoDZWR9AS2uRWv68M5ek9L8L5U@z> (raw)

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>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 xen/common/version.c       | 9 +++------
 xen/drivers/char/console.c | 3 +++
 xen/include/xen/version.h  | 3 +++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/common/version.c b/xen/common/version.c
index 223cb52..937eb12 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -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:
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 9bbcb0f..38ecd9c 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -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);
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 97c247a..9ac926d 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -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__ */
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             reply	other threads:[~2019-05-17 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 19:17 Andrew Cooper [this message]
2019-05-17 19:17 ` [Xen-devel] [PATCH] xen/boot: Print the build-id along with the changeset information Andrew Cooper
2019-05-20  8:12 ` Jan Beulich
2019-05-20  8:12   ` [Xen-devel] " Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558120638-3610-1-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.