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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 03FCBC41604 for ; Sat, 3 Oct 2020 09:46:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9FD25206CD for ; Sat, 3 Oct 2020 09:46:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="hDibXoHA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FD25206CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 003536B005C; Sat, 3 Oct 2020 05:46:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ECD516B005D; Sat, 3 Oct 2020 05:46:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D94AD6B0062; Sat, 3 Oct 2020 05:46:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id A8A586B005C for ; Sat, 3 Oct 2020 05:46:04 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 381193632 for ; Sat, 3 Oct 2020 09:46:04 +0000 (UTC) X-FDA: 77330133048.01.pest81_570a6b2271ab Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 1B2901004A084 for ; Sat, 3 Oct 2020 09:46:04 +0000 (UTC) X-HE-Tag: pest81_570a6b2271ab X-Filterd-Recvd-Size: 6212 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Sat, 3 Oct 2020 09:46:03 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id h17so3879759otr.1 for ; Sat, 03 Oct 2020 02:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WmsHZ3xTqss6S86de6F2+GmRY4pwh6QmzDJN/bVYlUo=; b=hDibXoHAY2NY8DYQlETzpK27wX4ATsoMa5kzy1M2/palInn8ZKnTsfX9OAvCBMHLJ7 UTXJhzhKn4fSMh0ypNeHIZ7V603V9nGrHtFMY58a+YAo7uy+FISml44C4EG7POAXsSK5 tta54lMbGSCYR/621NNEVOBJzs4fvGGa04aCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WmsHZ3xTqss6S86de6F2+GmRY4pwh6QmzDJN/bVYlUo=; b=PlqrjEnTTzqm4LdEDbzEAUMHjh7rasiETeQGPBogIrxFkdtzhxkAjmCpRihQH1iVdY KoS4gYthvtJk+HBS4jBqLm7wgNjsv7w+05TlBHt+GoarLQxeDDEfrV1gVtSAyDmrZqcI QF4yEiPXp9TNZw6aWVjQEfbH1BBvdX/1jkclzYCevpfFrWxbszRbeYvIs17i8vMw9TfS 5Y8RejbneEGNIMgfh4HvO3ez97eT8tvEiUMOTvWdd4YIex3snSQ+anFJQCNxH8dCjfI4 RsNbskGzXICia+6E21myiTaz+3PpM3iE9lqhoqBtxV3nXPi/1cYJQ0IzqCbjoqSYkxno 5iWA== X-Gm-Message-State: AOAM5331k2Y1K5VnE7PUSFzfhiu56plqzbL/NUNIxjTe083I0aZqE1WU ALlRalW+rFr1nLiWHUwPc/3b+dQ9QO0gHGxQgJqLKg== X-Google-Smtp-Source: ABdhPJx7DZsiJzsUZCobrpWxpW+51JFbUQoJiBR48TvpUyFl0hMBEePfLwnrqOzsuokwHF8YWn4ObJWhXDnnLDo1YzY= X-Received: by 2002:a9d:4b99:: with SMTP id k25mr5004991otf.281.1601718362705; Sat, 03 Oct 2020 02:46:02 -0700 (PDT) MIME-Version: 1.0 References: <20201002175303.390363-1-daniel.vetter@ffwll.ch> <20201002175303.390363-2-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Sat, 3 Oct 2020 11:45:51 +0200 Message-ID: Subject: Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM To: John Hubbard Cc: DRI Development , LKML , Daniel Vetter , Andrew Morton , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Dan Williams , Linux MM , Linux ARM , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: On Sat, Oct 3, 2020 at 12:39 AM John Hubbard wrote: > > On 10/2/20 10:53 AM, Daniel Vetter wrote: > > For $reasons I've stumbled over this code and I'm not sure the change > > to the new gup functions in 55a650c35fea ("mm/gup: frame_vector: > > convert get_user_pages() --> pin_user_pages()") was entirely correct. > > > > This here is used for long term buffers (not just quick I/O) like > > RDMA, and John notes this in his patch. But I thought the rule for > > these is that they need to add FOLL_LONGTERM, which John's patch > > didn't do. > > Yep. The earlier gup --> pup conversion patches were intended to not > have any noticeable behavior changes, and FOLL_LONGTERM, with it's > special cases and such, added some risk that I wasn't ready to take > on yet. Also, FOLL_LONGTERM rules are only *recently* getting firmed > up. So there was some doubt at least in my mind, about which sites > should have it. > > But now that we're here, I think it's really good that you've brought > this up. It's definitely time to add FOLL_LONGTERM wherever it's missing. So should I keep this patch, or will it collide with a series you're workin= g on? Also with the firmed up rules, correct that I can also drop the vma_is_fsdax check when the FOLL_LONGTERM flag is set? Thanks, Daniel > > thanks, > -- > John Hubbard > NVIDIA > > > > > There is already a dax specific check (added in b7f0554a56f2 ("mm: > > fail get_vaddr_frames() for filesystem-dax mappings")), so this seems > > like the prudent thing to do. > > > > Signed-off-by: Daniel Vetter > > Cc: Andrew Morton > > Cc: John Hubbard > > Cc: J=C3=A9r=C3=B4me Glisse > > Cc: Jan Kara > > Cc: Dan Williams > > Cc: linux-mm@kvack.org > > Cc: linux-arm-kernel@lists.infradead.org > > Cc: linux-samsung-soc@vger.kernel.org > > Cc: linux-media@vger.kernel.org > > --- > > Hi all, > > > > I stumbled over this and figured typing this patch can't hurt. Really > > just to maybe learn a few things about how gup/pup is supposed to be > > used (we have a bit of that in drivers/gpu), this here isn't really > > ralated to anything I'm doing. > > > > I'm also wondering whether the explicit dax check should be removed, > > since FOLL_LONGTERM should take care of that already. > > -Daniel > > --- > > mm/frame_vector.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/frame_vector.c b/mm/frame_vector.c > > index 5d34c9047e9c..3507e09cb3ff 100644 > > --- a/mm/frame_vector.c > > +++ b/mm/frame_vector.c > > @@ -35,7 +35,7 @@ int get_vaddr_frames(unsigned long start, unsigned in= t nr_frames, > > { > > struct mm_struct *mm =3D current->mm; > > struct vm_area_struct *vma; > > - unsigned int gup_flags =3D FOLL_WRITE | FOLL_FORCE; > > + unsigned int gup_flags =3D FOLL_WRITE | FOLL_FORCE | FOLL_LONGTER= M; > > int ret =3D 0; > > int err; > > int locked; > > > --=20 Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch