From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] add compat wrapper for get_user_pages_fast Date: Thu, 18 Sep 2008 19:30:55 -0300 Message-ID: <20080918223055.GA24183@dmt.cnet> References: <48D21065.5090602@siemens.com> <48D282C0.3050100@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Xu, Jiajun" , kvm@vger.kernel.org, Avi Kivity To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([66.187.233.31]:42890 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754138AbYIRWb4 (ORCPT ); Thu, 18 Sep 2008 18:31:56 -0400 Content-Disposition: inline In-Reply-To: <48D282C0.3050100@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Sep 18, 2008 at 06:33:04PM +0200, Jan Kiszka wrote: > Not sure if this is correct, but here is at least a compile fix. Looks good. > Note that the original mmem_map locking scope was partly far broader on > older kernels than with Marcelo's patch and this fix now. Could anyone > comment on the correctness? I think all cases have been covered (vma manipulation, find_vma callers). > > --------- > > Signed-off-by: Jan Kiszka > --- > kernel/external-module-compat-comm.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > Index: b/kernel/external-module-compat-comm.h > =================================================================== > --- a/kernel/external-module-compat-comm.h > +++ b/kernel/external-module-compat-comm.h > @@ -531,3 +531,20 @@ struct pci_dev; > struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); > > #endif > + > +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) > + > +static inline int get_user_pages_fast(unsigned long start, int nr_pages, > + int write, struct page **pages) > +{ > + int npages; > + > + down_read(¤t->mm->mmap_sem); > + npages = get_user_pages(current, current->mm, start, nr_pages, write, > + 0, pages, NULL); > + up_read(¤t->mm->mmap_sem); > + > + return npages; > +} > + > +#endif