From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 7/10] KVM: MMU: introduce a common function to get no-dirty-logged slot Date: Mon, 07 Mar 2011 11:50:37 +0800 Message-ID: <4D74560D.6060206@cn.fujitsu.com> References: <4D70C569.1030107@cn.fujitsu.com> <4D70C657.4030105@cn.fujitsu.com> <4D737DEE.2050402@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , LKML , KVM To: Avi Kivity Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:52617 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753934Ab1CGDtj (ORCPT ); Sun, 6 Mar 2011 22:49:39 -0500 In-Reply-To: <4D737DEE.2050402@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/06/2011 08:28 PM, Avi Kivity wrote: >> static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn) >> @@ -2155,9 +2166,8 @@ pte_prefetch_gfn_to_memslot(struct kvm_vcpu *vcpu, gfn_t gfn, bool no_dirty_log) >> { >> struct kvm_memory_slot *slot; >> >> - slot = gfn_to_memslot(vcpu->kvm, gfn); >> - if (!slot || slot->flags& KVM_MEMSLOT_INVALID || >> - (no_dirty_log&& slot->dirty_bitmap)) >> + slot = gfn_to_memslot_dirty_bitmap(vcpu, gfn, no_dirty_log); >> + if (slot&& slot->flags& KVM_MEMSLOT_INVALID) >> slot = NULL; >> >> return slot; > > For a unification this adds a lot of code... I think the result is more complicated than the starting point. > After more thinking, i think we can move 'slot->flags& KVM_MEMSLOT_INVALID' into the common function, since the later gva_to_pfn also can filter this out.