[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/hvm: Conditionally leave CPUID Faulting active in HVM context
commit 9bd6b01f9d466a5836633599934d6637b965133f Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Jan 9 13:42:02 2017 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Tue Jan 24 10:38:35 2017 +0000 x86/hvm: Conditionally leave CPUID Faulting active in HVM context 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> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- 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 a5e5ffd..dcb308c 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) ) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |