Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp527557imj; Thu, 7 Feb 2019 07:57:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IaAfePEx/akqvmK7u95ckzTqvmDVx+nTJYwSR0Qt0JR4rRSYTryeRKFXJRAK+NZLZ/b/sCf X-Received: by 2002:a17:902:bd0b:: with SMTP id p11mr17180014pls.259.1549555071289; Thu, 07 Feb 2019 07:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549555071; cv=none; d=google.com; s=arc-20160816; b=yTyH02rymR+guhJbH+90wl5haPc4iE/ifdyZTkGD1c83O9EcXY2God8gb9YCMQ/sOt NUo0+2mX8IebThYEGNNSJz//Tx5/gghLF3PhsCl0JHIhJE7lM4GWm8UHR82xK2cxfSVV sHzNE5T1TpePJZVFCb6m3QN5uYRsubDZwBG9hf5l/Qgus0InWz5vjwTM5fsQbDjehTmH xO2zqXPenj1XrySmGUtcBfkbRHHU1G2hr0pNFz+6iLYVGfXSiVp75hstGE6ZtTsyKJuA BCv0qe7IRNtGwxhoP2s9+QzIDOIpb13uliT8HcNUJmmTbTmUx07CH1mp1oUoYbJuqXgi 1JpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=CmCtoBkBCzvg1xjMdtTGtAInUWo0XqKmbWRHvqbc+oo=; b=wJwlfnwTZHkXmKfFxbRB2Iq+Ao/C10WzL/ZG5qWoedAcuxC0o4RJvpCzBSOgZvV2Mi M1pDjDr2LnbKd3Mhg0Pj6gsiwhfY5GlOnAq/dogZsXY6HPboLgf8LY8jfCXJdDJmy77U JlvsT8qEqiUOxPw/i978a8ctqlTAOfvEyhkUirXitPjWpTnb+uSKpMIRve/uVgWSrF5H AzQN22VMJQl4pfK7xN+ofLBvAwd1VnyUGZlGFf04Wwvrx/JXba8HpCFavXO6RwWDW8p4 XlkW3SCxKhPB7yBTF8qym2AuX7KVTp5U0SrAB1tbJNZG+P+BSdVYN+LK4hzFIOWxoG/1 /lkg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si6773675pln.27.2019.02.07.07.57.34; Thu, 07 Feb 2019 07:57: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726707AbfBGP5U (ORCPT + 99 others); Thu, 7 Feb 2019 10:57:20 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58838 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbfBGP5S (ORCPT ); Thu, 7 Feb 2019 10:57:18 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x17FsFmR087391 for ; Thu, 7 Feb 2019 10:57:17 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qgngp7973-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 07 Feb 2019 10:57:17 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 Feb 2019 15:57:14 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 7 Feb 2019 15:57:05 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x17Fv4Jg58785802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 7 Feb 2019 15:57:04 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 826AD4C044; Thu, 7 Feb 2019 15:57:04 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C3454C040; Thu, 7 Feb 2019 15:57:02 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.84]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 7 Feb 2019 15:57:02 +0000 (GMT) Date: Thu, 7 Feb 2019 17:57:00 +0200 From: Mike Rapoport To: Souptick Joarder 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 Subject: Re: [PATCHv2 1/9] mm: Introduce new vm_insert_range and vm_insert_range_buggy API References: <20190131030812.GA2174@jordon-HP-15-Notebook-PC> <20190131083842.GE28876@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19020715-4275-0000-0000-0000030CB409 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020715-4276-0000-0000-0000381ABD69 Message-Id: <20190207155700.GA8040@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-07_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=774 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902070121 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > +/** > + * __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.