From patchwork Thu Nov 15 15:43:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10684637 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 8B0DF17EE for ; Thu, 15 Nov 2018 15:39:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79E5A2BD3F for ; Thu, 15 Nov 2018 15:39:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D61D2C9DE; Thu, 15 Nov 2018 15:39:44 +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=unavailable 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 1B8292BD3F for ; Thu, 15 Nov 2018 15:39:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B47F96B039F; Thu, 15 Nov 2018 10:39:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id ACE036B03A1; Thu, 15 Nov 2018 10:39:42 -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 9718A6B03AB; Thu, 15 Nov 2018 10:39:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 52A346B039F for ; Thu, 15 Nov 2018 10:39:42 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id a2so13131346pgt.11 for ; Thu, 15 Nov 2018 07:39:42 -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=k7YhP8SU7rzdO2cfLJKZnWQx6wMxbtBlZWcB8cpbHjE=; b=YRDH0Qx/TFIEsnCcZwPA3eJ0LQbiUzXViqUmtE64Y1csdXwwcPIQLLdabDcp7GMO5d 7kUcfXzNDzR5VN+6q+sez1UOEbH+bWWHYE3pv2LTMa7OEXqKYgjDR9dKSk1b/VmXioLw DAni4Hx3MRu7QUs9dhsKHGV7S06hIZO+s2GxoT7SonkQrQUMVK0Z3UPw315hwo4IyC9u LkeGfFH2k7V+LmxGkeDeTyyhmDne807OxA/uolxBkWpeudzGYytM4lNyFbwDk7IueIno K1ywJy1kAPUC03Pq/Oa6QrHPw5pbmeXdmmr1NBlbjFcsTCO5aQLWcclScMRAEl3bgAbU ur7w== X-Gm-Message-State: AGRZ1gIDA73lv6fLDEDnVc2Ienpj7stBX3K3C4/XiuotjgGoHHIYtFfC gob/jWnsSe6aJVs5tk6g8H3y1tYmRw/+ShD+Mb9Dd3+XmHV2a4B+hQcqH1YN849VxWGhfxxOzkQ HQoEE+GLoHyXcUI1syDcsrpD+B2T/EJQmyjWq4ZKV+jDm9gXd0jPpLebDK8jwKSuc82PvkpXR6Y fskbSpVu6xG/7Sc5CpD3MFjv+xqt90bgowx9uBIzK89lQaaAf4/RPkhVQxdJXs/31ht9/iSSTxB Ao4Za8mthddswmoqX6U5IYrEPbccjSLgVlbh32zBlpXAEuTDwroIx1zlHo6x74NfUYGAoCaoZuy h2QWjbY5bHlm75iYkJ2t59EnE5CToqvq1LOnEfpdsUb6dHtcuL05JW6zPF3vzVcypRAY4XJ9FSe 5 X-Received: by 2002:a17:902:d90c:: with SMTP id c12mr6891766plz.52.1542296381836; Thu, 15 Nov 2018 07:39:41 -0800 (PST) X-Received: by 2002:a17:902:d90c:: with SMTP id c12mr6891713plz.52.1542296380787; Thu, 15 Nov 2018 07:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542296380; cv=none; d=google.com; s=arc-20160816; b=mIHEMboY4S9dunKxH6tADfVwjb4IiXL5fiG3oTEfV7zc4UiHOyYC6t6QrQboyfdf3W /19pMNaoc1bpO7MW84+EE+5EybTISUuVEXRO7SjsJDxMl2OzrYH0itQmc4adIoS0vCJ8 4KrTaVCB7HRKFM5p/EmIa9q5J2LynSRb1JE+urnXCr7kZSDXRiAjyUM3fyPyMx3X1P4r LYdPVtgPO6HsspC3iHLq8bRsF7dTneTdj+a2uL8ZfmH4vWT5KfCQhOZDJk5fvF+xPijm RuXEwQ57OBICi4Vtg6untQKOC5Ad2RtH22FnUK8oZrWEsepVN3pJOm1ecZM3h0gBdnRy FtOg== 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=k7YhP8SU7rzdO2cfLJKZnWQx6wMxbtBlZWcB8cpbHjE=; b=GbE1enl+feqFWr0NjezuOwzW2npguoNoX9fS5sxVlt8YNLIqRGLKhzq7EMuVJiuyYi zqUomqNMzyghPVOGlJhIg9qTDYiOUP1AGO/GGwhHB8iITwm6BrqE9+pAHsxFf3t3F5u1 Um3t02OIEdFkr+hrG8mIXTzqIVI2D6Tdi4WDtWFE9OfvrxKwLh4kWYPvYcLlCiu7GVRv iyiVX87buhhXtc7u7M3RoIU7iQQkkDffgUJwLDNRuK1KV14eFGV2dEqLOOzcdoiCWAiT QNxsz6GSH9xUodOByiDAAoYOs2NfKlkICCrLW1hgb+vbmFncbqKP6lFIobohY8Lb0rmV 0B4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PhLumYCa; 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 d2sor4761641pgc.58.2018.11.15.07.39.40 for (Google Transport Security); Thu, 15 Nov 2018 07:39:40 -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=PhLumYCa; 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=k7YhP8SU7rzdO2cfLJKZnWQx6wMxbtBlZWcB8cpbHjE=; b=PhLumYCaR5dQAx+R6tkONFpiyswMbRUWcrJ1mQjfmmA1SGYKUYbEOJQPQ2AK3kq3+4 IOM8sAzHrjxeOrirmUAbMn+zo6vimswT13HtlD/k7BpW7rYEktbU75JenrU9hPrPcfkJ 0hsrJyA9uvibiIr+3HazOg04EOnnuyAajTtL06ZT6Gc7OM0sqsXU8LW/VvDhG2KG+g20 hxYA3+ORfxC3D+nCoAi3p27ztW+Jdoe++HvPyWK+a8Mk9FOGZI0SoA616D1yZmhGzZPg o+HFiO6NeG/FJ0NC4nLc1yDOgrM3IJKgaTp8cfOmC+4sh15lO9EqOt8SXB3TaAxccWxc c3Rg== X-Google-Smtp-Source: AJdET5dFBMDj1krLNWt58fbSZfUFEu9jXazKuDbFpNQ7sH8hvnircMBzVteGRl8Y5b94E1Pkm8aUyg== X-Received: by 2002:a63:4b60:: with SMTP id k32mr6176757pgl.186.1542296379954; Thu, 15 Nov 2018 07:39:39 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.97.233]) by smtp.gmail.com with ESMTPSA id v12sm29037162pgg.41.2018.11.15.07.39.37 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Nov 2018 07:39:38 -0800 (PST) Date: Thu, 15 Nov 2018 21:13:14 +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 0/9] Use vm_insert_range Message-ID: <20181115154314.GA27850@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. 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 | 12 ++-------- drivers/media/common/videobuf2/videobuf2-dma-sg.c | 23 ++++++------------- drivers/xen/gntdev.c | 11 ++++----- drivers/xen/privcmd-buf.c | 8 ++----- include/linux/mm_types.h | 3 +++ mm/memory.c | 28 +++++++++++++++++++++++ mm/nommu.c | 7 ++++++ 11 files changed, 70 insertions(+), 98 deletions(-) Reviewed-by: Boris Ostrovsky