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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no 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 58E8DC41604 for ; Sat, 3 Oct 2020 22:52:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5B9A2068E for ; Sat, 3 Oct 2020 22:52:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="Ji1FUw05" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5B9A2068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D28066B005D; Sat, 3 Oct 2020 18:52:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD87C6B0062; Sat, 3 Oct 2020 18:52:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEEC66B0068; Sat, 3 Oct 2020 18:52:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 960D26B005D for ; Sat, 3 Oct 2020 18:52:39 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1FE08181AE868 for ; Sat, 3 Oct 2020 22:52:39 +0000 (UTC) X-FDA: 77332115238.07.gun12_280c4f9271b0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 0870A1803F9AB for ; Sat, 3 Oct 2020 22:52:39 +0000 (UTC) X-HE-Tag: gun12_280c4f9271b0 X-Filterd-Recvd-Size: 5106 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Sat, 3 Oct 2020 22:52:38 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sat, 03 Oct 2020 15:51:44 -0700 Received: from [10.2.58.214] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sat, 3 Oct 2020 22:52:32 +0000 Subject: Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM To: Daniel Vetter 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" References: <20201002175303.390363-1-daniel.vetter@ffwll.ch> <20201002175303.390363-2-daniel.vetter@ffwll.ch> From: John Hubbard Message-ID: Date: Sat, 3 Oct 2020 15:52:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1601765504; bh=5ppvHLUO/9fbIncZBsX0QRcDvjgd285ERncHZH+jBTQ=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=Ji1FUw05hePaqwM1D5cwu0YizjaQWb5Mp458Rnbz7PTao0aGPynwrhOclhjCKrJU0 TuxSCKhpy2o33ZbQ6qctuVu+ZH6TjebLlAv44xr1m5C0eM5O/KFwFMsP29suyi4HxU 7niB1RXiaToj7nlQHwVmz22ekwMcQmAfv1SQB4LhZWP2ztwPzMu0Jo22dFhBC9TRtB cXXl6qFqoXI2Qrn049sPT6pv80tx1yV3OVUJgOrgdkV8M6TTcCMzJ+5wIKXAUWpm9T x/g3UL5urU1erhjCn4JTTyUhitwG8XonVuxdQJYZPMYoqax5wISjFnhnUnAkLbQ+KR 1GnsY+nrXhBJQ== 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 10/3/20 2:45 AM, Daniel Vetter wrote: > 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 working on? It doesn't collide with anything on my end yet, because I've been slow to pick up on the need for changing callsites to add FOLL_LONGTERM. :) And it looks like that's actually a problem, because: > > Also with the firmed up rules, correct that I can also drop the > vma_is_fsdax check when the FOLL_LONGTERM flag is set? That's the right direction to go *in general*, but I see that the pin_user_pages code is still a bit stuck in the past. And this patch won't actually work, with or without that vma_is_fsdax() check. Because: get_vaddr_frames(FOLL_LONGTERM) pin_user_pages_locked() if (WARN_ON_ONCE(gup_flags & FOLL_LONGTERM)) return -EINVAL; So, again, pin_user_pages*() is at least partly behind the times here. I can jump in and start fixing it up, but it depends on what you and Oded and others are planning? Note: there is a particular combination of dax and locking that we have to still avoid, within gup.c. That's already covered, but needs to continue to be covered when we enable FOLL_LONGTERM in the remaining pin_user_pages*() calling paths. thanks, -- John Hubbard NVIDIA