From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v3 5/6] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Date: Tue, 3 Sep 2013 11:39:39 +0300 Message-ID: <20130903083939.GV22899@redhat.com> References: <08db7d166ab05ce133300ba069c0728f5c97120b.1375971992.git.jan.kiszka@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , kvm , Xiao Guangrong , Jun Nakajima , Yang Zhang , Arthur Chunqi Li To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:16306 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759537Ab3ICIjq (ORCPT ); Tue, 3 Sep 2013 04:39:46 -0400 Content-Disposition: inline In-Reply-To: <08db7d166ab05ce133300ba069c0728f5c97120b.1375971992.git.jan.kiszka@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Aug 08, 2013 at 04:26:32PM +0200, Jan Kiszka wrote: > This job is normally performed by the architectural EFER set service > which we cannot use as it prevents transitions that are valid when > switching between L1 and L2. So open-code the update of base_role.nxe > after changing EFER on VM-entry and exit. > > Signed-off-by: Jan Kiszka > --- > arch/x86/kvm/vmx.c | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 9b0510b..7cc208a 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -7735,6 +7735,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) > vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); > /* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */ > vmx_set_efer(vcpu, vcpu->arch.efer); > + vcpu->arch.mmu.base_role.nxe = > + (vcpu->arch.efer & EFER_NX) && !enable_ept; > kvm_mmu_reset_context() called later in this function does that. > if (nested_cpu_has_ept(vmcs12)) { > kvm_mmu_unload(vcpu); > @@ -8179,6 +8181,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, > else > vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); > vmx_set_efer(vcpu, vcpu->arch.efer); > + vcpu->arch.mmu.base_role.nxe = > + (vcpu->arch.efer & EFER_NX) && !enable_ept; > Same here. > kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp); > kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip); > -- > 1.7.3.4 -- Gleb.