RE: [PATCH v1] x86/retpoline: Use lfence in the retpoline/RSB filling RSB macros

From: Van De Ven, Arjan
Date: Sat Jan 13 2018 - 09:07:42 EST


> > The RSB filling macro is applicable to AMD, and, if software is unable to
> > verify that lfence is serializing on AMD (possible when running under a
> > hypervisor), the generic retpoline support will be used and, so, is also
> > applicable to AMD.ÂÂChange the use of pause to lfence.
> >
> > Signed-off-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
>
> Conditionally-Acked-by: David Woodhouse <dwmw@xxxxxxxxxxxx>


pause is technically the "save me power" instruction

how about a compromise where we do a double:

pause
lfence
jmp <up>

as sequence... that way if the branch recovery is fast, we get the performance of pause, but if it takes a while, on AMD you get the behavior of lfence?