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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 CFFE7C4741F for ; Wed, 4 Nov 2020 16:27:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F08DD2074B for ; Wed, 4 Nov 2020 16:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="i+/uTvjs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F08DD2074B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7B7916B0068; Wed, 4 Nov 2020 11:27:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 766D26B006E; Wed, 4 Nov 2020 11:27:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6875C6B0068; Wed, 4 Nov 2020 11:27:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 3C3006B0068 for ; Wed, 4 Nov 2020 11:27:13 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CE60C8249980 for ; Wed, 4 Nov 2020 16:27:12 +0000 (UTC) X-FDA: 77447265504.26.join74_2d14491272c2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id A69E61804B65A for ; Wed, 4 Nov 2020 16:27:12 +0000 (UTC) X-HE-Tag: join74_2d14491272c2 X-Filterd-Recvd-Size: 4992 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 16:27:11 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id l36so11842034ota.4 for ; Wed, 04 Nov 2020 08:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+jKBsc1XM8CUKlg3VqmwM4QNdUSjpFH4yWF5dp0NTz8=; b=i+/uTvjsk976DicxcEHtNNkKd5tdb/MRp5JTe2+pAxIGQwwKIuIcHCZ9gIfNuEktop Ir1VcTIHdqTsD4wZdHCdfVujbxPqzBZ00Mm5Mu7qHa2cbwKkBevm00cgHWq320ih38Ge yItaK3iWE/DQC0jvHc3VxVW7uMRTu+v2PtiCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+jKBsc1XM8CUKlg3VqmwM4QNdUSjpFH4yWF5dp0NTz8=; b=UAvYohxUxEoONzsj53BzI/mjNvxGSQynpPd0Pgpk7Imdq2Hb9gz55nrSjnILoHoMkX ZUWrO5ccjDiPhb8JedRZu102KxcPSf6MlBfjx1vhfttrlK63575rHKHsRrud0PrQ/eHF Y53zBUouohUSNejMpCa2DctgG8aNhEEB/Oew+kPjH/RrBd80yx74Bot899KdOqMyasuJ ggIMQij+TUrcnxi2uxHqXowz+7ewW36DJNEEuHS/+nU86gbNR8VDWPa2QDWxAceG7pKO PrIdYvDAUPW7/HZSJwWQx+vt60k5fPYNKeoC6QSZutYVSoK/RsJtdTMyd2Fz4OUbuScH u/3A== X-Gm-Message-State: AOAM533ECpnbNpMxda0N0R9CaWLI0mw/lK8D5MMTwGgioICI78brZONR l2eYN+J8sNyKKXS98HIdbeCjVIxVfjEfwVyqHRkxPg== X-Google-Smtp-Source: ABdhPJwUkm33VhszJycM92X0W59/Lqj2SzkWRtSj8SP7VfVhLWlLHPhV+pa9uC6mpn9OH9RSQm2eEqL7TT7PFN/zowU= X-Received: by 2002:a9d:3b4:: with SMTP id f49mr18948455otf.188.1604507229909; Wed, 04 Nov 2020 08:27:09 -0800 (PST) MIME-Version: 1.0 References: <20201030100815.2269-1-daniel.vetter@ffwll.ch> <20201030100815.2269-6-daniel.vetter@ffwll.ch> <446b2d5b-a1a1-a408-f884-f17a04b72c18@nvidia.com> <1f7cf690-35e2-c56f-6d3f-94400633edd2@nvidia.com> <7f29a42a-c408-525d-90b7-ef3c12b5826c@nvidia.com> <20201104140023.GQ36674@ziepe.ca> <20201104162125.GA13007@infradead.org> In-Reply-To: <20201104162125.GA13007@infradead.org> From: Daniel Vetter Date: Wed, 4 Nov 2020 17:26:58 +0100 Message-ID: Subject: Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM To: Christoph Hellwig Cc: Jason Gunthorpe , "J??r??me Glisse" , linux-samsung-soc , Jan Kara , Pawel Osciak , KVM list , John Hubbard , 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" Content-Type: text/plain; charset="UTF-8" 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 4, 2020 at 5:21 PM Christoph Hellwig wrote: > > On Wed, Nov 04, 2020 at 04:54:19PM +0100, Daniel Vetter wrote: > > I don't really have a box here, but dma_mmap_attrs() and friends to > > mmap dma_alloc_coherent memory is set up as VM_IO | VM_PFNMAP (it's > > actually enforced since underneath it uses remap_pfn_range), and > > usually (except if it's pre-cma carveout) that's just normal struct > > page backed memory. Sometimes from a cma region (so will be caught by > > the cma page check), but if you have an iommu to make it > > device-contiguous, that's not needed. > > dma_mmap_* memory may or may not be page backed, but it absolutely > must not be resolved by get_user_pages and friends as it is special. > So yes, not being able to get a struct page back from such an mmap is > a feature. Yes, that's clear. 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? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch