linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Denys Vlasenko <dvlasenk@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Subject: Re: [GIT PULL] Crypto Fixes for 5.15
Date: Tue, 2 Nov 2021 12:01:43 +0800	[thread overview]
Message-ID: <20211102040143.GB23420@gondor.apana.org.au> (raw)
In-Reply-To: <CAHk-=whEFkHvtecaUF5MEZMxW_UVUMn-bLmfAhcvx4t9Qia90A@mail.gmail.com>

On Fri, Oct 29, 2021 at 10:39:35AM -0700, Linus Torvalds wrote:
>
> Plus, I get the feeling that some people have just copied-and-pasted
> those things, and don't necessarily realize just _how_ subtle 'M'
> sections are.
> 
> How much of a data savings is it to have this complexity? Particularly
> since I suspect most of the time these things end up being individual
> modules, and never actually get linked together at all?

Let me copy Denys Vlasenko who introduced this.

But you're absolutely right that the recent additions are
more likely to be just cut-n-paste rather than deeply thought
through.

FWIW the original change that added this was:

ommit e183914af00e15eb41ae666d44e323bfa154be13
Author: Denys Vlasenko <dvlasenk@redhat.com>
Date:   Thu Jan 19 22:33:04 2017 +0100

    crypto: x86 - make constants readonly, allow linker to merge them

    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>
    CC: Herbert Xu <herbert@gondor.apana.org.au>
    CC: Josh Poimboeuf <jpoimboe@redhat.com>
    CC: Xiaodong Liu <xiaodong.liu@intel.com>
    CC: Megha Dey <megha.dey@intel.com>
    CC: linux-crypto@vger.kernel.org
    CC: x86@kernel.org
    CC: linux-kernel@vger.kernel.org
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
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

  reply	other threads:[~2021-11-02  4:01 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  4:40 [GIT PULL] Crypto Update for 5.9 Herbert Xu
2020-08-03 17:55 ` pr-tracker-bot
2020-08-30 22:33 ` [GIT PULL] Crypto Fixes " Herbert Xu
2020-08-30 23:02   ` pr-tracker-bot
2020-09-10  0:34   ` Herbert Xu
2020-09-10  2:48     ` pr-tracker-bot
2020-10-26  1:11   ` [GIT PULL] Crypto Fixes for 5.10 Herbert Xu
2020-10-26 17:52     ` pr-tracker-bot
2020-12-27 11:32     ` [GIT PULL] Crypto Fixes for 5.11 Herbert Xu
2020-12-27 17:27       ` pr-tracker-bot
2021-01-08  3:54       ` Herbert Xu
2021-01-08 20:36         ` pr-tracker-bot
2021-01-18  5:13         ` Herbert Xu
2021-01-18 21:16           ` pr-tracker-bot
2021-01-25 22:36           ` Herbert Xu
2021-01-26  0:01             ` pr-tracker-bot
2021-07-08  3:09         ` [GIT PULL] Crypto Fixes for 5.14 Herbert Xu
2021-07-09 19:20           ` pr-tracker-bot
2021-08-17  1:36           ` Herbert Xu
2021-08-17  2:27             ` pr-tracker-bot
2021-09-29  2:38             ` [GIT PULL] Crypto Fixes for 5.15 Herbert Xu
2021-09-29 14:51               ` pr-tracker-bot
2021-10-29  4:14               ` Herbert Xu
2021-10-29 17:39                 ` Linus Torvalds
2021-11-02  4:01                   ` Herbert Xu [this message]
2021-10-29 18:49                 ` pr-tracker-bot
2021-11-12 10:48                 ` [GIT PULL] Crypto Fixes for 5.16 Herbert Xu
2021-11-12 20:42                   ` pr-tracker-bot
2021-12-22  5:13                   ` Herbert Xu
2021-12-22 19:02                     ` pr-tracker-bot
2022-02-09  2:33                     ` [GIT PULL] Crypto Fixes for 5.17 Herbert Xu
2022-02-09 18:01                       ` pr-tracker-bot
2022-03-16  1:13                       ` Herbert Xu
2022-03-17 20:40                         ` pr-tracker-bot
2022-03-31  3:16                         ` [GIT PULL] Crypto Fixes for 5.18 Herbert Xu
2022-03-31 19:12                           ` pr-tracker-bot
2022-05-20  5:41                           ` Herbert Xu
2022-05-20  6:10                             ` pr-tracker-bot
2022-05-27 11:29                           ` [GIT PULL] Crypto Fixes for 5.19 Herbert Xu
2022-05-28  1:21                             ` pr-tracker-bot
2022-06-17  8:29                             ` Herbert Xu
2022-06-17 15:29                               ` pr-tracker-bot
2022-06-30  7:56                               ` Herbert Xu
2022-06-30 17:28                                 ` pr-tracker-bot
2022-08-02  6:05                             ` [GIT PULL] Crypto Update for 5.20 Herbert Xu
2022-08-03  0:57                               ` pr-tracker-bot
2020-10-12  3:32 ` [GIT PULL] Crypto Update for 5.10 Herbert Xu
2020-10-13 16:24   ` pr-tracker-bot
2020-12-14  5:55   ` [GIT PULL] Crypto Update for 5.11 Herbert Xu
2020-12-14 20:56     ` pr-tracker-bot
2021-02-15  2:47     ` [GIT PULL] Crypto Update for 5.12 Herbert Xu
2021-02-22  1:28       ` pr-tracker-bot
2021-04-26 12:32       ` [GIT PULL] Crypto Update for 5.13 Herbert Xu
2021-04-26 15:59         ` pr-tracker-bot
2021-06-28 11:00         ` [GIT PULL] Crypto Update for 5.14 Herbert Xu
2021-06-28 23:36           ` pr-tracker-bot
2021-08-30  8:28           ` [GIT PULL] Crypto Update for 5.15 Herbert Xu
2021-08-30 20:17             ` pr-tracker-bot
2021-11-02  3:52             ` [GIT PULL] Crypto Update for 5.16 Herbert Xu
2021-11-02  4:27               ` pr-tracker-bot
2022-01-11  2:04               ` [GIT PULL] Crypto Update for 5.17 Herbert Xu
2022-01-11 20:53                 ` pr-tracker-bot
2022-03-20 23:42                 ` [GIT PULL] Crypto Update for 5.18 Herbert Xu
2022-03-21 23:14                   ` Linus Torvalds
2022-03-22  5:49                     ` Herbert Xu
2022-03-21 23:18                   ` pr-tracker-bot

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=20211102040143.GB23420@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=dvlasenk@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tianjia.zhang@linux.alibaba.com \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [GIT PULL] Crypto Fixes for 5.15' \
    /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

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).