From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 2/2] KVM: Fetch guest cr3 from hardware on demand Date: Wed, 22 Dec 2010 16:03:47 +0200 Message-ID: <4D120543.5040309@redhat.com> References: <1292852772-24247-1-git-send-email-avi@redhat.com> <1292852772-24247-3-git-send-email-avi@redhat.com> <20101222134416.GA10696@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:5066 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265Ab0LVODv (ORCPT ); Wed, 22 Dec 2010 09:03:51 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBME3oW8001287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Dec 2010 09:03:51 -0500 In-Reply-To: <20101222134416.GA10696@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 12/22/2010 03:44 PM, Marcelo Tosatti wrote: > On Mon, Dec 20, 2010 at 03:46:12PM +0200, Avi Kivity wrote: > > Instead of syncing the guest cr3 every exit, which is expensince on vmx > > with ept enabled, sync it only on demand. > > > > > static inline ulong kvm_read_cr3(struct kvm_vcpu *vcpu) > > { > > + if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail)) > > + kvm_x86_ops->decache_cr3(vcpu); > > return vcpu->arch.cr3; > > } > > Should mark register available on vcpu->arch.cr3 assignment > (kvm_set_cr3, kvm_set_sregs, etc), so that subsequent cr3 read does not > use decache value. True. Will fix and repost. (it's not a correctness problem, since the cached value will match GUEST_CR3, but it's nicer) -- error compiling committee.c: too many arguments to function