[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.8] x86: Avoid corruption on migrate for vcpus using CPUID Faulting
commit 2aff8d5e7318882909564f8b1cf091621066c41b Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Feb 8 12:38:24 2018 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Feb 8 12:38:24 2018 +0100 x86: Avoid corruption on migrate for vcpus using CPUID Faulting Xen 4.8 and later virtualises CPUID Faulting support for guests. However, the value of MSR_MISC_FEATURES_ENABLES is omitted from the vcpu state, meaning that the current cpuid faulting setting is lost on migrate/suspend/resume. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> master commit: b90f86be161c74df8cb69c98d9f22885d9d87114 master date: 2017-12-01 18:09:48 +0000 --- xen/arch/x86/domctl.c | 18 ++++++++++++++++++ xen/arch/x86/hvm/vmx/vmx.c | 13 ++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index d32e70e..8bb4a52 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1292,6 +1292,19 @@ long arch_do_domctl( } } + if ( v->arch.cpuid_faulting ) + { + if ( i < vmsrs->msr_count && !ret ) + { + msr.index = MSR_INTEL_MISC_FEATURES_ENABLES; + msr.reserved = 0; + msr.value = MSR_MISC_FEATURES_CPUID_FAULTING; + if ( copy_to_guest_offset(vmsrs->msrs, i, &msr, 1) ) + ret = -EFAULT; + } + ++i; + } + vcpu_unpause(v); if ( i > vmsrs->msr_count && !ret ) @@ -1319,6 +1332,11 @@ long arch_do_domctl( switch ( msr.index ) { + case MSR_INTEL_MISC_FEATURES_ENABLES: + v->arch.cpuid_faulting = !!(msr.value & + MSR_MISC_FEATURES_CPUID_FAULTING); + continue; + case MSR_AMD64_DR0_ADDRESS_MASK: if ( !boot_cpu_has(X86_FEATURE_DBEXT) || (msr.value >> 32) ) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index fa528fc..e282fc8 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -787,7 +787,8 @@ static int vmx_load_vmcs_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt) static unsigned int __init vmx_init_msr(void) { - return (cpu_has_mpx && cpu_has_vmx_mpx) + + return 1 /* MISC_FEATURES_ENABLES */ + + (cpu_has_mpx && cpu_has_vmx_mpx) + (cpu_has_xsaves && cpu_has_vmx_xsaves); } @@ -795,6 +796,12 @@ static void vmx_save_msr(struct vcpu *v, struct hvm_msr *ctxt) { vmx_vmcs_enter(v); + if ( v->arch.cpuid_faulting ) + { + ctxt->msr[ctxt->count].index = MSR_INTEL_MISC_FEATURES_ENABLES; + ctxt->msr[ctxt->count++].val = MSR_MISC_FEATURES_CPUID_FAULTING; + } + if ( cpu_has_mpx && cpu_has_vmx_mpx ) { __vmread(GUEST_BNDCFGS, &ctxt->msr[ctxt->count].val); @@ -823,6 +830,10 @@ static int vmx_load_msr(struct vcpu *v, struct hvm_msr *ctxt) { switch ( ctxt->msr[i].index ) { + case MSR_INTEL_MISC_FEATURES_ENABLES: + v->arch.cpuid_faulting = !!(ctxt->msr[i].val & + MSR_MISC_FEATURES_CPUID_FAULTING); + break; case MSR_IA32_BNDCFGS: if ( cpu_has_mpx && cpu_has_vmx_mpx && is_canonical_address(ctxt->msr[i].val) && -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.8 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |