lkml.org 
[lkml]   [2020]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled
On Thu, Aug 20, 2020 at 07:50:50PM -0700, Sean Christopherson wrote:
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index 70dea93378162..fd915c46297c5 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -842,8 +842,13 @@ SYM_CODE_START_LOCAL(paranoid_entry)
> *
> * The MSR write ensures that no subsequent load is based on a
> * mispredicted GSBASE. No extra FENCE required.
> + *
> + * Disallow RDPID if KVM is enabled as it may consume a guest's TSC_AUX
> + * if an NMI arrives in KVM's run loop. KVM loads guest's TSC_AUX on
> + * VM-Enter and may not restore the host's value until the CPU returns
> + * to userspace, i.e. KVM depends on the kernel not using TSC_AUX.
> */
> - SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx
> + SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx no_rdpid=IS_ENABLED(CONFIG_KVM)
> ret

With distro configs that's going to be a guaranteed no_rdpid. Also with
a grand total of 0 performance numbers that RDPID is even worth it, I'd
suggest to just unconditionally remove that thing. Simpler code
all-around.

\
 
 \ /
  Last update: 2020-08-21 09:25    [W:0.093 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site