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.4 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,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 3711BC55179 for ; Wed, 4 Nov 2020 18:45:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 947552087D for ; Wed, 4 Nov 2020 18:45:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="LevZOWfS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 947552087D 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 6E5226B0070; Wed, 4 Nov 2020 13:45:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 66D686B0072; Wed, 4 Nov 2020 13:45:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5348B6B0074; Wed, 4 Nov 2020 13:45:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 22D4A6B0070 for ; Wed, 4 Nov 2020 13:45:08 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B474F362A for ; Wed, 4 Nov 2020 18:45:07 +0000 (UTC) X-FDA: 77447613054.10.skin96_5d09f19272c3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 92D4316A0DE for ; Wed, 4 Nov 2020 18:45:07 +0000 (UTC) X-HE-Tag: skin96_5d09f19272c3 X-Filterd-Recvd-Size: 5430 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 18:45:06 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Wed, 04 Nov 2020 10:45:03 -0800 Received: from [10.2.49.167] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 4 Nov 2020 18:44:57 +0000 Subject: Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM To: Jason Gunthorpe , Christoph Hellwig CC: Daniel Vetter , J??r??me Glisse , linux-samsung-soc , Jan Kara , Pawel Osciak , KVM list , Mauro Carvalho Chehab , LKML , DRI Development , Tomasz Figa , Linux MM , Kyungmin Park , "Daniel Vetter" , Andrew Morton , Marek Szyprowski , Dan Williams , Linux ARM , "open list:DMA BUFFER SHARING FRAMEWORK" References: <1f7cf690-35e2-c56f-6d3f-94400633edd2@nvidia.com> <7f29a42a-c408-525d-90b7-ef3c12b5826c@nvidia.com> <20201104140023.GQ36674@ziepe.ca> <20201104162125.GA13007@infradead.org> <20201104163758.GA17425@infradead.org> <20201104164119.GA18218@infradead.org> <20201104181708.GU36674@ziepe.ca> From: John Hubbard Message-ID: Date: Wed, 4 Nov 2020 10:44:56 -0800 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: <20201104181708.GU36674@ziepe.ca> 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=1604515503; bh=8Ugq3MVZhAulHFLpXWMZRWPLhPny25VZOQYdcq4TO0Y=; 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=LevZOWfSVNFRWN4kR3miaQt5LJlNcyeB9Ghugs0ySBdOh/MQLGl5DRy1UnBuawKGN MsfMPuReQvwD80mrwk72YzJgprfaPEzy1iWCw2bcBIdepgHc2yIb1Z3tSbNtmEzOtU 74pXxKH+MYaO7mcOVRHUIJlaJ+S6YdrrRiDmU5IgDOTF2gsFbVWNUGDqZmjLUVrBs+ KGS2R/Zsa7bMMbNrwo9WMhxZao/dnX05W1Igj+s1NtoEdpZL8MR5Y+v8eG6ulR90ea VKoKDEiFK4daZpfXrySmcBWNIL6VlfFacFRqV7CsvPsOFqcDAR/c16xbI63Eet0A3q CwJJD0KoyL0qA== 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 11/4/20 10:17 AM, Jason Gunthorpe wrote: > On Wed, Nov 04, 2020 at 04:41:19PM +0000, Christoph Hellwig wrote: >> On Wed, Nov 04, 2020 at 04:37:58PM +0000, Christoph Hellwig wrote: >>> On Wed, Nov 04, 2020 at 05:26:58PM +0100, Daniel Vetter wrote: >>>> What we're discussing is whether gup_fast and pup_fast also obey this, >>>> or fall over and can give you the struct page that's backing the >>>> dma_mmap_* memory. Since the _fast variant doesn't check for >>>> vma->vm_flags, and afaict that's the only thing which closes this gap. >>>> And like you restate, that would be a bit a problem. So where's that >>>> check which Jason&me aren't spotting? >>> >>> remap_pte_range uses pte_mkspecial to set up the PTEs, and gup_pte_range >>> errors out on pte_special. Of course this only works for the >>> CONFIG_ARCH_HAS_PTE_SPECIAL case, for other architectures we do have >>> a real problem. >> >> Except that we don't really support pte-level gup-fast without >> CONFIG_ARCH_HAS_PTE_SPECIAL, and in fact all architectures selecting >> HAVE_FAST_GUP also select ARCH_HAS_PTE_SPECIAL, so we should be fine. > > Mm, I thought it was probably the special flag.. > > Knowing that CONFIG_HAVE_FAST_GUP can't be set without > CONFIG_ARCH_HAS_PTE_SPECIAL is pretty insightful, can we put that in > the Kconfig? > > config HAVE_FAST_GUP > depends on MMU > depends on ARCH_HAS_PTE_SPECIAL > bool > Well, the !CONFIG_ARCH_HAS_PTE_SPECIAL case points out in a comment that gup-fast is not *completely* unavailable there, so I don't think you want to shut it off like that: /* * If we can't determine whether or not a pte is special, then fail immediately * for ptes. Note, we can still pin HugeTLB and THP as these are guaranteed not * to be special. * * For a futex to be placed on a THP tail page, get_futex_key requires a * get_user_pages_fast_only implementation that can pin pages. Thus it's still * useful to have gup_huge_pmd even if we can't operate on ptes. */ thanks, -- John Hubbard NVIDIA