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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 D6225C00A89 for ; Thu, 5 Nov 2020 09:26:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1EF5420825 for ; Thu, 5 Nov 2020 09:26:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DAg5dsI4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Pk45fCQQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EF5420825 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=c+9Fc2PB5wqVO+nTnnyLUWtoQlFD64H8aJ+nrsRHawM=; b=DAg5dsI4ZrBZWRVkew+GLkrjD 7zZwLkafbZLit6xwwhc8/foQGkF8AqJOOFNDCjX7VVT9PeU7jyaFh1HwLyknvm465kgmDEzg4wShU hZ1o14JGDhCe4xuypkr589ZNVrh0+T5VG/DbMph8jQzDFoBQL520IK6lq68269CxKCPjtsluSGkQO PKWo3azVCStQWYLJc8T4F4wp4irXUuCwOi/84Srn/UX7yw/I3DrKZfyTLOuh0v2YLzVnXG7paVDsb F307qVaVavIWMrHuDABA7ibMYADj56D31dXkcQjdKq74cbJv6bRVK4h6pA3Ebk8BFhr96JhNrz6zn kcTFuYRGA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kabWP-0002Oz-KX; Thu, 05 Nov 2020 09:25:33 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kabWL-0002NS-VD for linux-arm-kernel@lists.infradead.org; Thu, 05 Nov 2020 09:25:30 +0000 Received: by mail-wm1-x342.google.com with SMTP id c16so854148wmd.2 for ; Thu, 05 Nov 2020 01:25:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=6viq27xeTxIz8acrTQ2jRGDu1L7mOoiJCMIWrZFHf74=; b=Pk45fCQQ7XngdYs3ziaP+ymxGzpakbhoUL7YEZ1pNacSF/8myikkPFyZUaHYgYV+MI jUFI0zhMI1Q5QNm1leQcIJl/cJaDXfbVVx+4uWz9xdSA/Fb7U7QrV97m7ySMNgMlnXw7 FTghP2yCD22NR5UHFnL7m1NqQXsahfUUgl95A= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=6viq27xeTxIz8acrTQ2jRGDu1L7mOoiJCMIWrZFHf74=; b=Pg/ENbQ3JQjWUE37nOFN2fxlWWMPKor/BDPcZz2oRRMjPlnzYn6dD7FE/C6X9Dukze Z27ehJOUEqZwMpJDbOU3kY+f5Ta4JxGCL5E4FYBScAfLVQVvAouwIOElm7pGSJm1PjTS CZx3fQZc9klC4xZaqXBPFPFITavrg0c3DLTykT3KKNNng/0ukyuzw6itM6+PVtukNxyq hlOsAzj+32/6p6paI3b3L3i2TMLwNz8dP2ivO23Q57QpTtqaIzTO/i879AknxJrNSw3h tWGVmXG/VDNOJi27RkKhZSJ33gPbMBt8qJF04wvTWNcEOX6tGQmnlYVGKaBJ9vszHhFG CBxQ== X-Gm-Message-State: AOAM533pe33N3YYb57DeVNPG7Hvs7t3AKqNEXTk5FtsKaBtZ5WPzOqMV TVlHyhDtcb0gQnz4YFHIonMV6w== X-Google-Smtp-Source: ABdhPJy3n17GilkYmW9UEcOuB53n8WrP7NQoee5RAk40ap5hD72YnDNsNHhquJauR7fQm17EWWmhuQ== X-Received: by 2002:a1c:497:: with SMTP id 145mr1699932wme.127.1604568327398; Thu, 05 Nov 2020 01:25:27 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id d63sm209171wmd.12.2020.11.05.01.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 01:25:26 -0800 (PST) Date: Thu, 5 Nov 2020 10:25:24 +0100 From: Daniel Vetter To: John Hubbard Subject: Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM Message-ID: <20201105092524.GQ401619@phenom.ffwll.local> Mail-Followup-To: John Hubbard , Jason Gunthorpe , Christoph Hellwig , 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: <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-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201105_042530_056373_7306DE40 X-CRM114-Status: GOOD ( 30.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc , Jan Kara , KVM list , Pawel Osciak , Linux MM , Daniel Vetter , LKML , DRI Development , Tomasz Figa , Christoph Hellwig , Jason Gunthorpe , J??r??me Glisse , "open list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , Kyungmin Park , Andrew Morton , Mauro Carvalho Chehab , Dan Williams , Linux ARM , Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. Thanks for the explainer. I guess I can go back to _fast and instead adjust the commit message to explain why that's all 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. > */ We support hugepage faults in gpu drivers since recently, and I'm not seeing a pud_mkhugespecial anywhere. So not sure this works, but probably just me missing something again. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel