lkml.org 
[lkml]   [2018]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 01/13] x86/retpoline: Add initial retpoline support
    On Thu, Jan 04, 2018 at 10:25:35AM -0800, Linus Torvalds wrote:
    > On Thu, Jan 4, 2018 at 10:17 AM, Alexei Starovoitov
    > <alexei.starovoitov@gmail.com> wrote:
    > >
    > > Clearly Paul's approach to retpoline without lfence is faster.
    > > I'm guessing it wasn't shared with amazon/intel until now and
    > > this set of patches going to adopt it, right?
    > >
    > > Paul, could you share a link to a set of alternative gcc patches
    > > that do retpoline similar to llvm diff ?
    >
    > What is the alternative approach? Is it literally just doing a
    >
    > call 1f
    > 1: mov real_target,(%rsp)
    > ret
    >
    > on the assumption that the "ret" will always just predict to that "1"
    > due to the call stack?

    Pretty much.
    Paul's writeup: https://support.google.com/faqs/answer/7625886
    tldr: jmp *%r11 gets converted to:
    call set_up_target;
    capture_spec:
    pause;
    jmp capture_spec;
    set_up_target:
    mov %r11, (%rsp);
    ret;
    where capture_spec part will be looping speculatively.

    \
     
     \ /
      Last update: 2018-01-04 19:36    [W:2.606 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site