[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180112100817.GR3040@hirez.programming.kicks-ass.net>
Date: Fri, 12 Jan 2018 11:08:18 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Ashok Raj <ashok.raj@...el.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg KH <gregkh@...uxfoundation.org>,
Dave Hansen <dave.hansen@...el.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Arjan Van De Ven <arjan.van.de.ven@...el.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Dan Williams <dan.j.williams@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>
Subject: Re: [PATCH 5/5] x86/feature: Detect the x86 feature Indirect Branch
Prediction Barrier
On Thu, Jan 11, 2018 at 05:32:19PM -0800, Ashok Raj wrote:
> @@ -1711,11 +1715,18 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu)
> __free_pages(virt_to_page(svm->nested.msrpm), MSRPM_ALLOC_ORDER);
> kvm_vcpu_uninit(vcpu);
> kmem_cache_free(kvm_vcpu_cache, svm);
> + /*
> + * The VMCB could be recycled, causing a false negative in svm_vcpu_load;
> + * block speculative execution.
> + */
> + if (boot_cpu_has(X86_FEATURE_PRED_CMD))
> + native_wrmsrl(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
> }
> @@ -3837,6 +3839,12 @@ static void free_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
> free_vmcs(loaded_vmcs->vmcs);
> loaded_vmcs->vmcs = NULL;
> WARN_ON(loaded_vmcs->shadow_vmcs != NULL);
> + /*
> + * The VMCS could be recycled, causing a false negative in vmx_vcpu_load
> + * block speculative execution.
> + */
> + if (boot_cpu_has(X86_FEATURE_SPEC_CTRL))
> + native_wrmsrl(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
> }
Whitespace damage.
Also, why not introduce a helper like:
static inline flush_ibpb(void)
{
if (static_cpu_has(X86_FEATURE_SPEC_CTRL))
native_write_msr(MSR_IA32_PRED_CMD, FEATURE_SET_IBPB);
}
?
Powered by blists - more mailing lists