[MODERATED] Re: [patch V6 08/14] MDS basics 8
Frederic Weisbecker <[email protected]>
| Newsgroups | org.kernel.lore.historical-speck |
|---|---|
| Message-ID | <20190303025441.GA27786@lerouge> |
On Fri, Mar 01, 2019 at 10:47:46PM +0100, speck for Thomas Gleixner wrote: > CPUs which are affected by L1TF and MDS mitigate MDS with the L1D Flush on > VMENTER when updated microcode is installed. > > If a CPU is not affected by L1TF or if the L1D Flush is not in use, then > MDS mitigation needs to be invoked explicit. > > For these cases, follow the host mitigation state and invoke the MDS > mitigation before VMENTER. > > Signed-off-by: Thomas Gleixner <[email protected]> > Reviewed-by: Greg Kroah-Hartman <[email protected]> > --- > V4 --> V5: Fix changelog > --- > arch/x86/kernel/cpu/bugs.c | 1 + > arch/x86/kvm/vmx/vmx.c | 2 ++ > 2 files changed, 3 insertions(+) > > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -65,6 +65,7 @@ DEFINE_STATIC_KEY_FALSE(switch_mm_always > > /* Control MDS CPU buffer clear before returning to user space */ > DEFINE_STATIC_KEY_FALSE(mds_user_clear); > +EXPORT_SYMBOL_GPL(mds_user_clear); > > void __init check_bugs(void) > { > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6371,6 +6371,8 @@ static void __vmx_vcpu_run(struct kvm_vc We may want to add a comment below to summarize what's explained in the changelog. git blame tends to lose prime history after any future most unsignificant variable rename. Something like: + /* l1tf mitigation, if present, spares us mds mitigation */ > if (static_branch_unlikely(&vmx_l1d_should_flush)) > vmx_l1d_flush(vcpu); > + else if (static_branch_unlikely(&mds_user_clear)) > + mds_clear_cpu_buffers(); Reviewed-by: Frederic Weisbecker <[email protected]> Thanks.