[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/hvm: Conditionally leave CPUID Faulting active in HVM context
On 16/01/17 11:17, Andrew Cooper wrote: > If the hardware supports faulting, and the guest has chosen to use it, leave > faulting active in HVM context. > > It is more efficient to have hardware convert CPUID to a #GP fault (which we > don't intercept), than to take a VMExit and have Xen re-inject a #GP fault. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- > CC: Jan Beulich <JBeulich@xxxxxxxx> > CC: Jun Nakajima <jun.nakajima@xxxxxxxxx> > CC: Kevin Tian <kevin.tian@xxxxxxxxx> Ping VT-x ? > --- > xen/arch/x86/cpu/intel.c | 5 +++-- > xen/arch/x86/hvm/vmx/vmx.c | 12 ++++++++++-- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c > index 2e11662..d0e380c 100644 > --- a/xen/arch/x86/cpu/intel.c > +++ b/xen/arch/x86/cpu/intel.c > @@ -175,8 +175,9 @@ static void intel_ctxt_switch_levelling(const struct vcpu > *next) > * generating the maximum full cpuid policy into Xen, at which > * this problem will disappear. > */ > - set_cpuid_faulting(nextd && is_pv_domain(nextd) && > - !is_control_domain(nextd)); > + set_cpuid_faulting(nextd && !is_control_domain(nextd) && > + (is_pv_domain(nextd) || > + next->arch.cpuid_faulting)); > return; > } > > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c > index 61925cf..19294cb 100644 > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -2866,11 +2866,19 @@ static int vmx_msr_write_intercept(unsigned int msr, > uint64_t msr_content) > break; > > case MSR_INTEL_MISC_FEATURES_ENABLES: > + { > + bool old_cpuid_faulting = v->arch.cpuid_faulting; > + > if ( msr_content & ~MSR_MISC_FEATURES_CPUID_FAULTING ) > goto gp_fault; > - v->arch.cpuid_faulting = > - !!(msr_content & MSR_MISC_FEATURES_CPUID_FAULTING); > + > + v->arch.cpuid_faulting = msr_content & > MSR_MISC_FEATURES_CPUID_FAULTING; > + > + if ( cpu_has_cpuid_faulting && > + (old_cpuid_faulting ^ v->arch.cpuid_faulting) ) > + ctxt_switch_levelling(v); > break; > + } > > default: > if ( passive_domain_do_wrmsr(msr, msr_content) ) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |