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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 7AB2FC2D0A3 for ; Wed, 4 Nov 2020 19:02:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C0FC0206D9 for ; Wed, 4 Nov 2020 19:02:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="HhJHYDe4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0FC0206D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E5A996B0078; Wed, 4 Nov 2020 14:02:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1566B007D; Wed, 4 Nov 2020 14:02:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C35716B007E; Wed, 4 Nov 2020 14:02:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 82E796B0078 for ; Wed, 4 Nov 2020 14:02:17 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0A743362A for ; Wed, 4 Nov 2020 19:02:17 +0000 (UTC) X-FDA: 77447656314.26.place05_060a930272c3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id E44AC1804B640 for ; Wed, 4 Nov 2020 19:02:16 +0000 (UTC) X-HE-Tag: place05_060a930272c3 X-Filterd-Recvd-Size: 6732 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 19:02:16 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id m14so12937129qtc.12 for ; Wed, 04 Nov 2020 11:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/UKgc10BslmqBEq+jaLxahr/MEdpryS7jFqE+Dnr3vI=; b=HhJHYDe4YHd+/a56BdoqnLrywV6UfuBf/DsyHbP4QvtBlGMcnvi67aThLz1LQnQ9C7 8EemYt7CTkS9B+W9jO8pXOPnbTizt3Pe9397JG9VN2ZMIG13OJgH9kNFKGqXLgoE3Hzj V1vv8lw5Pa9YVxFQjZfe4EOFce5bInYTuWldtvqSVrDDdmTUopOFroR+gBfYNDg6Uuau 3Jp2luUDv74e1JR/3SaJIovsmPrALIHM4h9v9NFcni+HQF+v8Dr91QTVCCYUEOxMud09 LLulIis0YmYr2jolcahGS2sbLtv9wbZ7FKZV2VUnjcWsESvH7Lm4q6CoSzm/SgrhfDUT xwVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/UKgc10BslmqBEq+jaLxahr/MEdpryS7jFqE+Dnr3vI=; b=TriWg3a85PCa/T+ReTTc0RvjC+VjkpJUA1tv3Og7roDDiXFoQSMjs4K4/S95K0C9b+ lF4nYpdcHjdNncQ8M9hekm5c0us223ZLZ4MnnvtHW/TguoFEgAP1eTcrp+aqMpvbJjQr DpT4+K73+hkcTRiiC3cHSlQ7LkUE5jljnPbqMZm0x8Gl476YjhKjQukD2/fGVeiD8FcK H6ew9JWJX9XRNj7NUSJSc+erhpGgU/wvTxiHFu5hC8PfGF2tF/oUnT1553pwPVeADBQ6 +C4DKEu26qYEHrYG5hJwIKwes5I5lRsih6igsZqaYg3py4mOaSr7CLE5CGoaPYYEUkt2 n+OQ== X-Gm-Message-State: AOAM531docUQ0yP6FFM2je3Twh0o3aMzpaQbXJftvDfxFTYilXPxuRXp RL3/A1q8D8eAWVYxz6jYftNhGg== X-Google-Smtp-Source: ABdhPJx0R0pt2rE5Fh6PKobat9BHCWAKjXRAimq+VPJpufi8x0s4Mnx78kA46TVhPrgcaUAjwr3r5w== X-Received: by 2002:ac8:5948:: with SMTP id 8mr20543496qtz.215.1604516535414; Wed, 04 Nov 2020 11:02:15 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id h9sm710672qth.78.2020.11.04.11.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 11:02:14 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kaO2w-00Gbbx-2K; Wed, 04 Nov 2020 15:02:14 -0400 Date: Wed, 4 Nov 2020 15:02:14 -0400 From: Jason Gunthorpe To: John Hubbard Cc: Christoph Hellwig , 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" Subject: Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201104190214.GW36674@ziepe.ca> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Nov 04, 2020 at 10:44:56AM -0800, John Hubbard wrote: > 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. > */ I saw that once and I really couldn't make sense of it.. What use is having futex's that only work on THP pages? Confused CH said there was no case of HAVE_FAST_GUP !ARCH_HAS_PTE_SPECIAL, is one hidden someplace then? Jason