Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1565030
| Path | csiph.com!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Herbert Xu <herbert@gondor.apana.org.au> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them |
| Date | Mon, 23 Jan 2017 16:10:03 +0100 |
| Message-ID | <t2OpR-812-41@gated-at.bofh.it> (permalink) |
| References | <t1sB3-6OE-19@gated-at.bofh.it> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 59 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Josh Poimboeuf <jpoimboe@redhat.com>, Xiaodong Liu <xiaodong.liu@intel.com>, Megha Dey <megha.dey@intel.com>, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Mon, 23 Jan 2017 23:00:51 +0800 |
| X-Original-Message-ID | <20170123150051.GG20806@gondor.apana.org.au> |
| X-Original-References | <20170119213304.18140-1-dvlasenk@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1565030 |
Show key headers only | View raw
On Thu, Jan 19, 2017 at 10:33:04PM +0100, Denys Vlasenko wrote: > A lot of asm-optimized routines in arch/x86/crypto/ keep its > constants in .data. This is wrong, they should be on .rodata. > > Mnay of these constants are the same in different modules. > For example, 128-bit shuffle mask 0x000102030405060708090A0B0C0D0E0F > exists in at least half a dozen places. > > There is a way to let linker merge them and use just one copy. > The rules are as follows: mergeable objects of different sizes > should not share sections. You can't put them all in one .rodata > section, they will lose "mergeability". > > GCC puts its mergeable constants in ".rodata.cstSIZE" sections, > or ".rodata.cstSIZE.<object_name>" if -fdata-sections is used. > This patch does the same: > > .section .rodata.cst16.SHUF_MASK, "aM", @progbits, 16 > > It is important that all data in such section consists of > 16-byte elements, not larger ones, and there are no implicit > use of one element from another. > > When this is not the case, use non-mergeable section: > > .section .rodata[.VAR_NAME], "a", @progbits > > This reduces .data by ~15 kbytes: > > text data bss dec hex filename > 11097415 2705840 2630712 16433967 fac32f vmlinux-prev.o > 11112095 2690672 2630712 16433479 fac147 vmlinux.o > > Merged objects are visible in System.map: > > ffffffff81a28810 r POLY > ffffffff81a28810 r POLY > ffffffff81a28820 r TWOONE > ffffffff81a28820 r TWOONE > ffffffff81a28830 r PSHUFFLE_BYTE_FLIP_MASK <- merged regardless of > ffffffff81a28830 r SHUF_MASK <------------- the name difference > ffffffff81a28830 r SHUF_MASK > ffffffff81a28830 r SHUF_MASK > .. > ffffffff81a28d00 r K512 <- merged three identical 640-byte tables > ffffffff81a28d00 r K512 > ffffffff81a28d00 r K512 > > Use of object names in section name suffixes is not strictly necessary, > but might help if someday link stage will use garbage collection > to eliminate unused sections (ld --gc-sections). > > Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Patch applied. Thanks. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] x86/crypto: make constants readonly, allow linker to merge them Denys Vlasenko <dvlasenk@redhat.com> - 2017-01-19 22:40 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Thomas Gleixner <tglx@linutronix.de> - 2017-01-20 00:20 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Denys Vlasenko <dvlasenk@redhat.com> - 2017-01-23 16:30 +0100
Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them Herbert Xu <herbert@gondor.apana.org.au> - 2017-01-23 16:10 +0100
csiph-web