From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 3/5] KVM: add kvm_follow_page() Date: Mon, 24 Dec 2007 08:56:01 +0200 Message-ID: <476F5801.2030002@qumranet.com> References: <20071221002024.345682789@redhat.com> <476D68A3.3000200@qumranet.com> <20071223052513.GA19072@dmt> <476E083B.5040600@qumranet.com> <476E1F23.3020609@qumranet.com> <476E236A.9000800@qumranet.com> <20071223012618.e8cf8320.akpm@linux-foundation.org> <476E39F2.4030202@qumranet.com> <20071223025245.d839c86d.akpm@linux-foundation.org> <476E4005.90003@qumranet.com> <20071223201525.GA14259@dmt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Andrew Morton , Matt Mackall To: Marcelo Tosatti Return-path: In-Reply-To: <20071223201525.GA14259@dmt> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Marcelo Tosatti wrote: > It can acquire the pagetablelock in the callback handler. But then, > vm_normal_page() must also be exported. > > Are you guys OK with this ? > > Seems to me that requires fairly detailed mucking in mm details, just to get at a page. I believe that a new get_users_pages_inatomic() is more suitable; Andrew, I'll write it if you agree. Alternatively, walk_page_range() should take the lock itself, otherwise it is only usable if you don't care about correctness? > > +static int kvm_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, > + void *private) > +{ > + struct page **page = private; > + struct vm_area_struct *vma; > + pte_t *ptep, pte; > + spinlock_t *ptl; > + int err = -EFAULT; > + > + vma = find_vma(current->mm, addr); > + if (!vma) > + return err; > + > + ptep = pte_offset_map_lock(current->mm, pmd, addr, &ptl); > + pte = *ptep; > + if (!pte_present(pte)) > + goto unlock; > + > + *page = vm_normal_page(vma, addr, pte); > + if (!*page) > + goto unlock; > + > + get_page(*page); > + err = 0; > +unlock: > + pte_unmap_unlock(ptep, ptl); > + return err; > +} > + > See what one has to write to get at a page? Unreasonable IMO. And that's without hugetlb support AFAICT (kvm will want that soon). -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/