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=-6.1 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 CB39DC4363C for ; Wed, 7 Oct 2020 10:47:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B9D8212CC for ; Wed, 7 Oct 2020 10:47:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="QJhnd4W0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B9D8212CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D8A676B005C; Wed, 7 Oct 2020 06:47:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3B776B0062; Wed, 7 Oct 2020 06:47:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB5046B0068; Wed, 7 Oct 2020 06:47:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 8C0876B005C for ; Wed, 7 Oct 2020 06:47:16 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 017EB1EE6 for ; Wed, 7 Oct 2020 10:47:16 +0000 (UTC) X-FDA: 77344802472.29.kite56_3413723271ce Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id CB90018086CD2 for ; Wed, 7 Oct 2020 10:47:15 +0000 (UTC) X-HE-Tag: kite56_3413723271ce X-Filterd-Recvd-Size: 8046 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 10:47:14 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201007104712euoutp01414b562f2fe8aa4d597406db528738f9~7sAYgwS6J2209222092euoutp01g for ; Wed, 7 Oct 2020 10:47:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201007104712euoutp01414b562f2fe8aa4d597406db528738f9~7sAYgwS6J2209222092euoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1602067632; bh=E5XERvvgz2kHeHngJGLKNS1MxI488JkYoBjaEOnm4F0=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=QJhnd4W0iuSmYplSDfsdUsI1zbZQIqQKqYLdEDILkjXPjbTgyOJGqN33OrggZl2lt 8+H+WT9MataicZBMK6LfIHUbHXZEoTtO/GAY3dClQsV0KAO9YlZSOybiQs6d2srn70 Zg3jdiy20Fm1DYEzghh1/EBNToxgyGD7SW/k8K+4= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201007104712eucas1p15a76d78779d57144160e51c36d83d24e~7sAYLFOLh3224932249eucas1p1I; Wed, 7 Oct 2020 10:47:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id ED.76.06456.0BC9D7F5; Wed, 7 Oct 2020 11:47:12 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201007104711eucas1p1a1b0945d6b12e3260b210dfcb5756ab9~7sAXtthzZ0030400304eucas1p11; Wed, 7 Oct 2020 10:47:11 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201007104711eusmtrp1487b9ffe41a58ec6aaec5d6c86578d4d~7sAXs58Da2859428594eusmtrp1b; Wed, 7 Oct 2020 10:47:11 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-2a-5f7d9cb05c38 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 66.4B.06314.FAC9D7F5; Wed, 7 Oct 2020 11:47:11 +0100 (BST) Received: from [106.210.88.143] (unknown [106.210.88.143]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201007104710eusmtip191849209bf06805c0437d3901896f954~7sAWmUm-z2861128611eusmtip1e; Wed, 7 Oct 2020 10:47:10 +0000 (GMT) Subject: Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM To: Daniel Vetter , Jason Gunthorpe Cc: DRI Development , LKML , Daniel Vetter , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Dan Williams , Linux MM , Linux ARM , Pawel Osciak , Kyungmin Park , Tomasz Figa , Inki Dae , Joonyoung Shim , Seung-Woo Kim , linux-samsung-soc , "open list:DMA BUFFER SHARING FRAMEWORK" , Oded Gabbay From: Marek Szyprowski Message-ID: Date: Wed, 7 Oct 2020 12:47:10 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SaUwTURSF8zrTmQEtPiqGqxKXxrglinXLSzSKxujERKO/XBLBKiOgbLaA 4EpoIIDgAhpqqYJ1QQgIomBFWUQUTZFVCSg7GIuxIosaIUEZxoV/3z333LxzksdRSjMzg/ML DBG0gRp/FeNIF774WbMkz3TKa1lk6XRiys1mSMrlWkSud7ZSJKPqLkXefOtjSFL7BZqkpuhl 5IrhJRojm4zc+2Bmia2tjiavoz6zJL+7UU4aikwMScgrkJO27F9yYqgpkZFa23s5uWT/yRJD ci9DBqNHGY9pfGpkHc0Xf0+n+UfGVpa/8aRXxucPJLH8S8MIzbefrZTx92+e4RP1Xxi+e7iX 4ftK3jL8uQdZiK9Kr2D5wfxZfMHge3rHlL2Oa70Ff78wQeu+br+j7+OWbCbY5hB+se08FYls bDxy4ACvhAR92Tgr8R0EjRkh8chxjIcQxNSflUnDIILE6tx/Fz3vfsilRQaCFx+LaWnoQ/BQ 3ywXXVMxgetpMTKRXfBWiK2IQaKJwo8YKLRYkLhgsBri7fGMyAq8DtqtDWM6x9F4HtRYtovy NHwArLVRrGRxhldXemiRHfBOiEpLGWcKz4aHdhMlsSu860kbjw24g4O8iq+MFHsTFNuj//BU +FT54E8dN7AmJ9DSgR5BZ3UOKw0JCBqiDEhyrYGW6mFGTEfhRZBb5C7JG+BW3Be5KAN2gia7 sxTCCZIKUyhJVkBsjFJyzwdj5d1/zz6tracuIJVxQjXjhDrGCXWM/99NR3QWchVCdQE+gk4d KBxbqtME6EIDfZYeDArIR2M/1zpaOWBB3+oPlCPMIdVkxe6jJ72Uck2YLiKgHAFHqVwUG19b PZUKb03EcUEb5KUN9Rd05WgmR6tcFSvMvfuU2EcTIhwRhGBB+3cr4xxmRKLV3W1Tou1pTudP +F6zHfQwx3kbB0jpzT0FJnbmClwRFPR8zq9VpV1Xk3e5Z4282eaxwHvhJ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C7bbDFH2V0LjU2Fay3 TUleF7ffODFu8+nY9PxzzlXNpKGY68/NTI5G+fwCu/9JS1ZIQnZTdT3/zmOjSbbwmCovUkoc VHVPi1Ats15P6F2huWbfoSDEOJ5dietF/i8Y0zPsRwMAAA== X-CMS-MailID: 20201007104711eucas1p1a1b0945d6b12e3260b210dfcb5756ab9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20201003094038eucas1p12aaafe0f52a7747bc2ba95ccb91d1651 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201003094038eucas1p12aaafe0f52a7747bc2ba95ccb91d1651 References: <20201002175303.390363-1-daniel.vetter@ffwll.ch> <20201002175303.390363-2-daniel.vetter@ffwll.ch> <20201002180603.GL9916@ziepe.ca> <20201002233118.GM9916@ziepe.ca> 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: Hi Daniel, On 03.10.2020 11:40, Daniel Vetter wrote: >> After he three places above should use pin_user_pages_fast(), then >> this whole broken API should be moved into videobuf2-memops.c and a >> big fat "THIS DOESN'T WORK" stuck on it. >> >> videobuf2 should probably use P2P DMA buf for this instead. > Yup this should be done with dma_buf instead, and v4l has that. Yes, V4L2 has dma_buf support NOW. That days, using so called V4L2 USERPTR method was the only way to achieve zero copy buffer sharing between devices, so this is just a historical baggage. I've been actively involved in implementing that. I've tried to make it secure as much as possible assuming the limitation of that approach. With a few assumptions it works fine. Buffers are refcounted both by the vm_ops->open or by incrementing the refcount of the vm->file. This basically works with any sane driver, which doesn't free the mmaped buffer until the file is released. This is true for V4L2 and FBdev devices. This API is considered as deprecated in V4L2 world, so I think supporting this hack can be removed one day as nowadays userspace should use dma buf. > ... Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland