From patchwork Thu Dec 6 18:37:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10716593 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 778DA15A6 for ; Thu, 6 Dec 2018 18:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 677B12A29C for ; Thu, 6 Dec 2018 18:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59CB22A7AB; Thu, 6 Dec 2018 18:33:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D722A29C for ; Thu, 6 Dec 2018 18:33:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E65DD6B7B5D; Thu, 6 Dec 2018 13:33:50 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E14CE6B7B5E; Thu, 6 Dec 2018 13:33:50 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D04436B7B5F; Thu, 6 Dec 2018 13:33:50 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by kanga.kvack.org (Postfix) with ESMTP id 89AFC6B7B5D for ; Thu, 6 Dec 2018 13:33:50 -0500 (EST) Received: by mail-pl1-f199.google.com with SMTP id m13so810185pls.15 for ; Thu, 06 Dec 2018 10:33:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=//xM5ckHQpjH8DRY7QjxQr9OahBeTL/2OYhSA/2ZlVM=; b=afYBk4SRXiOON5cG6+gR+xRTBKrNVo796LbS+J5VhrxJz9nnRK7NnvHfY7bFj/5Jci VTlB+Op4yERUsOXZvWmfSkclw09ZFyTIbwAnbArhFxpmwTBpZ7mRPNt7jlAEa1jgert/ wbnNSePUYRDagLD1NsyMatZ1I3IqVQpWeBF6KJT05FZx5W22E4MN5h3mJpOFMdErkr2V zmZzaioMoMo5r2Nr+svhusaRsWxWHzj9TJmeqh4/d2Ga3j9lgZBnb1LpZW2Ctx/H0x8L yqlvRpcLoGxyVgvNmDZMzttZ0AO8FltzexBh+N9Ae8pqJpndu/evUGSsbZCg0KVJMGmO 3rmA== X-Gm-Message-State: AA+aEWZEZHu2i6ijUl1fa5mQQ34QtLdAGb7KueIha8H3w41Lo++XB14a xdlto+VQ3XGrdhQCTNWQO2whsNfI5hDk6Af577JMneTp7PZYzf99ZC1sKGoMac3J3LatpTCPjO2 ctjGDuFkxzKA7lhVf3pbr5BgrD4yz7t0K0RyeButpQPSJZY00rMgaLdzU0db1c4D4hhqrtHXyyK AjxB82f2TkIXwFnkiB9zvL2zcBB/dyyiMgQqPrMY6Cl9eUpvQHdu+ToWIz9DSgVvelYqNhTbLMv hn122Aqp7EtE3CdQhAgreGmtr4IUS6Gor8gSJRTKEjbDuu7sDY5MAFUZ5AWhx67UvIiel0US61X Y+Kthuh5krbGzV8D0U9OMNO3ur5Z2u/SVh5UHyozRvg0ignAUYlYP5kANX9Y+9gmXrsz2N41A2n 5 X-Received: by 2002:a17:902:108a:: with SMTP id c10mr29725376pla.131.1544121230090; Thu, 06 Dec 2018 10:33:50 -0800 (PST) X-Received: by 2002:a17:902:108a:: with SMTP id c10mr29725320pla.131.1544121229089; Thu, 06 Dec 2018 10:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544121229; cv=none; d=google.com; s=arc-20160816; b=z7DNX89OqQytel5g2J7d9MS1k3P3nBzI3gTMAI0BLbv9/NRiaIKtJ7j7qTQmUTBZli Rek4IEkYi/fbDlN9nTiqA+mgbsgimXw1S9Nj+ivFhqhxEyqKIhY1kb8VopyPeTKe2/Dx sJe7L+Xxo/Dh/SFGSu7P+uuNy+crd16k019vEmjWUHiOaN0T5FwrOy4Tn0RZw5FttR8u +P5lfjbHDPmUpSFPVlW2SQRBHE1s78q/EeWnZj7OO76UqI5M546j4VmMVLF7JAbiVxra TMyhVvKx3zirQSXBEv7aq2IEKFibQw2popE5qICgdE1WNCjAbqQfUjOiGS4/Tu38WDym Lr7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=//xM5ckHQpjH8DRY7QjxQr9OahBeTL/2OYhSA/2ZlVM=; b=ZBTHsj35n7kwGDY3tuQpta7kO8NTx+g/uErve+Y8YljqIYTVIh9vkQbpinOW5oCQ9x WXg7Z5KcQcadJ/P5+VJpRFUMsMlaPqLurNpFDuk6VKkKWrtn+7MAN4CLdGp/P6tO8O5j p/PDbNNyd78c1VKWDQJ+gSx0Xbx6+O51aa08wGkGj0CeJSHvbumT9IgMZc6fFOXDJuvK vA3oD4Q1Lc0QpZ7E0nMTuPed+5R0/oPfs4R8EyFr6NuSKdtfyFVtT/1qEoBzgbTS2sPO 8e19dqiNxdBkwI775oxKxAIPhznrsxPKFStp8amvak5LalzAlokB0XOityA/VU3G9Ibf 9qgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=davkmg1r; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id i10sor1821967plt.38.2018.12.06.10.33.48 for (Google Transport Security); Thu, 06 Dec 2018 10:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=davkmg1r; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=//xM5ckHQpjH8DRY7QjxQr9OahBeTL/2OYhSA/2ZlVM=; b=davkmg1rht5+CKYgw8LgltjJ8cvgRpcvOtjPkNdysxNTmHbV7OvchtIoVQymYDgKTz ZQuAz513k8SnYKXR4Bd3jxCfrxiBLQFcHMpmTADwHEyZ5v3h6mKWIWpro9HOf/FhdhIO pq4A04jwaORyVvTOXpgO/5jxEBR/QNHfHJo38BYfiMw+CuQvRyUdois//LrihhvKbkUC IwbNje16unuPJk5Iy+JnYzEmgRIP3vzqLH+2EBbhZYK0rPgXANen8CrSLHkgl2GabRvE JWEntG18tba6aGPTFpcj4sfRCohVeAKRRalaqTEow7MOE778mEZF+co4fXCA/Ie1LAH4 m62w== X-Google-Smtp-Source: AFSGD/WNnGiapTEJ46Ed5/Z/wawNX1AN/JF1DLHSpN0c5ocfxsOQRaK395FOtJYxrGm5y2+oYNYISQ== X-Received: by 2002:a17:902:e10a:: with SMTP id cc10mr14834670plb.165.1544121228581; Thu, 06 Dec 2018 10:33:48 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.99.39]) by smtp.gmail.com with ESMTPSA id g65sm5281319pfa.63.2018.12.06.10.33.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Dec 2018 10:33:46 -0800 (PST) Date: Fri, 7 Dec 2018 00:07:33 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, kirill.shutemov@linux.intel.com, vbabka@suse.cz, riel@surriel.com, sfr@canb.auug.org.au, rppt@linux.vnet.ibm.com, peterz@infradead.org, linux@armlinux.org.uk, robin.murphy@arm.com, iamjoonsoo.kim@lge.com, treding@nvidia.com, keescook@chromium.org, m.szyprowski@samsung.com, stefanr@s5r6.in-berlin.de, hjc@rock-chips.com, heiko@sntech.de, airlied@linux.ie, oleksandr_andrushchenko@epam.com, joro@8bytes.org, pawel@osciak.com, kyungmin.park@samsung.com, mchehab@kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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: [PATCH v3 0/9] Use vm_insert_range Message-ID: <20181206183733.GA17240@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Previouly drivers have their own way of mapping range of kernel pages/memory into user vma and this was done by invoking vm_insert_page() within a loop. As this pattern is common across different drivers, it can be generalized by creating a new function and use it across the drivers. vm_insert_range is the new API which will be used to map a range of kernel memory/pages to user vma. All the applicable places are converted to use new vm_insert_range in this patch series. v1 -> v2: Address review comment on mm/memory.c. Add EXPORT_SYMBOL for vm_insert_range and corrected the documentation part for this API. In drivers/gpu/drm/xen/xen_drm_front_gem.c, replace err with ret as suggested. In drivers/iommu/dma-iommu.c, handle the scenario of partial mmap() of large buffer by passing *pages + vma->vm_pgoff* to vm_insert_range(). v2 -> v3: Declaration of vm_insert_range() moved to include/linux/mm.h Souptick Joarder (9): mm: Introduce new vm_insert_range API arch/arm/mm/dma-mapping.c: Convert to use vm_insert_range drivers/firewire/core-iso.c: Convert to use vm_insert_range drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range iommu/dma-iommu.c: Convert to use vm_insert_range videobuf2/videobuf2-dma-sg.c: Convert to use vm_insert_range xen/gntdev.c: Convert to use vm_insert_range xen/privcmd-buf.c: Convert to use vm_insert_range arch/arm/mm/dma-mapping.c | 21 +++++-------- drivers/firewire/core-iso.c | 15 ++------- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 20 ++---------- drivers/gpu/drm/xen/xen_drm_front_gem.c | 20 ++++-------- drivers/iommu/dma-iommu.c | 13 ++------ drivers/media/common/videobuf2/videobuf2-dma-sg.c | 23 +++++--------- drivers/xen/gntdev.c | 11 +++---- drivers/xen/privcmd-buf.c | 8 ++--- include/linux/mm.h | 2 ++ mm/memory.c | 38 +++++++++++++++++++++++ mm/nommu.c | 7 +++++ 11 files changed, 80 insertions(+), 98 deletions(-)