From patchwork Tue Sep 6 16:57:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9317607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83C6A601C0 for ; Tue, 6 Sep 2016 17:01:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C63528E16 for ; Tue, 6 Sep 2016 17:01:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7123128E23; Tue, 6 Sep 2016 17:01:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4322328E16 for ; Tue, 6 Sep 2016 17:01:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhJh7-0004I5-O8; Tue, 06 Sep 2016 16:57:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhJh6-0004Hv-K5 for xen-devel@lists.xenproject.org; Tue, 06 Sep 2016 16:57:56 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 02/87-16745-395FEC75; Tue, 06 Sep 2016 16:57:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRWlGSWpSXmKPExsUyZ7p8oO7kr+f CDdYd4bP4vmUykwOjx+EPV1gCGKNYM/OS8isSWDO6Vl5gLZggW7F/3XzWBsbpEl2MXBxCApOY JO4c+MncxcgJ5HxmlDj1tAjCXs8osfu+PERRN6PEhrM/2SASRRKt93ezg9gsAioSdw9cYuxi5 OBgEzCReLPKESQsIqAs0fvrNwtIL7NAM6PEzcONjCAJYQE7icNX1oL18gqYSTze9xFq8TZGif ezXSHighInZz5hAbGZBbQkbvx7yQQyn1lAWmL5Pw6QMKeAvcTHJf+ZQGxRoF2L+3vATpMQMJZ of3uRbQKj0Cwkk2YhmTQLYdICRuZVjBrFqUVlqUW6RuZ6SUWZ6RkluYmZObqGBqZ6uanFxYnp qTmJScV6yfm5mxiBwVzPwMC4g/HqFr9DjJIcTEqivGqB58KF+JLyUyozEosz4otKc1KLDzHKc HAoSfCe/gKUEyxKTU+tSMvMAcYVTFqCg0dJhPc2SJq3uCAxtzgzHSJ1ilFRSpx3AkhCACSRUZ oH1waL5UuMslLCvIwMDAxCPAWpRbmZJajyrxjFORiVhHmfgEzhycwrgZv+CmgxE9DidbtPgyw uSURISTUwZqRKXXku9a/0zkmXuWFHWGsfpR0zExPcr70lpWS9zYxJk4qPXn0WctAlZv7F7T6H S95tCS5dHPBNoV3x/M9qkQqhli/mnZHTPGfePJxSabvAd6s676MzinZhz5OP2bMcjTZoeiP1O /v28kecqaqFruwMEWfe7DrxxVH94OdOZSGNyxvb5uVtUWIpzkg01GIuKk4EAKXy0LjgAgAA X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1473181073!42218874!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44744 invoked from network); 6 Sep 2016 16:57:54 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-16.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 6 Sep 2016 16:57:54 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u86GvmPQ028956 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Sep 2016 16:57:48 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u86Gvl02027324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Sep 2016 16:57:47 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u86GvfWN014103; Tue, 6 Sep 2016 16:57:47 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Sep 2016 09:57:41 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id 96BE26A0DC6; Tue, 6 Sep 2016 12:57:40 -0400 (EDT) Date: Tue, 6 Sep 2016 12:57:40 -0400 From: Konrad Rzeszutek Wilk To: Jan Beulich Message-ID: <20160906165740.GC2161@char.us.oracle.com> References: <1472005332-32207-1-git-send-email-konrad.wilk@oracle.com> <1472005332-32207-5-git-send-email-konrad.wilk@oracle.com> <57BD7DE8020000780010882D@prv-mh.provo.novell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <57BD7DE8020000780010882D@prv-mh.provo.novell.com> User-Agent: Mutt/1.6.2 (2016-07-01) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: Andrew Cooper , xen-devel@lists.xenproject.org, ross.lagerwall@citrix.com Subject: Re: [Xen-devel] [PATCH v4 4/9] version: Print build-id at bootup. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 24, 2016 at 02:58:48AM -0600, Jan Beulich wrote: > >>> On 24.08.16 at 04:22, wrote: > > 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 > > Reviewed-by: Jan Beulich Thank you. I had a slight change due to rebasing on "x86/EFI: use less crude a way of generating the build" which was quite simple to fix so I retained your Reviewed-by tag. The final patch looks as so: From 927c9accac9a49b586f616060e5567d7b03e3e77 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 6 Sep 2016 12:18:10 -0400 Subject: [PATCH] version: Print build-id at bootup. 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. Reviewed-by: Jan Beulich Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Ross Lagerwall --- Cc: Ross Lagerwall Cc: Andrew Cooper Cc: Jan Beulich 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 v5: Rebased on top "x86/EFI: use less crude a way of generating the build ID" Added Jan's Ack. --- xen/common/livepatch.c | 6 ------ xen/common/version.c | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 78b3731..4c3056c 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -1580,12 +1580,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 4375ea2..0d31e38 100644 --- a/xen/common/version.c +++ b/xen/common/version.c @@ -186,6 +186,8 @@ 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; }