From patchwork Mon Sep 11 18:59:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9948399 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 E7E5060360 for ; Tue, 12 Sep 2017 04:52:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A423C28DFA for ; Tue, 12 Sep 2017 04:52:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F2F228E0D; Tue, 12 Sep 2017 04:52:14 +0000 (UTC) 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 AC9B628DFA for ; Tue, 12 Sep 2017 04:52:13 +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 1drd7P-0004le-2L; Tue, 12 Sep 2017 04:48:15 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drTwI-0002Xf-PC for xen-devel@lists.xenproject.org; Mon, 11 Sep 2017 19:00:12 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 88/1E-01916-93DD6B95; Mon, 11 Sep 2017 19:00:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgk+JIrShJLcpLzFFi42K5GHpnva7J3W2 RBh+bTS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozJaz4yFmzu8axoWfWOqYHx0H/3LkYuDiGB WYwSX1fPZAZxWASWsUosXHiRFcSREDjEKnHu/XaWLkZOICdO4vT0L6wQdprE/7WT2SHsaonli 1YzgthCAmoS9ya/Z4QYe5BJYs6z3cwgCWEBc4kXjd1gzSwCqhKvtk5iArHZBPQlPvyfDmaLCC hLfH6+EqyeWaBeYsbsZ+wQvXkSX398BrN5Bawk3jecYIVYNo1R4s8SEYi4oMTJmU9YIHqtJF7 1/QCq5wCypSWW/+MAMTkF7CVeNeiAVIgCbZq3bxXbBEbRWUiaZyFpnoXQDBHWkrjx7yUThrCc xPZZx9kgbGOJH2u3skPYihJTuh+yY6qxkZhz/CoBNeYSV4+/ZENWs4CRbxWjenFqUVlqka6xX lJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYHpgAIIdjM1fnA4xSnIwKYnyvju+JV KILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO+329sihQSLUtNTK9Iyc4CJCiYtwcGjJMIrcQcozVt ckJhbnJkOkTrFaMxx4c6lP0wcB/bc+sMkxJKXn5cqJc5rBVIqAFKaUZoHNwiWQC8xykoJ8zIC nSbEU5BalJtZgir/ilGcg1FJmDcFZApPZl4J3L5XQKcwAZ3Cc2kLyCkliQgpqQZGqwUVSQf5V 90/afR+hmXYgQ+8859tvlupWn8/r7Wqhc1NcHKSddLma3/TrL9J5pmfT1uw7ZyO3tKCUPG3wv vNHvNw7M/S3vN80q0/5eXRruv8zzh+nHX7HtvB94dCrU30PKbvntmx/Pyjo/2M3j6yrqtWtxq 9f3Ul45LKvKUVi8oOlh46dTx5pxJLcUaioRZzUXEiANzEmwubAwAA X-Env-Sender: konrad.r.wilk@gmail.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1505156401!102572984!1 X-Originating-IP: [209.85.220.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32858 invoked from network); 11 Sep 2017 19:00:02 -0000 Received: from mail-qk0-f175.google.com (HELO mail-qk0-f175.google.com) (209.85.220.175) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 11 Sep 2017 19:00:02 -0000 Received: by mail-qk0-f175.google.com with SMTP id o129so20636397qkd.0 for ; Mon, 11 Sep 2017 12:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kxRImjHdk8T9iegno7kolQ3hafu4sMGEvvgK7QfMJJE=; b=lYa78Pvb30CDNhRk0YgdxzcJDeuC97aWalfUKhmLy9+w1+exHLZLGwWC4uRWdun8EX Hc3V+42/zajwUdXDVzUjSUo713Hu2eQ4SGxDTSOw4myyWMz1tCx5eAwjAxYa15FOSe5U 24mDG5xebq8uJ8uRXA3XISfsk8I8O2kAgwSoVb+LDk3dpOlK8z/JPw4VZVkcDULzkV+R ihKDGkkfQ6F+JQeGar7ngT9Jr5r4fipfM1XpA9AsBP3ethPH3tCyvvY9F2m8w//njkyo NOQhx89ZfhHNQIJMC4p0ONnt3MgMJtDq10fXEqWE/1iHmJ/NvJxruTQu8zkENhBOqNvI /Cfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=kxRImjHdk8T9iegno7kolQ3hafu4sMGEvvgK7QfMJJE=; b=lv4U88c03wa9KfJzTeMbjCglnzcrV+sL1wFWMQlvDBxqDhYGP/GgWuu+jUZLxd0a9A NcMi8w8u8TX3HgGuPlw4P3tgjqaoT+OlVYuYgxoGanX8G8SvcYC4t82o3rT4YWMq+DpF Wud+2XAGTiA3xvLfRgcD3uq8gxRcbWwcIfqEoKBPMqE35eRa8aN3dpO5vmBN0EWGNq4L rdIlgt+TfNbgixMzgsCGztpGRX4EudXz20TxZTomS4y5gQwuMMoiV/x4hgVaF2Xa33y7 9Ei0JhBCSGAB85asDMPmUCRqSZtV5iSj4OfU1fGJmVZkTo9jnWulqW993Rf5IQh/TOLa 5fwA== X-Gm-Message-State: AHPjjUjYy4+72Kf4sd9SIOqKr1sbmlZq1NjFLC8an0a/PZXWx+gSdLiP XmquPpYVNldBcQ== X-Google-Smtp-Source: AOwi7QBXr8XcC0gLDsGH2amenZRM79irmCh+dSKzEZ0+mwnAe7Cmd/z7s2467zJSi5kJXPk0hNUrXg== X-Received: by 10.55.51.205 with SMTP id z196mr16495936qkz.316.1505156401189; Mon, 11 Sep 2017 12:00:01 -0700 (PDT) Received: from localhost.localdomain (209-6-200-48.s4398.c3-0.smr-ubr2.sbo-smr.ma.cable.rcncustomer.com. [209.6.200.48]) by smtp.gmail.com with ESMTPSA id o38sm6792454qko.33.2017.09.11.11.59.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2017 11:59:59 -0700 (PDT) Date: Mon, 11 Sep 2017 14:59:55 -0400 From: Konrad Rzeszutek Wilk To: Jan Beulich Message-ID: <20170911185947.GA18345@localhost.localdomain> References: <20170726194756.20265-1-konrad@kernel.org> <20170726194756.20265-5-konrad@kernel.org> <597F382E0200007800103097@prv-mh.provo.novell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <597F382E0200007800103097@prv-mh.provo.novell.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Mailman-Approved-At: Tue, 12 Sep 2017 04:48:13 +0000 Cc: julien.grall@arm.com, sstabellini@kernel.org, xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com Subject: Re: [Xen-devel] [PATCH v2 4/5] alternative/x86/arm32: Align altinstructions (and altinstr_replacement) 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Jul 31, 2017 at 08:01:18AM -0600, Jan Beulich wrote: > >>> Konrad Rzeszutek Wilk 07/26/17 9:50 PM >>> > >On x86 the bloat-o-meter detects that with this change the file shrinks: > >add/remove: 1/0 grow/shrink: 0/2 up/down: 156/-367 (-211) > >function old new delta > >get_page_from_gfn - 156 +156 > >do_mmu_update 4578 4569 -9 > >do_mmuext_op 5604 5246 -358 > >Total: Before=3170439, After=3170228, chg -0.01% > > This looks unexpected, and hence I'd like to ask for an explanation. If > anything I'd expect the image size to grow (slightly). With just: [konrad@localhost xen]$ ~/linux/scripts/bloat-o-meter /tmp/xen-syms.baseline.debug xen-syms add/remove: 0/0 grow/shrink: 1/2 up/down: 87/-237 (-150) function old new delta sh_page_fault__guest_4 8557 8644 +87 map_pages_to_xen 4406 4322 -84 sh_x86_emulate_write__guest_4 444 291 -153 Total: Before=3315124, After=3314974, chg -0.00% In other words, just adding an useless comment makes it smaller!? Since this seems to be happening with arch/x86/mm.o, so I compiled the .S for both the baseline and then one with the "HI!" comment. Looking at the diff (attached) the difference seems to be that the compiler optimized some of the operations. In other words the bloat-o-meter for x86 is useless for this. > > >--- a/xen/include/asm-x86/alternative.h > >+++ b/xen/include/asm-x86/alternative.h > >@@ -56,10 +56,12 @@ extern void alternative_instructions(void); > > > >#define ALTERNATIVE_N(newinstr, feature, number) \ > >".pushsection .altinstructions,\"a\"\n" \ > >+ ".p2align 2\n" \ > > Can't this then be accompanied by dropping the (over-)alignment > done in xen.lds.S? Yes. And also in the arm one. > > >ALTINSTR_ENTRY(feature, number) \ > >".section .discard,\"a\",@progbits\n" \ > >DISCARD_ENTRY(number) \ > >".section .altinstr_replacement, \"ax\"\n" \ > >+ ".p2align 2\n" \ > > This surely isn't needed on x86. Nope. But I added to be in sync with the other. But it can be removed. > > Jan > diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h index db4f08e0e7..43d1851f86 100644 --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -56,6 +56,7 @@ extern void alternative_instructions(void); #define ALTERNATIVE_N(newinstr, feature, number) \ ".pushsection .altinstructions,\"a\"\n" \ + ".p2align 2\n" \ ALTINSTR_ENTRY(feature, number) \ ".section .discard,\"a\",@progbits\n" \ DISCARD_ENTRY(number) \ $ ~/linux/scripts/bloat-o-meter /tmp/xen-syms.baseline.debug xen-syms add/remove: 0/0 grow/shrink: 1/2 up/down: 87/-237 (-150) function old new delta sh_page_fault__guest_4 8557 8644 +87 map_pages_to_xen 4406 4322 -84 sh_x86_emulate_write__guest_4 444 291 -153 Total: Before=3315124, After=3314974, chg -0.00% [konrad@localhost xen]$ I get the same amount if the '.p2align 2' is in .altinstr_replacement": diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h index db4f08e0e7..201683e29e 100644 --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -60,6 +60,7 @@ extern void alternative_instructions(void); ".section .discard,\"a\",@progbits\n" \ DISCARD_ENTRY(number) \ ".section .altinstr_replacement, \"ax\"\n" \ + ".p2align 2\n" \ ALTINSTR_REPLACEMENT(newinstr, feature, number) \ ".popsection\n" For fun I changed p2align to 1: diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h index db4f08e0e7..13a7204e6b 100644 --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -60,6 +60,7 @@ extern void alternative_instructions(void); ".section .discard,\"a\",@progbits\n" \ DISCARD_ENTRY(number) \ ".section .altinstr_replacement, \"ax\"\n" \ + ".p2align 1\n" \ ALTINSTR_REPLACEMENT(newinstr, feature, number) \ ".popsection\n" [konrad@localhost xen]$ ~/linux/scripts/bloat-o-meter /tmp/xen-syms.baseline.debug xen-syms add/remove: 0/0 grow/shrink: 1/2 up/down: 87/-237 (-150) function old new delta sh_page_fault__guest_4 8557 8644 +87 map_pages_to_xen 4406 4322 -84 sh_x86_emulate_write__guest_4 444 291 -153 Total: Before=3315124, After=3314974, chg -0.00% And then to 0. --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -60,6 +60,7 @@ extern void alternative_instructions(void); ".section .discard,\"a\",@progbits\n" \ DISCARD_ENTRY(number) \ ".section .altinstr_replacement, \"ax\"\n" \ + ".p2align 0\n" \ ALTINSTR_REPLACEMENT(newinstr, feature, number) \ ".popsection\n" [konrad@localhost xen]$ ~/linux/scripts/bloat-o-meter /tmp/xen-syms.baseline.debug xen-syms add/remove: 0/0 grow/shrink: 1/2 up/down: 87/-237 (-150) function old new delta sh_page_fault__guest_4 8557 8644 +87 map_pages_to_xen 4406 4322 -84 sh_x86_emulate_write__guest_4 444 291 -153 Total: Before=3315124, After=3314974, chg -0.00% WTF?! [konrad@localhost xen]$ git diff diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h index db4f08e0e7..6c3d59a7df 100644 --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -60,6 +60,7 @@ extern void alternative_instructions(void); ".section .discard,\"a\",@progbits\n" \ DISCARD_ENTRY(number) \ ".section .altinstr_replacement, \"ax\"\n" \ + "# HI!\n" \ ALTINSTR_REPLACEMENT(newinstr, feature, number) \ ".popsection\n"