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,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 E9A7FC4727F for ; Wed, 7 Oct 2020 12:02:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5439420B1F for ; Wed, 7 Oct 2020 12:01:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="PyaZ/nvZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5439420B1F 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 3C77E6B005C; Wed, 7 Oct 2020 08:01:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 377DA6B0062; Wed, 7 Oct 2020 08:01:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 266916B0068; Wed, 7 Oct 2020 08:01:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id ED9DA6B005C for ; Wed, 7 Oct 2020 08:01:57 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6D33A180AD811 for ; Wed, 7 Oct 2020 12:01:57 +0000 (UTC) X-FDA: 77344990674.05.shop09_160c083271cf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 59A001826B6AB for ; Wed, 7 Oct 2020 12:01:57 +0000 (UTC) X-HE-Tag: shop09_160c083271cf X-Filterd-Recvd-Size: 5237 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 7 Oct 2020 12:01:56 +0000 (UTC) Received: by mail-ot1-f67.google.com with SMTP id m13so1883711otl.9 for ; Wed, 07 Oct 2020 05:01:56 -0700 (PDT) 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=BPNKg367DCdKIY1liYpuVsKddqsM3ARJiczmrER9Tlk=; b=PyaZ/nvZm2QUtaJTzV68PXra5E6nusMzfq2GtX+T4KHdWVm++EJydv/8XaGh5nYPu2 kpLCfkP523at8+kzTLYGiJF/U5HARJ4ZwyhXlTfgO1W6ZvOLzle/fawTahYRmxpmawyG M2mKVfCZhp95638KHshmfZX9XnDxeTLsbzpOk= 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=BPNKg367DCdKIY1liYpuVsKddqsM3ARJiczmrER9Tlk=; b=t1H4YNoQ/xFv6WTIsYQ6KQVbFsvO1ertYHcXN0g8/k2K27zjjBBETKjw8iJL6zpuTu Smwknj5/kM65trrFG/7n97t6tNybq7nUd/2+LRlOkBXkskM9uKzZJLDANQNUsHTtyX8O ek5Ok6YjeinIt3R5cZSqGhkQxibieYz8p3UoevibQvcFoGAvalQbcDDr8G4RNQmXTsNl +OHt5e5fVw1eqRBYnEXJrYiuyE8lFCbdaVG7XoSK7V0XS7rWiVKkxrEIfuPUbSZQBvvY 99P9w+PztQuWru18yFPKTnN7B1F034ey5h1jMrrthCdb7KzQWn7dtG/Zovvr7OBV4f45 tqSw== X-Gm-Message-State: AOAM532I4G1qAzaXEl5H9cbKFrjhTvx5KUezOUoF3klAdl8vbUjE2tqb eFnX3AauIsOOTppssrbowFiz/uQTjNp9OJw7jtjZUQ== X-Google-Smtp-Source: ABdhPJwz1+Mjs5/TsMc3YtWSj3uN1hN+EFq4HjqQKny0ZO2DNmwXaAg21800jfJ4gXIzTu9U81dtoIfG8VEkup1Khs8= X-Received: by 2002:a05:6830:1c3c:: with SMTP id f28mr1747283ote.188.1602072115550; Wed, 07 Oct 2020 05:01:55 -0700 (PDT) MIME-Version: 1.0 References: <20201002175303.390363-1-daniel.vetter@ffwll.ch> <20201002175303.390363-2-daniel.vetter@ffwll.ch> <20201002180603.GL9916@ziepe.ca> <20201002233118.GM9916@ziepe.ca> In-Reply-To: From: Daniel Vetter Date: Wed, 7 Oct 2020 14:01:44 +0200 Message-ID: Subject: Re: [PATCH 2/2] mm/frame-vec: use FOLL_LONGTERM To: Marek Szyprowski Cc: Jason Gunthorpe , 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 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, Oct 7, 2020 at 12:47 PM Marek Szyprowski wrote: > > 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. I'm not seeing any of that vm->file refcounting going on, so not seeing anything that prevents the mmap area from being removed. Can you pls give me some pointers about which code you're thinking of? -Daniel > 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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch