Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1532263pxb; Wed, 4 Nov 2020 11:28:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBuiBIwSe6mpldmqaUgRLPQKmDlGHVof1Zdqz+rZpNgFvrtlwE66DT1E9SAquKIdoKvVEB X-Received: by 2002:a17:906:c0d1:: with SMTP id bn17mr27383634ejb.114.1604518085174; Wed, 04 Nov 2020 11:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604518085; cv=none; d=google.com; s=arc-20160816; b=IyqqDElZkyGqiCLEZXiIH0lPAMmBFEaFLoPcGgVJHv+m/sgrvnuIir2CVqYZqSeYRW 1O3aiFa0x2t5Xm97JobScQWxRsltfWczrUJHWbZVg92/BCxUtWMn5ryeiRHBRPTTukHJ IvOK6QHsa+3H06xzN0fW73LOIXu7nQ6focBUTZqwooeIxQj20ZlyQD4/8oPye2TQgLXY LL9RPaJfQy5gDBTTssC5V1paF9vmlwmM0u/eoRdGPkRlpfYBptMaX8WX9SXFKOoqK0FQ bGF5Kps3gxkWXQ2RmG/KM4LoWGwuMUGBqMrWJMoE1m0Nn5YSv7p/WTIOD0knat3E4Ki3 zdkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/UKgc10BslmqBEq+jaLxahr/MEdpryS7jFqE+Dnr3vI=; b=XPYA9YdTVDb7BMaaV1HfGFGCIGvtn6r+SHNNFB0vPpvxUWtFGJnkZ8n8BKANaKsE0f eYfVQEr93RUxyTe3gbhXslgIPk/H0LoVtS61CFJEM6BrsQeLdibeaRJ1M0LvNfW9/jTD 5L/NB1un3USgHQ/JZ+9/zq52r02LW+N9yB/Hz7nKuhD5WExxoubvVHvadDgyxejsB2nZ BozOBPAEruM6WaTFl2oyQ6bcVaSP3UaJe1OqNMBO2D9XHj91TjqxpPv4Cq5DhKGrei86 SJyFvYW+iQHU7L0n4DMMuMdz1lJQbLHBWo1+9F8HCeA+tio5XasBFLKITIdm0ojViT52 dQiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=HhJHYDe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o15si1913322ejm.459.2020.11.04.11.27.41; Wed, 04 Nov 2020 11:28:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=HhJHYDe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730781AbgKDTC0 (ORCPT + 99 others); Wed, 4 Nov 2020 14:02:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729301AbgKDTCQ (ORCPT ); Wed, 4 Nov 2020 14:02:16 -0500 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C98C0613D4 for ; Wed, 4 Nov 2020 11:02:16 -0800 (PST) Received: by mail-qt1-x842.google.com with SMTP id m65so12929059qte.11 for ; Wed, 04 Nov 2020 11:02:16 -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=k1zbfJ3TWErpgTI8rneHl95Jhm1z1P1fPuNRuBUqgPmsjTOtrTZjgWACZl+dsK3y2n gQuIxr94XepU5X4eTvl1P4sIrYw4klNkqUNo03Q5KpzlmsClXM1QBV3kr0Boo1rmti+m RMR2Z8T3dftnLd7ewrhrExpoB8C3R3MvR6XN/hi5USGBdGrxNnnCNuIB6x1YkjkhfH15 w5iOQ8NSBJCN0ZxBU6Tm3LdyYNMyI70wiv7mmjFOQBm8DOA9WdO3VD1QPUcGR0g0WGX9 R+Qm+hp2uFzdp+Bou6OTkJDzL1rYhJSTy4xfkpXZ0MCZ68o9a+aKgB6ACS8VolrsauOc cjhw== X-Gm-Message-State: AOAM531yRSZ5tMjMbs2dNuvFQjOi/VBVJNVzZKbmqQz5646wvknGCQjE jdK7u6IKHOnJcSx76zg/mSGa7g== 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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