On Mon, Jan 8, 2018 at 10:32 AM, Florian Weimer <f...@deneb.enyo.de> wrote: > * H. J. Lu: > >> On Mon, Jan 8, 2018 at 12:20 AM, Florian Weimer <f...@deneb.enyo.de> wrote: >>> * H. J. Lu: >>> >>>> Add -mindirect-branch-loop= option to control loop filler in call and >>>> return thunks generated by -mindirect-branch=. 'lfence' uses "lfence" >>>> as loop filler. 'pause' uses "pause" as loop filler. 'nop' uses "nop" >>>> as loop filler. The default is 'lfence'. >>> >>> Why is the loop needed? Doesn't ud2 or cpuid stop speculative >>> execution? >> >> My understanding is that a loop works better. > > Better how? > > What about far jumps? I think they prevent some forms of prefetch on > i386, so perhaps long mode is similar in that regard?
These are more expensive and we can't guarantee that they are effective, hence the short loop . -- H.J.