From patchwork Fri Sep 16 16:38:24 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: 9336191 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 31D3B60839 for ; Fri, 16 Sep 2016 16:41:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2314F2A039 for ; Fri, 16 Sep 2016 16:41:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17DF72A03C; Fri, 16 Sep 2016 16:41:34 +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 A08002A039 for ; Fri, 16 Sep 2016 16:41:33 +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 1bkwAA-0002jz-3n; Fri, 16 Sep 2016 16:38:54 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkwA8-0002hy-Dy for xen-devel@lists.xenproject.org; Fri, 16 Sep 2016 16:38:52 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id D5/78-01343-B102CD75; Fri, 16 Sep 2016 16:38:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeJIrShJLcpLzFFi42KZM10+UFda4U6 4we7H/Bbft0xmcmD0OPzhCksAYxRrZl5SfkUCa0bH6SmMBctkKuafesfewPhHqIuRi0NIoI1J Ytbj/cwQzjdGiZavK1kgnI2MEpunv2eHcLoZJdp2rgfKcAI5RRLnvv5n62Lk4GATMJF4s8oRp EZEoI9R4vbRv4wgNcwgzr7TzCC2sICjxLMjl9lBbBYBVYn+/9/B5vAKuEtMeDwLrF5CQE5i25 Y9jCAzOYHiPecyIVa5SSxZv5YJosRQ4vTDbYwTGPkXMDKsYtQoTi0qSy3SNTTWSyrKTM8oyU3 MzNE1NDDVy00tLk5MT81JTCrWS87P3cQIDCEGINjB+G+b5yFGSQ4mJVHe4sLb4UJ8SfkplRmJ xRnxRaU5qcWHGGU4OJQkeL/K3QkXEixKTU+tSMvMAQYzTFqCg0dJhHcxSJq3uCAxtzgzHSJ1i lFRSpz3CUhCACSRUZoH1waLoEuMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5n0MMoUnM68Ebv oroMVMQItXz7oNsrgkESEl1cBY+zJoovbTs4xOCffmaGn6BVY1iURurd363/VlnqSZdNJD5ph JCYH36mvefiq4zzhZdPWr7cZcm9gCJwXXNVip9PZqz5v8wWRKoPgWCwHNv9Y+2r+NChQUGPTe u305v+dYx6r62am3rl95s/rYBDfJ+poXltHKObtqeT3KM3i2/n3LHBZ7vl2JpTgj0VCLuag4E QBWNq7OmwIAAA== X-Env-Sender: konrad@char.us.oracle.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1474043929!44375698!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 24187 invoked from network); 16 Sep 2016 16:38:50 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Sep 2016 16:38:50 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8GGcZh3030442 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Sep 2016 16:38:36 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8GGcZd5019758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Sep 2016 16:38:35 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8GGcZsk005058; Fri, 16 Sep 2016 16:38:35 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 16 Sep 2016 09:38:34 -0700 Received: by char.us.oracle.com (Postfix, from userid 1000) id 7BBF16A0E19; Fri, 16 Sep 2016 12:38:33 -0400 (EDT) From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, konrad@kernel.org, ross.lagerwall@citrix.com, julien.grall@arm.com, sstabellini@kernel.org Date: Fri, 16 Sep 2016 12:38:24 -0400 Message-Id: <1474043908-12101-13-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1474043908-12101-1-git-send-email-konrad.wilk@oracle.com> References: <1474043908-12101-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Andrew Cooper , Jan Beulich , Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v4 12/16] bug/x86/arm: Align bug_frames sections. 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Most of the WARN_ON or BUG_ON sections are properly aligned on x86. However on ARM and on x86 assembler the macros don't include any aligment information - hence they end up being the default byte granularity. On ARM32 it is paramount that the aligment is word-size (4) otherwise if one tries to use (uint32_t*) access (such as livepatch ELF relocations) we get a Data Abort. Enforcing bug_frames to have the proper aligment across all architectures and in both C and x86 makes them all the same. Furthermore on x86 the bloat-o-meter detects that with this change: add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0) function old new delta On ARM32: add/remove: 1/0 grow/shrink: 0/1 up/down: 384/-288 (96) function old new delta gnttab_unpopulate_status_frames - 384 +384 do_grant_table_op 10808 10520 -288 And ARM64: add/remove: 1/2 grow/shrink: 0/1 up/down: 4164/-4236 (-72) function old new delta gnttab_map_grant_ref - 4164 +4164 do_grant_table_op 9892 9836 -56 grant_map_exists 300 - -300 __gnttab_map_grant_ref 3880 - -3880 Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Jan Beulich Reviewed-by: Julien Grall --- Cc: Julien Grall Cc: Stefano Stabellini Cc: Jan Beulich Cc: Andrew Cooper v3: First submission. Replaces the "livepatch/elf: Adjust section aligment to word" patch. v4: Remove the .ALIGN(4) in xen.lds.S for x86 (the only place needing that change). Update the commit description with correct x86 results Remove the . = ALIGN(4); in linker filer on x86 [the only file needing the change] --- xen/arch/x86/xen.lds.S | 1 - xen/include/asm-arm/bug.h | 1 + xen/include/asm-x86/bug.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index d903c31..7676de9 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -79,7 +79,6 @@ SECTIONS .rodata : { _srodata = .; /* Bug frames table */ - . = ALIGN(4); __start_bug_frames = .; *(.bug_frames.0) __stop_bug_frames_0 = .; diff --git a/xen/include/asm-arm/bug.h b/xen/include/asm-arm/bug.h index 68353e1..773d63e 100644 --- a/xen/include/asm-arm/bug.h +++ b/xen/include/asm-arm/bug.h @@ -52,6 +52,7 @@ struct bug_frame { ".popsection\n" \ ".pushsection .bug_frames." __stringify(type) ", \"a\", %progbits\n"\ "4:\n" \ + ".align 4\n" \ ".long (1b - 4b)\n" \ ".long (2b - 4b)\n" \ ".long (3b - 4b)\n" \ diff --git a/xen/include/asm-x86/bug.h b/xen/include/asm-x86/bug.h index c5d2d4c..9bb4a19 100644 --- a/xen/include/asm-x86/bug.h +++ b/xen/include/asm-x86/bug.h @@ -98,6 +98,7 @@ extern const struct bug_frame __start_bug_frames[], .popsection .pushsection .bug_frames.\type, "a", @progbits + .p2align 2 .L\@bf: .long (.L\@ud - .L\@bf) + \ ((\line >> BUG_LINE_LO_WIDTH) << BUG_DISP_WIDTH)