Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3780661pxb; Mon, 1 Nov 2021 21:02:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHidhL/XHA6Ng9CqCPPOZBi7R2w+MuPsCDcRO6rV9uakPi10XH8WsDy/dGx1PWtrUjiLck X-Received: by 2002:a17:906:c015:: with SMTP id e21mr41925575ejz.113.1635825739831; Mon, 01 Nov 2021 21:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635825739; cv=none; d=google.com; s=arc-20160816; b=QNRUEQUE8qWYGzJX88MkP//n2PqUM5undu5xYE8X6ina5jR8k0ydmh4U4/GdC0ZKdv VS/RJvFPSx0n6MAGil94ZkFezSunEMQAVuLU+4AC5QrNp6jG3OEfZHRuzUA8neXOwhx2 IPl/Xcr8eToOSkzi6Vuivq5fJDNl2oM7+wkprqIwbZR2qlK15EmpFj+SDgKY9w1CcYmg b2VlbGvhrZH8txtHqLNJO7p8HTds1SLwvnU8kCk5mHObiUgvkRgKMnzOWOHKrRg50njO Fir6OUInVBpU1z77yKFht1UnI/lujflVSNEMItn6EAwxjEZZbujtKoaJFElhjXhLDy9j wQog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qn+86tUd/OWkkqYH4oZsRkZEUQx6Gk52l6pV0GtrFMs=; b=tCYT61yHjPuLXzPru4jg/GPqu6hUkTteeWfjJNUM+5MAJreXzX5Okcohe4OI4bpzF6 DVNh5Q81qDyO5uijo8JIoUaj1Qu4ZGnycrh3Hs21pLC/kuXbPxR0wlz+Z/prG0WIFQgj PJDgnGvq8IrNTbXgiw4uC7JXN6rUUyW2c4nlVOXyX2ofAIfhXT5o9Drz5n6+6pJ3HIwB xlTS5XqpmBCPDgyFyuZ1NwrEACJ8WwQLBTv/Y4ly7dxw6Lds83AIHwlfjpTiPs+JI7/r 8cl09H/SBn3BTxz+0SoNie+Bri6hLD31Q86G+XWvJJLuYhJUy04dCqNQMCGoBRpTI6du GwkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs43si29854649ejc.209.2021.11.01.21.01.53; Mon, 01 Nov 2021 21:02:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhKBEE0 (ORCPT + 99 others); Tue, 2 Nov 2021 00:04:26 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:56460 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbhKBEEZ (ORCPT ); Tue, 2 Nov 2021 00:04:25 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1mhkza-0004yC-Tu; Tue, 02 Nov 2021 12:01:46 +0800 Received: from herbert by gondobar with local (Exim 4.92) (envelope-from ) id 1mhkzX-00067B-KK; Tue, 02 Nov 2021 12:01:43 +0800 Date: Tue, 2 Nov 2021 12:01:43 +0800 From: Herbert Xu To: Linus Torvalds , Denys Vlasenko Cc: "David S. Miller" , Linux Kernel Mailing List , Linux Crypto Mailing List , Tianjia Zhang Subject: Re: [GIT PULL] Crypto Fixes for 5.15 Message-ID: <20211102040143.GB23420@gondor.apana.org.au> References: <20200803044024.GA6429@gondor.apana.org.au> <20200830223304.GA16882@gondor.apana.org.au> <20201026011159.GA2428@gondor.apana.org.au> <20201227113221.GA28744@gondor.apana.org.au> <20210108035450.GA6191@gondor.apana.org.au> <20210708030913.GA32097@gondor.apana.org.au> <20210817013601.GA14148@gondor.apana.org.au> <20210929023843.GA28594@gondor.apana.org.au> <20211029041408.GA3192@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 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." 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 CC: Herbert Xu CC: Josh Poimboeuf CC: Xiaodong Liu CC: Megha Dey CC: linux-crypto@vger.kernel.org CC: x86@kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Herbert Xu Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt