lkml.org 
[lkml]   [2018]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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);
}

?

\
 
 \ /
  Last update: 2018-01-14 23:25    [W:0.201 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site