From patchwork Mon Dec 24 13:18:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10742243 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 4247B13A4 for ; Mon, 24 Dec 2018 13:14:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2202228AAF for ; Mon, 24 Dec 2018 13:14:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1579D28AD4; Mon, 24 Dec 2018 13:14: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 9CA9C28AAF for ; Mon, 24 Dec 2018 13:14:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EDD28E0002; Mon, 24 Dec 2018 08:14:50 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 39BA28E0001; Mon, 24 Dec 2018 08:14: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 2651B8E0002; Mon, 24 Dec 2018 08:14:50 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id D6C0D8E0001 for ; Mon, 24 Dec 2018 08:14:49 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id l9so9887490plt.7 for ; Mon, 24 Dec 2018 05:14:49 -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=6TaUtlS7TeG92dcvMBbOIZkMmLyB09aVGWNeeSIZ3pY=; b=HOYglKe3FooC4mK0gj/5ctuQQ4HZcJADhKqQWeWXdQ+Vq4EXORTsmIRqO3C0UXd0NB ICaI8OzqVmd2OQv8PuH+1W17eDNdv6fQmgdoWqfW/LeZjp6qyY81QlS+LhOa9/RgJJvP CrE5J6hE9Ir3/+VGuGk88w51Dic1HwjvE6D8PvoCKFwXk6+nZl7D609ouG/uF81Dttpj f2o3f0T13no1lEyhnNI2Ann46veaeEfbHzGy2h4cFPEeG0EqBU+o7Zqzu5DmU7WwUYE4 HKES9pgkTYyI0imwF5L8HyNdjYrxh9ggpW2k3UAGGNnBp7ajKUxrIVMKp7w5/gxHMq7r xezQ== X-Gm-Message-State: AJcUukcWxuljK14Nyl7i7yKhkgrFwoB87q605zAsT6YRr3z7ODV+tp9C NfmkWEZOIZbhzXjEGtOsVh0Iq2vEutWKaoRBf4KV6CC5LgCGZfqffVXsEN0WKEXTXGNgKd6uJiF iWBsuWoDswthIHTVy9FwUZSGFIa3F+fEGXPMGqbC+aSlFjlcMeGyrClsT4ZupVnLrk6Jz+heIZw Sk5nhjcMmM8Gk77GHkh0mYMdiUbW+UjZ1Zvjls2n6H1ydFAhB1SW7zGolnDRzVCkEcwaTP4IYG2 HeEK76PcKkN+jJSI+QJFjkttUtSVHgK6FyJ8//jxrlWO+H+uZ0CrBpqQc4RUTKv7FUNF0lvzpil vOAgiJ43PCfVd+SD4SbrF4z8Uc0GwpWvATxQfySAvwF3H279yLfm6v0VX11dYbSPMhxHEefvp0u + X-Received: by 2002:a63:2f07:: with SMTP id v7mr11588648pgv.368.1545657289288; Mon, 24 Dec 2018 05:14:49 -0800 (PST) X-Received: by 2002:a63:2f07:: with SMTP id v7mr11588582pgv.368.1545657288069; Mon, 24 Dec 2018 05:14:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545657288; cv=none; d=google.com; s=arc-20160816; b=feXf6n6D96wvk7/eAPSJFBC5ddCci/NNAcLH0Iyaol6qSsw/Exd0kPlAhQVOEBsSY8 fTUJ6Ack5bWX2cQDd4b2IBTiLsdlVLv5+Es+IIyRUJ2XRnHQAA11XU5k+4mkoL2ONz/g 0yEpaZtNkIyEokAagWetgWXgdZMqv87moXP/efXdq4e1KkEUQleP4x024MvjQhp+k+Fe vnDrC/fB8Yu7ud0Dy15ZWnRicG5kMiQlROkNU6X2r7X5sDlKMXKGvciA0MpmXUfuw0iY rcdB6LguHGxnHFP3317ZH3EP3BMBzM7KCAlXsCvpOufvtqnnxivZit2z14rgbo3fuRg5 3D3A== 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=6TaUtlS7TeG92dcvMBbOIZkMmLyB09aVGWNeeSIZ3pY=; b=VGuofZldFD7mMGAieOHs6QJfLeyQm0e8Us7u/wiQEP2oH32uyTCZJxNCKGb/8UPzi2 H2fekEP2BGM5C7sXGMm+kyyjQ5qmyngVb66tajJxqnPe7yJ91REGjR8DFdlrmViyOhn8 sk4crPC4Yt1ZZUmDfYn8INFWGF24KjFvSkQk6SKgwtF8jXspTHXd4haXI+8wDeM4161/ rHAU+0UADCs9JT5680NhtrjGnA9xDu5J/ksQkctNI/CdS4t0d+ybszA0mTgRE1F+rpxs pjqynep7ybMhTYHEP2C2hlIX3MKDjH1j6w4DfdFWWMqZec5Pso0xN7V7ftcPSnm0EEaw pPmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d3Xd7Mol; 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 e188sor51650919pgc.19.2018.12.24.05.14.47 for (Google Transport Security); Mon, 24 Dec 2018 05:14:48 -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=d3Xd7Mol; 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=6TaUtlS7TeG92dcvMBbOIZkMmLyB09aVGWNeeSIZ3pY=; b=d3Xd7MolqeTIJQoUjbD+4dweIgr48eZCrq7SBO35pR2Fitu8erEje+Llq96kKgTaNn XPfL1CGWAPc7da/LB62zDpZpORWDHnIR2BjFHRYQyp/+KXF3M0iEvByaht2KpWbLTUSF V5VIWYbIwhP1dfjMui59FMP3G4zVM2NSpfC3wkJA8wA1dfEWXoaUbndmy158JAQbEGV7 1LyOQUqQV9Fgk9ZJ2ZCooYItc9QCHKk8jFkB0A+5yNHmPj3XbGdD3KOM6XxI3ib20uxc huNf3L3JPnlFZI3UEuFbedEqb1+lenfo3/eTH4iLnBykOZCUZ8fzgmdmLqU+O3hztuVF QY/w== X-Google-Smtp-Source: ALg8bN7YE+bPCsEF6zRIwsShrpUAZIueHQ2KAFb4fOzxweLzlSCbHbZrB8/PRrputEX6DLtFQp2qqA== X-Received: by 2002:a63:e40c:: with SMTP id a12mr12404213pgi.28.1545657287533; Mon, 24 Dec 2018 05:14:47 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.18.181]) by smtp.gmail.com with ESMTPSA id q1sm49507262pgs.14.2018.12.24.05.14.44 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 05:14:46 -0800 (PST) Date: Mon, 24 Dec 2018 18:48:41 +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 v5 0/9] Use vm_insert_range Message-ID: <20181224131841.GA22017@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 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 v3 -> v4: Address review comments. In mm/memory.c. Added error check. In arch/arm/mm/dma-mapping.c, remove part of error check as the similar is checked inside vm_insert_range. In rockchip/rockchip_drm_gem.c, vma->vm_pgoff is respected as this might be passed as non zero value considering partial mapping of large buffer. In iommu/dma-iommu.c, count is modifed as (count - vma->vm_pgoff) to handle partial mapping scenario in v2. v4 -> v5: Address review comment on [2/9] and [4/9] In arch/arm/mm/dma-mapping.c, added the error check which was removed in v4, as without those error check we might end up overrun the page array. In rockchip/rockchip_drm_gem.c, added error check which was removed in v1, as without this it might overrun page array. Adjusted page_count parameter before passing it to vm_insert_range(). 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 | 18 ++++------ drivers/firewire/core-iso.c | 15 ++------- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 14 ++------ 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 | 41 +++++++++++++++++++++++ mm/nommu.c | 7 ++++ 11 files changed, 83 insertions(+), 89 deletions(-)