From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v5 03/12] KVM: introduce gfn_to_pfn_memslot_atomic Date: Fri, 10 Aug 2012 11:22:02 +0800 Message-ID: <50247E5A.5040503@linux.vnet.ibm.com> References: <5020E423.9080004@linux.vnet.ibm.com> <5020E4B0.9090609@linux.vnet.ibm.com> <20120809185047.GB20889@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , LKML , KVM To: Marcelo Tosatti Return-path: In-Reply-To: <20120809185047.GB20889@amt.cnet> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 08/10/2012 02:50 AM, Marcelo Tosatti wrote: > On Tue, Aug 07, 2012 at 05:49:36PM +0800, Xiao Guangrong wrote: >> It can instead of hva_to_pfn_atomic >> >> Signed-off-by: Xiao Guangrong >> --- >> arch/x86/kvm/mmu.c | 5 +---- >> include/linux/kvm_host.h | 3 ++- >> virt/kvm/kvm_main.c | 14 ++++++++------ >> 3 files changed, 11 insertions(+), 11 deletions(-) > > What if someone needs gfn_to_hva_memslot in the future, which is not > unlikely? Marcelo, We have already had the function gfn_to_hva_memslot in kvm_host.h which is not directly used on x86. In this patchset, gfn_to_hva_memslot does not check the slot->flags. I think we can let it be based on gfn_to_hva_many: static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn) { return gfn_to_hva_many(slot, gfn, true); } Then all gfn_to_*() functions are based on gfn_to_hva_many in which we will check slot->flags properly.