mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Peter Zijlstra <peterz@infradead.org>
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
Date: Fri, 19 Feb 2021 08:14:39 +0100	[thread overview]
Message-ID: <20210219071439.GA26778@zn.tnic> (raw)
In-Reply-To: <20210218172151.942060087@infradead.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 <bp@suse.de>

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

  reply	other threads:[~2021-02-19  7:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 16:59 [RFC][PATCH 0/2] x86/retpoline: Retpoline on a diet Peter Zijlstra
2021-02-18 16:59 ` [RFC][PATCH 1/2] x86/retpoline: Simplify retpolines Peter Zijlstra
2021-02-22 11:36   ` Peter Zijlstra
2021-02-18 16:59 ` [RFC][PATCH 2/2] x86/retpoline: Compress retpolines Peter Zijlstra
2021-02-19  7:14   ` Borislav Petkov [this message]
2021-02-22 11:27     ` Peter Zijlstra
2021-02-18 18:46 ` [RFC PATCH] x86/retpolines: Prevent speculation after RET Borislav Petkov
2021-02-18 19:02   ` Peter Zijlstra
2021-02-18 19:11     ` Borislav Petkov
2021-02-19  8:15       ` Peter Zijlstra
2021-02-19 12:08         ` Andrew Cooper
2021-02-19  9:28     ` David Laight

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=20210219071439.GA26778@zn.tnic \
    --to=bp@alien8.de \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=r.marek@assembler.cz \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®