Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7821402pxb; Thu, 18 Feb 2021 23:16:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgLgHgBe4ZixNXNWpdyjnKh9tS2goTA+U6mzpnBrQ9fUuYaV2bDoBl+Up3+CaA1FzUuEp6 X-Received: by 2002:a17:906:4e1a:: with SMTP id z26mr7454583eju.349.1613719010163; Thu, 18 Feb 2021 23:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613719010; cv=none; d=google.com; s=arc-20160816; b=lJRmX9bAPXvqiMElygMUHFq4m12cT/PF1B8iQGwMezkyLsgCMlVARyPuDNDQ1F1ut1 Nyef6MXrb8HLqt8/dCR/+SdT+OeYo1j3SeaeZLkwIzvtNzMVy6/IQDJeXY0VKitZUnPz pBuGrscQa6YNaOu8hfvYGJmKDmDfA2MLfBTc1AWeUB+79tdbzBcoCpeYDgO1xSQ3YDWr d2fc2foAHmWTY0wB5xFH2cpaPGhd+nHTkpeqIhNAuQJXlHc5g+Hqgi6Awpk9megXw/OK 3m8UYvrOvQgQbzitdeNzw8ABdKGIpB31eMb3GqobV7+t89N5v/F4xu3C6abw+nDLGGiP fDMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Lc/b9W+3h+xWmr5smQ3gv/hU4hGpEacEf7tLiNc9UJ4=; b=v/nP4gG2WSgEtjXz34Y3IcrirDUdybHX4adXqkJ1MB/VjPFS/40mJwJ8DzCuqukNgJ SR6goOhRi8l3HEC/iyEMsZD6RFtaORwGEBMBoFBIHKZco1MYVyX0PAEObtiK61oAu7AY rhEd0OJ0CMMEVGiTrV4/tprk1ZzKfIOIkxsJZ3rBL7boE9nbcs9b2oPq/GV+3WR7oLNz SVL/HZOVO2iJ73mUN+dBIVgRlmQ74wHZZ8lAVT0XJIv04j0h0cPI2nr7I9MHfHz5UB6G oubgkfWQLnf37rMClkTYmhSYyTh9yP5Oaj2wMVZ9C3aBYlpbNmkPfphmGnvdhb8BfMLH +Tdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cBrDAliC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si4589529ejp.161.2021.02.18.23.16.25; Thu, 18 Feb 2021 23:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=cBrDAliC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbhBSHPY (ORCPT + 99 others); Fri, 19 Feb 2021 02:15:24 -0500 Received: from mail.skyhub.de ([5.9.137.197]:56066 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbhBSHPX (ORCPT ); Fri, 19 Feb 2021 02:15:23 -0500 Received: from zn.tnic (p200300ec2f046700b7f7c11af57b3c30.dip0.t-ipconnect.de [IPv6:2003:ec:2f04:6700:b7f7:c11a:f57b:3c30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 012101EC030F; Fri, 19 Feb 2021 08:14:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1613718882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Lc/b9W+3h+xWmr5smQ3gv/hU4hGpEacEf7tLiNc9UJ4=; b=cBrDAliCNAldpT8USSGX68Vfw4LADXxTFYS32YBdNC+pTrAmFpHJWtA3OLWLtv7b889Tyv GJfy3KuilF6y+CUpZ+XmsW1VSRAFa9Q/LphlY0GfVk4JbJqmfrg7vdlikcWwDzY0EpB+EC 2ZTlZzwIt2M1+oe6+8XlBmW9Vr4IVY8= Date: Fri, 19 Feb 2021 08:14:39 +0100 From: Borislav Petkov To: Peter Zijlstra Cc: x86@kernel.org, tony.luck@intel.com, pjt@google.com, linux-kernel@vger.kernel.org, r.marek@assembler.cz, jpoimboe@redhat.com, jikos@kernel.org Subject: Re: [RFC][PATCH 2/2] x86/retpoline: Compress retpolines Message-ID: <20210219071439.GA26778@zn.tnic> References: <20210218165938.213678824@infradead.org> <20210218172151.942060087@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210218172151.942060087@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2021 at 05:59:40PM +0100, Peter Zijlstra wrote: > By using int3 as a speculation fence instead of lfence, we can shrink > the longest alternative to just 15 bytes: > > 0: e8 05 00 00 00 callq a <.altinstr_replacement+0xa> > 5: f3 90 pause > 7: cc int3 > 8: eb fb jmp 5 <.altinstr_replacement+0x5> > a: 48 89 04 24 mov %rax,(%rsp) > e: c3 retq > > This means we can change the alignment from 32 to 16 bytes and get 4 > retpolines per cacheline, $I win. You mean I$ :) In any case, for both: Reviewed-by: Borislav Petkov and it looks real nice here, the size: readelf -s vmlinux | grep __x86_indirect 78966: ffffffff81c023e0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 81653: ffffffff81c02390 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 82338: ffffffff81c02430 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 82955: ffffffff81c02380 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 85057: ffffffff81c023f0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 89996: ffffffff81c023a0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 91094: ffffffff81c02400 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 91278: ffffffff81c023b0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 92015: ffffffff81c02360 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 92722: ffffffff81c023c0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 97062: ffffffff81c02410 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 98687: ffffffff81c023d0 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 99076: ffffffff81c02350 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 99500: ffffffff81c02370 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] 100579: ffffffff81c02420 15 FUNC GLOBAL DEFAULT 1 __x86_indirect_t[...] -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette