xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, konrad@kernel.org,
	ross.lagerwall@citrix.com
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v4 4/9] version: Print build-id at bootup.
Date: Tue, 23 Aug 2016 22:22:07 -0400	[thread overview]
Message-ID: <1472005332-32207-5-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1472005332-32207-1-git-send-email-konrad.wilk@oracle.com>

Livepatch expected at some point to be able to print the
build-id during bootup, which it did not.  The reason is
that xen_build_init and livepatch_init are both __initcall
type routines. This meant that when livepatch_init called
xen_build_id, it would return -ENODATA as build_id_len was
not setup yet (b/c xen_build_init would be called later).

The original patch fixed this by calling xen_build_init in
livepatch_init which allows us to print the build-id of
the hypervisor.

However the x86 maintainers pointed out that build-id
is independent of Livepatch and in fact should print
regardless whether Livepatch is enabled or not.

Therefore this patch moves the logic of printing the build-id
to version.c.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

---
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>

v2: Move xen_build_init in version.h instead of livepatch.h
v3: Posted as "livepatch: Sync cache of build-id before using it first time"
v4: Move the printing of build-id to version.c.
    Change title
---
 xen/common/livepatch.c | 6 ------
 xen/common/version.c   | 7 ++++++-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 88f1543..bd65712 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1579,12 +1579,6 @@ static void livepatch_printall(unsigned char key)
 
 static int __init livepatch_init(void)
 {
-    const void *binary_id;
-    unsigned int len;
-
-    if ( !xen_build_id(&binary_id, &len) )
-        printk(XENLOG_INFO LIVEPATCH ": build-id: %*phN\n", len, binary_id);
-
     register_keyhandler('x', livepatch_printall, "print livepatch info", 1);
 
     arch_livepatch_init();
diff --git a/xen/common/version.c b/xen/common/version.c
index b2afe96..74346b8 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -121,6 +121,7 @@ static int __init xen_build_init(void)
 {
     const Elf_Note *n = __note_gnu_build_id_start;
     unsigned int sz;
+    int rc;
 
     /* --build-id invoked with wrong parameters. */
     if ( __note_gnu_build_id_end <= &n[0] )
@@ -132,7 +133,11 @@ static int __init xen_build_init(void)
 
     sz = (void *)__note_gnu_build_id_end - (void *)n;
 
-    return xen_build_id_check(n, sz, &build_id_p, &build_id_len);
+    rc = xen_build_id_check(n, sz, &build_id_p, &build_id_len);
+    if ( !rc )
+        printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
+
+    return rc;
 }
 __initcall(xen_build_init);
 #endif
-- 
2.4.11


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

  parent reply	other threads:[~2016-08-24  2:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24  2:22 [PATCH v4] Livepatch fixes and features for v4.8 Konrad Rzeszutek Wilk
2016-08-24  2:22 ` [PATCH v4 1/9] livepatch: Clear .bss when payload is reverted Konrad Rzeszutek Wilk
2016-08-24  8:55   ` Jan Beulich
2016-08-25 16:08     ` Andrew Cooper
2016-09-06 16:51       ` Konrad Rzeszutek Wilk
2016-09-07  9:18         ` Jan Beulich
2016-09-06 16:47     ` Konrad Rzeszutek Wilk
2016-09-07  8:02       ` Jan Beulich
2016-09-08  9:25         ` Konrad Rzeszutek Wilk
2016-09-09 13:33   ` Ross Lagerwall
2016-09-09 13:50     ` Konrad Rzeszutek Wilk
2016-09-09 13:58       ` Ross Lagerwall
2016-09-09 15:28       ` Jan Beulich
2016-08-24  2:22 ` [PATCH v4 2/9] livepatch: Deal with payloads without any .text Konrad Rzeszutek Wilk
2016-08-24  2:22 ` [PATCH v4 3/9] version/livepatch: Move xen_build_id_check to version.h Konrad Rzeszutek Wilk
2016-08-24  2:22 ` Konrad Rzeszutek Wilk [this message]
2016-08-24  8:58   ` [PATCH v4 4/9] version: Print build-id at bootup Jan Beulich
2016-09-06 16:57     ` Konrad Rzeszutek Wilk
2016-09-07  8:03       ` Jan Beulich
2016-09-09 13:37       ` Ross Lagerwall
2016-08-24  2:22 ` [PATCH v4 5/9] livepatch: Move code from prepare_payload to own routine Konrad Rzeszutek Wilk
2016-08-25 16:02   ` Ross Lagerwall
2016-08-24  2:22 ` [PATCH v4 6/9] livepatch: Add parsing for the symbol+0x<offset> Konrad Rzeszutek Wilk
2016-08-24  9:08   ` Jan Beulich
2016-09-06 19:56     ` Konrad Rzeszutek Wilk
2016-09-07  8:10       ` Jan Beulich
2016-09-08  9:22         ` Konrad Rzeszutek Wilk
2016-09-08 10:01           ` Jan Beulich
2016-09-09 14:28           ` Ross Lagerwall
2016-08-24  2:22 ` [PATCH v4 7/9] livepatch: NOP if func->new_[addr] is zero Konrad Rzeszutek Wilk
2016-08-24  9:13   ` Jan Beulich
2016-09-06 20:05     ` Konrad Rzeszutek Wilk
2016-09-07  8:13       ` Jan Beulich
2016-08-24  2:22 ` [PATCH v4 8/9] symbols: Generate an xen-sym.map Konrad Rzeszutek Wilk
2016-08-24  9:16   ` Jan Beulich
2016-09-09 13:43   ` Ross Lagerwall
2016-08-24  2:22 ` [PATCH v4 9/9] livepach: Add .livepatch.hooks functions and test-case Konrad Rzeszutek Wilk
2016-09-06 17:22   ` Konrad Rzeszutek Wilk
2016-09-06 18:25     ` Andrew Cooper
2016-09-08  1:18       ` Konrad Rzeszutek Wilk

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=1472005332-32207-5-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad@kernel.org \
    --cc=ross.lagerwall@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).