Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp538536imj; Thu, 7 Feb 2019 08:06:36 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib9VHtPDb4YNQcxJC3aLxLu+u2dxvLJxcWwhe//S8XTGmvtIEPo6d5u45rcWWJOHn51OtIE X-Received: by 2002:a65:4507:: with SMTP id n7mr10565392pgq.34.1549555596717; Thu, 07 Feb 2019 08:06:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549555596; cv=none; d=google.com; s=arc-20160816; b=uCPfDru1dC9lROJY2H8E0cYU9P2M8TrQ8OQy/KZUtEivI8tNI8iOT42AvK8bHZixUQ rtOgmRehKbIVCSQegfaj0Iuo45R0Z8llxiz4Lv2QNr8DSDVVKgg5XptSGEswHs7LPyqN TiRiKqvAg0Gr4q6Typ6W+WW/wnGVMZ4W3WzVpIBmoBcn8uES7kgVTMVYmpmmA4/e3aBT XvrKagT7ZUryW2kyksUVkpyAc0TaRbzVzHCmL0E8jqGDn1M7OC2EJBhfF5oQBTrvw8Em X54fCcmMJsEE5WEkbDq/M0kPLUuMhdrRHOjkz8l3dYdpuZLFk7AMr5BHUiTgesvcS7N2 M+5g== 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=63d+u1u7A065ck32eOMqOzgO0ToTxA9DRZ01BIxAvWs=; b=YhukCbY/DvfmPQX0UWq8rf0yti9hRHGUSLWxpOq8U9EeCJWhC80yR4D0zO1nEPI0Cf /gcQutpSd/defu7kq8lSou/96w3E0+PIVZttQdXEDpy19wCKYFs5QsfCunv/XUa4jaDu Cr/Olj9X9PHweXJ2MgYcO7axB0HlKcXZTlfA2twe5ffJvIgVAheGNiMEQg68SOKMkG72 /vwQ2ELBXziE0v8PsXKjCZ0ebviDKtUIunvwSNV8NYuagqB+jGVOSs54/YGJsEJHGcxV LLwTDrXoXSJ2Mj34DGFDJVTv259DkB1i189TOjYYt6Ve9gbDGUdQTeLGyAD+nmt1OcG2 elAw== 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 i12si2833213pgs.59.2019.02.07.08.06.16; Thu, 07 Feb 2019 08:06:36 -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 S1726747AbfBGQFn (ORCPT + 99 others); Thu, 7 Feb 2019 11:05:43 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57000 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726319AbfBGQFm (ORCPT ); Thu, 7 Feb 2019 11:05:42 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x17G5bPh125582 for ; Thu, 7 Feb 2019 11:05:41 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qgqfashjt-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 07 Feb 2019 11:05:40 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 Feb 2019 16:05:04 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) 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 16:04:56 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x17G4tNl8913356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 7 Feb 2019 16:04:55 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E367211C058; Thu, 7 Feb 2019 16:04:54 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79A8F11C052; Thu, 7 Feb 2019 16:04:52 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.84]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 7 Feb 2019 16:04:52 +0000 (GMT) Date: Thu, 7 Feb 2019 18:04:50 +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> <20190207155700.GA8040@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: 19020716-0028-0000-0000-00000345D191 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020716-0029-0000-0000-00002403E2F7 Message-Id: <20190207160450.GB8040@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=971 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902070122 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 07, 2019 at 09:37:08PM +0530, Souptick Joarder wrote: > 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 ? Yeah, sure. > > > > > +/** > > > + * __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. > > > -- Sincerely yours, Mike.