From patchwork Wed May 17 19:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13245600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 073F1C77B75 for ; Wed, 17 May 2023 19:25:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87492280002; Wed, 17 May 2023 15:25:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FCCA280001; Wed, 17 May 2023 15:25:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64E98280002; Wed, 17 May 2023 15:25:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 545C6280001 for ; Wed, 17 May 2023 15:25:43 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 27F73A063A for ; Wed, 17 May 2023 19:25:43 +0000 (UTC) X-FDA: 80800726524.24.712D81B Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by imf27.hostedemail.com (Postfix) with ESMTP id 3C3FD4000D for ; Wed, 17 May 2023 19:25:40 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="jGTRNaT/"; spf=pass (imf27.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684351541; a=rsa-sha256; cv=none; b=ESOfJ14ySR3P2bJYJGIyfDKVwRXdoU6erJoSKAUdVZMVctmr2BEbgm7+RufrHuwm+y21ts imR/wojGsF8KwTlVLVC/B5TKFoZrxwfUWr5T5ZQ7rgVKVfh0u4DrbczHG1FmVug9AW/PMm lefdkErDAxau2BvoafD+86BCjMx4aSU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b="jGTRNaT/"; spf=pass (imf27.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684351541; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=S3weABmS34nZVMLJo+XTzwZMXin1WTjGdDKVc/7JR4E=; b=LTnNdUITxfgGzsqNUaMeITIlD2l8f3nOTb/LU//196b1B3OhaSSJF8TU3Ae11ZHbYlDyTn F0/p3nkqIt1jIVKwzkuvXWFR8MQW5QH6EQKw14hMYY+LtyhhURQ//5yZkQEg+7rhMTuPEI CdxoRirGbaVerFXGCrnoHkorsQBv9qI= Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-30636edb493so296626f8f.1 for ; Wed, 17 May 2023 12:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684351539; x=1686943539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S3weABmS34nZVMLJo+XTzwZMXin1WTjGdDKVc/7JR4E=; b=jGTRNaT/LTEfefiq7iqw5TaJTPZA9TvIW3MjtLorKW+Kvhvp856nVPG5cbioprbYxW /1gJIPovKpgZj//NU8LN58hvGAl9o0TeOmswwjgR3g+OAR/02RTQtyaXz2b/YGkqVosZ 6hsrlRZVEvvFxPLck4msRzdPTPsf3m2WXx7T13x0VCG4M0mW/wr55sxmbQSTnd7YYheo vQujQxPFUYm7HVF1F1sW21FscyTgGBy6UrtT6V5kydLfRh12iqndOBJOMXpYaHJWHt4Q AZvImUUAbB5UT1lEZFAFTBzcRayTpDXVrTX416cenJYX7bP0DZ8GK1O/VM1RVqG+2Bug lavQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684351539; x=1686943539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S3weABmS34nZVMLJo+XTzwZMXin1WTjGdDKVc/7JR4E=; b=WxjRUbuvrvTIZZwGgK09bYod/0ZokxJ5CGLoqb35PlDe9XqSpW2Sot5xAWXFHear2R Kvn72z2lNPYi9HN+JN9+tiVE9qpvIklcVGEfU+QfPlDcspd2ZJcVuztR67kWFAoU1mpB GndZ9ZALkJk1nNKiA09LuTK+o589G1JHJPzD3zy7QuQpCBv1NlxzgvduWCbuNBKPeW1y E8+8yeF9yHBzqIRxgDQOL08vfwMgpbB448yfB98VIt7CiUquGoaNMGzLOlmh5almczZk 5/7XXk3krQ/JiaBsy/Q5YcpFLauyyo1KciEXm8kzr1NnMHOkDuS5TJ+yTXafS0AkkCiw HoXw== X-Gm-Message-State: AC+VfDxQuIrudOZ4KuEEDJQHJPWX6AQHfM+gM8kRJ/PktGFcX/xFUptp Q6eHt1ug6WV4LcVUTx2kPAWMCAoQk4nwdA== X-Google-Smtp-Source: ACHHUZ41Ld9JgKrYrlAx6gZJdD/qq/cESCQqKPp4/u9Jh+7PIgc4GjZmT9TPDR7j6Hx7/rIs3UxZoQ== X-Received: by 2002:a5d:528a:0:b0:2fd:c315:bb2c with SMTP id c10-20020a5d528a000000b002fdc315bb2cmr1331031wrv.22.1684351539048; Wed, 17 May 2023 12:25:39 -0700 (PDT) Received: from lucifer.home (host86-156-84-164.range86-156.btcentralplus.com. [86.156.84.164]) by smtp.googlemail.com with ESMTPSA id t2-20020a5d5342000000b00307972e46fasm3588386wrv.107.2023.05.17.12.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 12:25:38 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , iommu@lists.linux.dev Cc: Matthew Wilcox , David Hildenbrand , kvm@vger.kernel.org, Jason Gunthorpe , Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jens Axboe , Pavel Begunkov , John Hubbard , Lorenzo Stoakes , Jason Gunthorpe , Christoph Hellwig Subject: [PATCH v6 2/6] mm/gup: remove unused vmas parameter from pin_user_pages_remote() Date: Wed, 17 May 2023 20:25:36 +0100 Message-Id: <28f000beb81e45bf538a2aaa77c90f5482b67a32.1684350871.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3C3FD4000D X-Stat-Signature: tinxcrez9rzcmbhtm5af3cjmw4f85qkx X-HE-Tag: 1684351540-114910 X-HE-Meta: U2FsdGVkX1816V4dsJdCw0OrReBreJ/39fOR9XjLnyunENpWl8BtmNBoZmfQt354iXQdR88LhX2g+Z/C6XTXX5IuCPKBgSzm653EJFmV1cBzSlnyn9DtpNxROlDKF5p6fF+qblmB+a8wL8qDt/MY/3PGFeRsK2/Lo5Clk0pdqFZypcJx1oFl/fuRS+SxvFUyBcI/LWkgr5IswcM+0sjrRP+xC2vMuy34T7O13/usgzaH/tIfM84O8324SBCjwVYFJrgKlFGKuWXI9xxVbqgN4sHxwjaD4pW4VRZ0tDvvXAMxwe4vOykCgrhb74/cVEHz+PK8BNSFb5zbFWh7HHwmY2DwZLVX0wfsoq7EeB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JnqK+dIu1LYtPQhBlgsbDBSc0jrMeG8xLJWNB7ZMgim0ybnC7Isj5Ta/fibHFAuFB9k9CB44iG+OUe9/5MgXYUs2xJoOjZfozG+ArG5YqNbpeetWAUUmX47o3KAT0BtbBh4kbKRpQgwFYuadYENIWrEzXtUTP4zzF6aMU/pB/oy6RvWRLUPdjE= 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: No invocation of pin_user_pages_remote() uses the vmas parameter, so remove it. This forms part of a larger patch set eliminating the use of the vmas parameters altogether. Acked-by: David Hildenbrand Reviewed-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig Signed-off-by: Lorenzo Stoakes --- drivers/iommu/iommufd/pages.c | 4 ++-- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/mm.h | 2 +- kernel/trace/trace_events_user.c | 2 +- mm/gup.c | 8 +++----- mm/process_vm_access.c | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/iommufd/pages.c b/drivers/iommu/iommufd/pages.c index 3c47846cc5ef..412ca96be128 100644 --- a/drivers/iommu/iommufd/pages.c +++ b/drivers/iommu/iommufd/pages.c @@ -786,7 +786,7 @@ static int pfn_reader_user_pin(struct pfn_reader_user *user, user->locked = 1; } rc = pin_user_pages_remote(pages->source_mm, uptr, npages, - user->gup_flags, user->upages, NULL, + user->gup_flags, user->upages, &user->locked); } if (rc <= 0) { @@ -1799,7 +1799,7 @@ static int iopt_pages_rw_page(struct iopt_pages *pages, unsigned long index, rc = pin_user_pages_remote( pages->source_mm, (uintptr_t)(pages->uptr + index * PAGE_SIZE), 1, (flags & IOMMUFD_ACCESS_RW_WRITE) ? FOLL_WRITE : 0, &page, - NULL, NULL); + NULL); mmap_read_unlock(pages->source_mm); if (rc != 1) { if (WARN_ON(rc >= 0)) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 3d4dd9420c30..3d2d9a944906 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -562,7 +562,7 @@ static int vaddr_get_pfns(struct mm_struct *mm, unsigned long vaddr, mmap_read_lock(mm); ret = pin_user_pages_remote(mm, vaddr, npages, flags | FOLL_LONGTERM, - pages, NULL, NULL); + pages, NULL); if (ret > 0) { int i; diff --git a/include/linux/mm.h b/include/linux/mm.h index 2c1a92bf5626..8ea82e9e7719 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2380,7 +2380,7 @@ long get_user_pages_remote(struct mm_struct *mm, long pin_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, - struct vm_area_struct **vmas, int *locked); + int *locked); long get_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages); long pin_user_pages(unsigned long start, unsigned long nr_pages, diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index b1ecd7677642..bdc2666e8d39 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -406,7 +406,7 @@ static int user_event_enabler_write(struct user_event_mm *mm, return -EBUSY; ret = pin_user_pages_remote(mm->mm, uaddr, 1, FOLL_WRITE | FOLL_NOFAULT, - &page, NULL, NULL); + &page, NULL); if (unlikely(ret <= 0)) { if (!fixup_fault) diff --git a/mm/gup.c b/mm/gup.c index b8189396f435..ce78a5186dbb 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -3243,8 +3243,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast); * @gup_flags: flags modifying lookup behaviour * @pages: array that receives pointers to the pages pinned. * Should be at least nr_pages long. - * @vmas: array of pointers to vmas corresponding to each page. - * Or NULL if the caller does not require them. * @locked: pointer to lock flag indicating whether lock is held and * subsequently whether VM_FAULT_RETRY functionality can be * utilised. Lock must initially be held. @@ -3259,14 +3257,14 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast); long pin_user_pages_remote(struct mm_struct *mm, unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, - struct vm_area_struct **vmas, int *locked) + int *locked) { int local_locked = 1; - if (!is_valid_gup_args(pages, vmas, locked, &gup_flags, + if (!is_valid_gup_args(pages, NULL, locked, &gup_flags, FOLL_PIN | FOLL_TOUCH | FOLL_REMOTE)) return 0; - return __gup_longterm_locked(mm, start, nr_pages, pages, vmas, + return __gup_longterm_locked(mm, start, nr_pages, pages, NULL, locked ? locked : &local_locked, gup_flags); } diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c index 78dfaf9e8990..0523edab03a6 100644 --- a/mm/process_vm_access.c +++ b/mm/process_vm_access.c @@ -104,7 +104,7 @@ static int process_vm_rw_single_vec(unsigned long addr, mmap_read_lock(mm); pinned_pages = pin_user_pages_remote(mm, pa, pinned_pages, flags, process_pages, - NULL, &locked); + &locked); if (locked) mmap_read_unlock(mm); if (pinned_pages <= 0)