From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run Date: Tue, 20 Oct 2009 11:59:28 -0200 Message-ID: <20091020135928.GA6992@amt.cnet> References: <20091020123720.GA5679@amt.cnet> <4ADDB7CC.8040808@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50282 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752581AbZJTRC0 (ORCPT ); Tue, 20 Oct 2009 13:02:26 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9KH2VAQ014134 for ; Tue, 20 Oct 2009 13:02:31 -0400 Content-Disposition: inline In-Reply-To: <4ADDB7CC.8040808@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Oct 20, 2009 at 10:14:52PM +0900, Avi Kivity wrote: > On 10/20/2009 09:37 PM, Marcelo Tosatti wrote: >> GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value >> changes. >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index 364263a..325075f 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -3638,10 +3638,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) >> { >> struct vcpu_vmx *vmx = to_vmx(vcpu); >> >> - if (enable_ept&& is_paging(vcpu)) { >> - vmcs_writel(GUEST_CR3, vcpu->arch.cr3); >> + if (enable_ept&& is_paging(vcpu)) >> ept_load_pdptrs(vcpu); >> - } >> + >> /* Record the guest's net vcpu time for enforced NMI injections. */ >> if (unlikely(!cpu_has_virtual_nmis()&& vmx->soft_vnmi_blocked)) >> vmx->entry_time = ktime_get(); >> > > Nice. Any reason why ept_load_pdptrs() couldn't go the same way? Its already protected by VCPU_EXREG_PDPTR caching, so it does not buy much. The advantage would symmetry to cr3.