From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 9/10] KVM MMU: separate invlpg code form kvm_mmu_pte_write() Date: Sun, 25 Apr 2010 12:57:10 +0300 Message-ID: <4BD411F6.6030800@redhat.com> References: <4BD3E306.4020202@cn.fujitsu.com> <4BD3E8EB.1010006@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , KVM list , LKML To: Xiao Guangrong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37608 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752973Ab0DYJ5b (ORCPT ); Sun, 25 Apr 2010 05:57:31 -0400 In-Reply-To: <4BD3E8EB.1010006@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/25/2010 10:02 AM, Xiao Guangrong wrote: > Let invlpg not depends on kvm_mmu_pte_write path, later patch will need > this feature > > > if (mmu_topup_memory_caches(vcpu)) > return; > - kvm_mmu_pte_write(vcpu, pte_gpa, NULL, sizeof(pt_element_t), 0); > + > + kvm_read_guest_page(vcpu->kvm, gfn,&gentry, offset, > + sizeof(pt_element_t)); > + > Need error check. > + mmu_guess_page_from_pte_write(vcpu, gfn_to_gpa(gfn) + offset, gentry); > This needs an undo operation to drop the page if we don't update_pte(); see the end of kvm_mmu_pte_write(). That needs to go into a helper to avoid duplication. > + spin_lock(&vcpu->kvm->mmu_lock); > + if (atomic_read(&vcpu->kvm->arch.invlpg_counter) == invlpg_counter&& > + sp->role.level == PT_PAGE_TABLE_LEVEL) { > + ++vcpu->kvm->stat.mmu_pte_updated; > + FNAME(update_pte)(vcpu, sp, sptep,&gentry); > + } > + > + spin_unlock(&vcpu->kvm->mmu_lock); > } > > static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr, u32 access, > -- error compiling committee.c: too many arguments to function