From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6ADBC17454 for ; Wed, 13 Nov 2019 04:28:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8205122466 for ; Wed, 13 Nov 2019 04:28:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="jguBzetl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727792AbfKME2b (ORCPT ); Tue, 12 Nov 2019 23:28:31 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:13800 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbfKME1Y (ORCPT ); Tue, 12 Nov 2019 23:27:24 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 12 Nov 2019 20:27:14 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 12 Nov 2019 20:27:14 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 12 Nov 2019 20:27:14 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Nov 2019 04:27:14 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 13 Nov 2019 04:27:14 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 13 Nov 2019 04:27:14 +0000 Received: from blueforge.nvidia.com (Not Verified[10.110.48.28]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 12 Nov 2019 20:27:13 -0800 From: John Hubbard To: Andrew Morton CC: Al Viro , Alex Williamson , Benjamin Herrenschmidt , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Christoph Hellwig , Dan Williams , Daniel Vetter , Dave Chinner , David Airlie , "David S . Miller" , Ira Weiny , Jan Kara , Jason Gunthorpe , Jens Axboe , Jonathan Corbet , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Magnus Karlsson , "Mauro Carvalho Chehab" , Michael Ellerman , Michal Hocko , Mike Kravetz , "Paul Mackerras" , Shuah Khan , Vlastimil Babka , , , , , , , , , , , , , LKML , John Hubbard Subject: [PATCH v4 23/23] mm/gup: remove support for gup(FOLL_LONGTERM) Date: Tue, 12 Nov 2019 20:27:10 -0800 Message-ID: <20191113042710.3997854-24-jhubbard@nvidia.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191113042710.3997854-1-jhubbard@nvidia.com> References: <20191113042710.3997854-1-jhubbard@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1573619234; bh=+6XZ9/UpMiQMsyd6g5mrANaqNrp0zsSmDMnAyJRKi2s=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=jguBzetlNPWuzoeBXaqOLn+1f0v/x41+b55TFXan2xXV+ieIPIHEodL+04sHoLFoo Ntdx5sNURUhCjbeGEshvKXaIH5v8l90zbUD2nJvdgz+3NFE1I3/t0giDgwc5miWd7G cU1sGz4uIbPPRJqmixLSVlo54vmWOT/WV6sfifJML/xZRzJ3DbjBRK5Kg/bsYJoNMw HfxH090IR0JFffgnB/qTiJcHn1l6qSbQ4J8hYas3umYaDPqihguaQr9Myne38jaPmF UuPHBRT3OZ9EJOLMUq4LmeoMlmb55tkz2rXV0HBjMicsGlxLSnhDw6We4MW6129syp b73tCuGLh6A8w== Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Now that all other kernel callers of get_user_pages(FOLL_LONGTERM) have been converted to pin_longterm_pages(), lock it down: 1) Add an assertion to get_user_pages(), preventing callers from passing FOLL_LONGTERM (in addition to the existing assertion that prevents FOLL_PIN). 2) Remove the associated GUP_LONGTERM_BENCHMARK test. Signed-off-by: John Hubbard --- mm/gup.c | 8 ++++---- mm/gup_benchmark.c | 9 +-------- tools/testing/selftests/vm/gup_benchmark.c | 7 ++----- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 82e7e4ce5027..90f5f95ee7ac 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1756,11 +1756,11 @@ long get_user_pages(unsigned long start, unsigned l= ong nr_pages, struct vm_area_struct **vmas) { /* - * FOLL_PIN must only be set internally by the pin_user_page*() and - * pin_longterm_*() APIs, never directly by the caller, so enforce that - * with an assertion: + * FOLL_PIN and FOLL_LONGTERM must only be set internally by the + * pin_user_page*() and pin_longterm_*() APIs, never directly by the + * caller, so enforce that with an assertion: */ - if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) + if (WARN_ON_ONCE(gup_flags & (FOLL_PIN | FOLL_LONGTERM))) return -EINVAL; =20 return __gup_longterm_locked(current, current->mm, start, nr_pages, diff --git a/mm/gup_benchmark.c b/mm/gup_benchmark.c index 8f980d91dbf5..679f0e6a0adb 100644 --- a/mm/gup_benchmark.c +++ b/mm/gup_benchmark.c @@ -6,7 +6,7 @@ #include =20 #define GUP_FAST_BENCHMARK _IOWR('g', 1, struct gup_benchmark) -#define GUP_LONGTERM_BENCHMARK _IOWR('g', 2, struct gup_benchmark) +/* Command 2 has been deleted. */ #define GUP_BENCHMARK _IOWR('g', 3, struct gup_benchmark) #define PIN_FAST_BENCHMARK _IOWR('g', 4, struct gup_benchmark) #define PIN_LONGTERM_BENCHMARK _IOWR('g', 5, struct gup_benchmark) @@ -28,7 +28,6 @@ static void put_back_pages(int cmd, struct page **pages, = unsigned long nr_pages) =20 switch (cmd) { case GUP_FAST_BENCHMARK: - case GUP_LONGTERM_BENCHMARK: case GUP_BENCHMARK: for (i =3D 0; i < nr_pages; i++) put_page(pages[i]); @@ -97,11 +96,6 @@ static int __gup_benchmark_ioctl(unsigned int cmd, nr =3D get_user_pages_fast(addr, nr, gup->flags, pages + i); break; - case GUP_LONGTERM_BENCHMARK: - nr =3D get_user_pages(addr, nr, - gup->flags | FOLL_LONGTERM, - pages + i, NULL); - break; case GUP_BENCHMARK: nr =3D get_user_pages(addr, nr, gup->flags, pages + i, NULL); @@ -159,7 +153,6 @@ static long gup_benchmark_ioctl(struct file *filep, uns= igned int cmd, =20 switch (cmd) { case GUP_FAST_BENCHMARK: - case GUP_LONGTERM_BENCHMARK: case GUP_BENCHMARK: case PIN_FAST_BENCHMARK: case PIN_LONGTERM_BENCHMARK: diff --git a/tools/testing/selftests/vm/gup_benchmark.c b/tools/testing/sel= ftests/vm/gup_benchmark.c index 03928e47a86f..836b7082db13 100644 --- a/tools/testing/selftests/vm/gup_benchmark.c +++ b/tools/testing/selftests/vm/gup_benchmark.c @@ -15,7 +15,7 @@ #define PAGE_SIZE sysconf(_SC_PAGESIZE) =20 #define GUP_FAST_BENCHMARK _IOWR('g', 1, struct gup_benchmark) -#define GUP_LONGTERM_BENCHMARK _IOWR('g', 2, struct gup_benchmark) +/* Command 2 has been deleted. */ #define GUP_BENCHMARK _IOWR('g', 3, struct gup_benchmark) =20 /* @@ -49,7 +49,7 @@ int main(int argc, char **argv) char *file =3D "/dev/zero"; char *p; =20 - while ((opt =3D getopt(argc, argv, "m:r:n:f:abctTLUuwSH")) !=3D -1) { + while ((opt =3D getopt(argc, argv, "m:r:n:f:abctTUuwSH")) !=3D -1) { switch (opt) { case 'a': cmd =3D PIN_FAST_BENCHMARK; @@ -75,9 +75,6 @@ int main(int argc, char **argv) case 'T': thp =3D 0; break; - case 'L': - cmd =3D GUP_LONGTERM_BENCHMARK; - break; case 'U': cmd =3D GUP_BENCHMARK; break; --=20 2.24.0