Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp536194imj; Thu, 7 Feb 2019 08:04:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IaZvyaWkFPN9bxSX9h4OKPHx3Wmksvi+PkLrH7yr01UNf7Td8nKt+sIMBh0310LB56eZA8X X-Received: by 2002:a17:902:6b49:: with SMTP id g9mr16928865plt.98.1549555491060; Thu, 07 Feb 2019 08:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549555491; cv=none; d=google.com; s=arc-20160816; b=uLLEToLcjKIyZZfS5yyh8fVADFqQVHBeKy9ZZKxHBtUQyx7k+39GBasnlbCoFwrx2B p0OUVcGDPMoQvjSOtKnG/PQoIBCODPybcAvGLMgT6huIZKWyNztfiO2Gq30/8Uve+zem VHABqQy29FTqYWZgrYMBOqaGAX7qeUutjaPtBhRmQvdeECD2ADz9JJDMO942YFAGNUSm rVyZOz0NYG53Jv7LEvcf+0jweX8cvtb98yjGRpF3a/rQW3CW57krNeruX2r3bvkBD84o AvoW+jv7jkzPUQVZJD8YHA7MaBSWt4zp62auSsA39InE3GgW1tD4LJnEkuxmmaUvNOgU yjEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XbhO6aTIpP/xPNM6je9v7tcpC/w9vjx4259+gRxRQwc=; b=jlP8CPOtJN4XDvVarfbsOA8inJq2uN8+RJgZBWWuX8IeYIDadxdsSpXVwEcnkQ+Iir z2N9xTE4SqNqx72qPNxM7H38m0lnjrJ99vKMtdxrFIAzPunsDBtmVLXNOTuvUIRz7O7w HXzBp51y0rELFiKBykZ7SzL/zN3Ulc5n+ewYFX3Db5vdMaLSm/qRtxkysO0N3TlAlX2y KU0LkQu9/len+HcjcHx/8TI0QAq33RgYI+FBO72shlo8UTix+p8PZUMAQgkNuY4mTVJb 6JA/VjixGzXxi/+M3Kqo+xNaPlBoE2aG/ekDwkJ8eAy42/+zHbaC79HNg/wSFgsAAB9y fpHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GjiAT/gI"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20si7840372pgk.323.2019.02.07.08.04.25; Thu, 07 Feb 2019 08:04:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GjiAT/gI"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbfBGQDD (ORCPT + 99 others); Thu, 7 Feb 2019 11:03:03 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46751 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbfBGQDD (ORCPT ); Thu, 7 Feb 2019 11:03:03 -0500 Received: by mail-lj1-f193.google.com with SMTP id v15-v6so267541ljh.13; Thu, 07 Feb 2019 08:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XbhO6aTIpP/xPNM6je9v7tcpC/w9vjx4259+gRxRQwc=; b=GjiAT/gIsh5Mq6FaeJOcXRPVS+aPNNLKdv+19jCUnMwmRGIdhLqn3qDw/4sBtvN8Hh ju5PXYuad3zjRdl4YnH6xybt7cBkrbmeOnKARIuUOVU23QxAGpMC+Hdo6To4YYz20SdN KcTwZZWk54YH7U7nqUwLwSjiM9GATvQyhZUXP3zIoYmhVtPcGhqivpfFt5hrHNrlLnxo tIyWz8GH0zeVk4l5jxYZ+30lNxdS11GYkmxBwZke/ifmkSt1cGDnrqxpSjof3u8Ym6Qe fsNkAS4OqyhqNSBKMi847x/GuItYvXS/zeCBaX1OV5BcJ5lVqZztpXRUYwokbPHyzTQT Yr+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XbhO6aTIpP/xPNM6je9v7tcpC/w9vjx4259+gRxRQwc=; b=dJCMO7DFrj/7ZWcVeZp/R/NDb54hpPlQ28PjSMsY8ufZATd+ULl+iYEaWYp2EX8kdR I4/yjNB3h9qIqNx9OupBUggnYuMqxkyBuemH5+hfNpxcWdmO3kyeliz/lMHz9HL/2xgV fLrw4QDJIcdLH8ghEDy4e49X6Df9hNEJWUeXZi1l0X/8YTvDJ6wc1Ctr07EvufUWsbvF aNTxqcgQDXQXTQ67qQ6KSakcnpBIDjXIC8HJ8VFoH0+1y1yXT6BSzsIRCtk2NppDKaqD bziCZz1xrlyaz6ZuBdIuvP1cZ0+t1XXrCq+KNQ+1UzZNERF6CwQvvYNfREKH9nR5CL/5 cq9g== X-Gm-Message-State: AHQUAub+W0EgHrE3WIMhaSVGOeHVvG1avIqNtyrJu/xLaIKO2p2w/h3h mKQX+W0SkFfdgszxMMVhBacmmMqD9sDmA+t1J8Y= X-Received: by 2002:a2e:858e:: with SMTP id b14-v6mr2729099lji.43.1549555380735; Thu, 07 Feb 2019 08:03:00 -0800 (PST) MIME-Version: 1.0 References: <20190131030812.GA2174@jordon-HP-15-Notebook-PC> <20190131083842.GE28876@rapoport-lnx> <20190207155700.GA8040@rapoport-lnx> In-Reply-To: <20190207155700.GA8040@rapoport-lnx> From: Souptick Joarder Date: Thu, 7 Feb 2019 21:37:08 +0530 Message-ID: Subject: Re: [PATCHv2 1/9] mm: Introduce new vm_insert_range and vm_insert_range_buggy API To: Mike Rapoport Cc: Andrew Morton , Matthew Wilcox , Michal Hocko , "Kirill A. Shutemov" , vbabka@suse.cz, Rik van Riel , Stephen Rothwell , rppt@linux.vnet.ibm.com, Peter Zijlstra , Russell King - ARM Linux , robin.murphy@arm.com, iamjoonsoo.kim@lge.com, treding@nvidia.com, Kees Cook , Marek Szyprowski , stefanr@s5r6.in-berlin.de, hjc@rock-chips.com, Heiko Stuebner , airlied@linux.ie, oleksandr_andrushchenko@epam.com, joro@8bytes.org, pawel@osciak.com, Kyungmin Park , mchehab@kernel.org, Boris Ostrovsky , Juergen Gross , linux-kernel@vger.kernel.org, Linux-MM , linux-arm-kernel@lists.infradead.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, xen-devel@lists.xen.org, iommu@lists.linux-foundation.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 7, 2019 at 9:27 PM Mike Rapoport wrote: > > Hi Souptick, > > On Thu, Feb 07, 2019 at 09:19:47PM +0530, Souptick Joarder wrote: > > Hi Mike, > > > > Just thought to take opinion for documentation before placing it in v3. > > Does it looks fine ? > > Overall looks good to me. Several minor points below. Thanks Mike. Noted. Shall I consider it as *Reviewed-by:* with below changes ? > > > +/** > > + * __vm_insert_range - insert range of kernel pages into user vma > > + * @vma: user vma to map to > > + * @pages: pointer to array of source kernel pages > > + * @num: number of pages in page array > > + * @offset: user's requested vm_pgoff > > + * > > + * This allow drivers to insert range of kernel pages into a user vma. > > allows > > + * > > + * Return: 0 on success and error code otherwise. > > + */ > > +static int __vm_insert_range(struct vm_area_struct *vma, struct page **pages, > > + unsigned long num, unsigned long offset) > > > > > > +/** > > + * vm_insert_range - insert range of kernel pages starts with non zero offset > > + * @vma: user vma to map to > > + * @pages: pointer to array of source kernel pages > > + * @num: number of pages in page array > > + * > > + * Maps an object consisting of `num' `pages', catering for the user's > @num pages > > + * requested vm_pgoff > > + * > > + * If we fail to insert any page into the vma, the function will return > > + * immediately leaving any previously inserted pages present. Callers > > + * from the mmap handler may immediately return the error as their caller > > + * will destroy the vma, removing any successfully inserted pages. Other > > + * callers should make their own arrangements for calling unmap_region(). > > + * > > + * Context: Process context. Called by mmap handlers. > > + * Return: 0 on success and error code otherwise. > > + */ > > +int vm_insert_range(struct vm_area_struct *vma, struct page **pages, > > + unsigned long num) > > > > > > +/** > > + * vm_insert_range_buggy - insert range of kernel pages starts with zero offset > > + * @vma: user vma to map to > > + * @pages: pointer to array of source kernel pages > > + * @num: number of pages in page array > > + * > > + * Similar to vm_insert_range(), except that it explicitly sets @vm_pgoff to > > the offset > > > + * 0. This function is intended for the drivers that did not consider > > + * @vm_pgoff. > > + * > > + * Context: Process context. Called by mmap handlers. > > + * Return: 0 on success and error code otherwise. > > + */ > > +int vm_insert_range_buggy(struct vm_area_struct *vma, struct page **pages, > > + unsigned long num) > > > > -- > Sincerely yours, > Mike. >