From patchwork Sun May 14 21:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13240573 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 7AC34C7EE22 for ; Sun, 14 May 2023 21:26:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 017C5900005; Sun, 14 May 2023 17:26:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0A3D900002; Sun, 14 May 2023 17:26:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E042C900005; Sun, 14 May 2023 17:26:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D3D9B900002 for ; Sun, 14 May 2023 17:26:55 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A28321611D2 for ; Sun, 14 May 2023 21:26:55 +0000 (UTC) X-FDA: 80790145590.07.69AF950 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by imf27.hostedemail.com (Postfix) with ESMTP id C571040007 for ; Sun, 14 May 2023 21:26:53 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=P9v4mBU3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684099613; 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=ZmBAahwH3yBC6wiSFBmCvOUJZc6pQJuHBQHQjehZN04=; b=iQtYmnOcp5t6sQDpYqBQSiF77p587v++xfXS7XxuCaCm0HBi4KY6eRVO4fswucau65ugKr Bc0qqf2Nu28mdHsjehCpZTVPEnOuiCqbQV4MmIVUMvLv/+IRxuhItbmAsoRUdaKTEm0VUS uhRXfHDi80fD568hi3yvwBmBKUeL8KM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=P9v4mBU3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=lstoakes@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684099613; a=rsa-sha256; cv=none; b=XCywXnGpIQICWEBUHra7wibnkNZhu0vzCRmVejjEJ9xyFnDKucRSagps7gIofmMnV4hOsE 8+R3NNpyPLlO5u9nUW41ulL6BUeAvYA5LfW36HcTEWO92AxEZWOBl2Qq7BTElbz9oRxvZu 0c/pK144pwleLL6pgATV2cb/UpEm1g0= Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-3f435658d23so57742765e9.3 for ; Sun, 14 May 2023 14:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684099612; x=1686691612; 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=ZmBAahwH3yBC6wiSFBmCvOUJZc6pQJuHBQHQjehZN04=; b=P9v4mBU31DGSqiMeXVGSxNgDot0QvCFZEg81a2ZqSRg8aNjpkh1heg2g0YDLwGP1WW pumh6XzLEJs+M0DyO1sdJOxuO5GXSIg7X98SLUQn5Aq+xU++Ezi5PFtH7qk9tEVHDcVU PtifjH/BqYn+H9IvTbDYymR3gOt7fAs8busLuz8pPLS9adFg/Q17UmH2jxfHUYC7/ffW O3fouSy/AkWD38T9QKesFhyoTZHE7Ndr/7ZPCy9pQbJ2TshQhoPGX6sP53+BdEOT6/6a XApfU798flXg+lhZw7l9ve1Ik8oxAjkwIqV0AzasmwGY7WoC2ffal7clqg7KJx8Mk/xe QpCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684099612; x=1686691612; 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=ZmBAahwH3yBC6wiSFBmCvOUJZc6pQJuHBQHQjehZN04=; b=ROhYdcbj9ToImTw/fIzjAVj80XfhymnC7qCd9y74bb2uki780lbR3Z7mqYa9NmnjY/ +xHpBuN0xJd/OItqqtpkKBS07jmvgOEvcOSbGKMqKAvbX17PM5TtuaaClftN0VisTmd6 Uc0updI2YZ3qPlhtC/FRDKVX5G+33Vy1mzxJGhCRxlAdvK3N3amhVhkHofJuPV1brcuA xG9gibgdXZnkl+oaRAwhQKbB2zMgWjNzF5VYsMvDRthFmG8zzwzYwjxoWubWN1x6Th96 4+HmRj45Fwq1bYD7y3LI9PyA0FULM71uEVy2nmPjFl2RVx83Ks7nybCcrYcFw9eypVT5 avxA== X-Gm-Message-State: AC+VfDwxKmyJT5cOauSdisuAorR6XOVaiDrTtOUd/LyNoR50GMK1wbpB UAxJ+2yO7Wkb1GmHQQOIACFBDiBqsEjJXg== X-Google-Smtp-Source: ACHHUZ7lK5a36mvxmR1Pxfpqxs+w/WjMWXdphswTjkKa0cVHWahzuWK+ycuAS5s3uVehE/QApFMdkQ== X-Received: by 2002:a05:600c:2207:b0:3f5:6e5:1689 with SMTP id z7-20020a05600c220700b003f506e51689mr1792509wml.17.1684099611749; Sun, 14 May 2023 14:26:51 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id l11-20020a05600c1d0b00b003f1978bbcd6sm25750205wms.3.2023.05.14.14.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 May 2023 14:26:50 -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 Subject: [PATCH v5 2/6] mm/gup: remove unused vmas parameter from pin_user_pages_remote() Date: Sun, 14 May 2023 22:26:47 +0100 Message-Id: <61f0d12058825a14feee6a3292e5a257662e719c.1684097002.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: gxk3xek5f6bp3u8bproujrwkzke43nzy X-Rspam-User: X-Rspamd-Queue-Id: C571040007 X-Rspamd-Server: rspam07 X-HE-Tag: 1684099613-818902 X-HE-Meta: U2FsdGVkX1/ozAnyDQilA4b9q9IXJhW8T2ROpBuNGmDcVK3vW3WYF+FJLjq0XJVl2JBlEYtk7s6K5hqYR+v3WTyrqfhOGun1DB6MbtnqdAEJnj8AjjHQxwnPBtZ6pWQ3aWBGiGk8t9lKwHDYeaRwNJD6AlRstu4vYGCyG6N+RRawGcQ36lL0QhOTSWD8CQIIJSk9F+14+fv54xtgEv6EnL9e0GJg2R13jLNo94lTpx9rEaI+oB0Ug96Nzo1ZEqfBLvNUfDIbpd8s8W8W9oc6AJ7mb1hxCxSotcRwMKogFfEsrCbKzWS9uBC0vM+bdm8HOqM+hdJYmZo/epO6lLhknbkPBldbpmqzc1/qHP1Y8b+JMIW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PoJtSwTXnLpHLGjh59AJzRtYE37St9Rn4yrdw1kzNY0enjfO5qUfOzBZN2ulS+5vs37Zac0URTEgMvJobningVIJ7SPtP+1BVhzgCYhF7npHEsCfUgBBfhWGmuyVA== 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 Signed-off-by: Lorenzo Stoakes Reviewed-by: Christoph Hellwig --- drivers/iommu/iommufd/pages.c | 4 ++-- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/mm.h | 2 +- mm/gup.c | 8 +++----- mm/process_vm_access.c | 2 +- 5 files changed, 8 insertions(+), 10 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/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)