From: Tom Lendacky <thomas.lendacky@amd.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: X86 ML <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Rik van Riel <riel@redhat.com>, Andi Kleen <ak@linux.intel.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Jiri Kosina <jikos@kernel.org>,
Dave Hansen <dave.hansen@intel.com>,
Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
Kees Cook <keescook@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Tim Chen <tim.c.chen@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linux-foundation.org>,
David Woodhouse <dwmw@amazon.co.uk>, Paul Turner <pjt@google.com>
Subject: Re: [PATCH v1] x86/retpoline: Use lfence in the retpoline/RSB filling RSB macros
Date: Fri, 12 Jan 2018 20:22:19 -0600 [thread overview]
Message-ID: <fb1b487f-0918-0fed-d0e8-203628eec248@amd.com> (raw)
In-Reply-To: <CAPcyv4iBazdvqPoRWCZNdpxykVRO710Dhm8wMyFttdRwHg74EA@mail.gmail.com>
On 1/12/2018 7:53 PM, Dan Williams wrote:
> On Fri, Jan 12, 2018 at 5:07 PM, Tom Lendacky <thomas.lendacky@amd.com> wrote:
>> The pause instruction is currently used in the retpoline and RSB filling
>> macros as a speculation trap. The use of pause was originally suggested
>> because it showed a very, very small difference in the amount of
>> cycles/time used to execute the retpoline as compared to lfence. On AMD,
>> the pause instruction is not a serializing instruction, so the pause/jmp
>> loop will use excess power as it is speculated over waiting for return
>> to mispredict to the correct target.
>>
>> 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.
>
> Should we use ASM_IFENCE for this?
I don't think we need to. On bare-metal this will be fine. When running
as a guest, the hypervisor should have made lfence serializing, and if it
hasn't, this is still better then pause.
Thanks,
Tom
>
next prev parent reply other threads:[~2018-01-13 2:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-13 1:07 Tom Lendacky
2018-01-13 1:53 ` Dan Williams
2018-01-13 2:22 ` Tom Lendacky [this message]
2018-01-13 10:33 ` [tip:x86/pti] x86/retpoline: Use LFENCE instead of PAUSE " tip-bot for Tom Lendacky
2018-01-13 10:46 ` [PATCH v1] x86/retpoline: Use lfence " Woodhouse, David
2018-01-13 14:07 ` Van De Ven, Arjan
2018-01-13 21:13 ` Tom Lendacky
2018-01-13 21:36 ` Thomas Gleixner
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=fb1b487f-0918-0fed-d0e8-203628eec248@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=dwmw@amazon.co.uk \
--cc=gregkh@linux-foundation.org \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--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®