From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 0/2] KVM: MMU: support VMAs that got remap_pfn_range-ed Date: Mon, 4 Jul 2016 15:59:33 +0800 Message-ID: <577A1765.6080606@linux.intel.com> References: <1467291711-3230-1-git-send-email-pbonzini@redhat.com> <577A049A.4000402@linux.intel.com> <20160704070314.GA13291@nvidia.com> <577A123F.1060909@linux.intel.com> <8ff54c7b-2e64-4503-03f6-1a858d9d5746@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Kirti Wankhede , Andrea Arcangeli , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= To: Paolo Bonzini , Neo Jia Return-path: In-Reply-To: <8ff54c7b-2e64-4503-03f6-1a858d9d5746@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 07/04/2016 03:48 PM, Paolo Bonzini wrote: > > > On 04/07/2016 09:37, Xiao Guangrong wrote: >>>> >>> >>> It actually is a portion of the physical mmio which is set by vfio mmap. >> >> So i do not think we need to care its refcount, i,e, we can consider it >> as reserved_pfn, >> Paolo? > > nVidia provided me (offlist) with a simple patch that modified VFIO to > exhibit the problem, and it didn't use reserved PFNs. This is why the > commit message for the patch is not entirely accurate. > It's clear now. > But apart from this, it's much more obvious to consider the refcount. > The x86 MMU code doesn't care if the page is reserved or not; > mmu_set_spte does a kvm_release_pfn_clean, hence it makes sense for > hva_to_pfn_remapped to try doing a get_page (via kvm_get_pfn) after > invoking the fault handler, just like the get_user_pages family of > function does. Well, it's little strange as you always try to get refcont for a PFNMAP region without MIXEDMAP which indicates all the memory in this region is no 'struct page' backend. But it works as kvm_{get, release}_* have already been aware of reserved_pfn, so i am okay with it......