Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp47378lqo; Tue, 7 May 2024 11:41:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpzvacnUfrpfUd1KUFlx/Njjsjvg/+ovFFVQWn5S8oilic+cIexwdpn8l676Zx3qXT/EBTQluHHHXJsMJgYHzv0nLIDdCB+Gz1Yld6eQ== X-Google-Smtp-Source: AGHT+IE+s1zHOufFAcada1tlJDjV/ox1PH9EkLnGf2+pEi+sgdls72ICHizpfWaQkjNPN/J3awvW X-Received: by 2002:a17:907:9623:b0:a59:a18e:3fda with SMTP id a640c23a62f3a-a59fb9dc8d0mr19030766b.68.1715107271824; Tue, 07 May 2024 11:41:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715107271; cv=pass; d=google.com; s=arc-20160816; b=JnUnOKeV82pUi+rplchfNTj/AKwFp2Gav12GW+VAU0uk480nqrhZla0IYsOjdqG0yZ 9phsWTvqmP0FrBLUkZkKFAz4UWj24/FqjJscFDe5RcQQnFBGdEeRmLYyuZ1oXx5QSvcH iHdrqH/XUANfmcLQ3iBjOL9qby2tgZQDI1Oz4wKNYxp5tpULNnYJzz6tlI4K0AmHww1R BFpjyISeC8bPGlriMLF2XaBF9VOQfOvnOyS07nkKwGnt0IzDWaZM7/QModR2DjkehfAq c1wFd4kbgXK1FVEW6bdJxrXeVo+5RGOnACDE56vCwgXcrtnFnD63iGuKoZTAaReOTCMj oWIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Uj8rzvCheuE0ys95edLMBOwZoKnAQh21zaAaZ8/BrIk=; fh=ZQIxunv0YZrgaSQVO1XZUBv4Kxxhb3cD8DoV7TeL50o=; b=Wr4bWTELI81EnHuT604gFYW00XlUs+nU97iq96beWJIeridWA8GuIbZUSb94o+852I TpvmTLGiQANruS2/eDFIGK/2c3Dl22YEGMprBz+tO86Jy2qCSfJ89R/NzrqISlvl7hjJ EIXQKmljSrHd9yZRix+72PLV6K+v3TLX7XO9Axk77UIT9SQG4tewPbmp+D2iPl4m/KoG EgFEW4i8YgUBrBuQ1TPibYWyHuYUFssGxiWECy65CoSD6pyIpaKyYVlMyXmrCjQsRo2+ IHpeeaKYKScxwR/1aPW6FfE6RBAKmOxBaD7kdqeEUmC9hQLxJdaCoqnUn7nrc0LaFoL1 UUmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JNScMGGU; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-171995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171995-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w18-20020a170906481200b00a59d0f6ba79si2377241ejq.508.2024.05.07.11.41.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 11:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=JNScMGGU; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-171995-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171995-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7C4851F21133 for ; Tue, 7 May 2024 18:41:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EBCC16D9A7; Tue, 7 May 2024 18:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JNScMGGU" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25B064C8A; Tue, 7 May 2024 18:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107262; cv=none; b=V2Z1F8XrSRUtGkq36ZJc8w4UIUswPdMPXwe6QVuHg2wQykiu/skpqUOjdO7xPEPwDF6hQ83hoe/0KpZ8LUOKM+5jBUAjVEoshf6U0AM88GaXCoztoAD+3FXQGeC6+KIKDaiDnVFqIxsxB1u2Xtj2tKSCj8Kew9Yh2VZjKdnEODU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715107262; c=relaxed/simple; bh=p/IcQ+0/ki9c8UCWMn4TWKcFEbdzwdDYzo4liTtC+UQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bkdXQAkiOPGqCM4b4moBk6726jlD41IVbUOuLSesT8cWRMvunBvdmwwiK4gxUK8WF1135JW/9p3vrQF33WzEtaCOjo+ls1LyocADA64nCBxX4+VjgMZopHuSge085OSoI99AXySK1BdPyWuU6wB0RsAx372Au8jhR8CKfXEBdU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=JNScMGGU; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1CAD6DFB; Tue, 7 May 2024 20:40:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1715107255; bh=p/IcQ+0/ki9c8UCWMn4TWKcFEbdzwdDYzo4liTtC+UQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JNScMGGUJG2sgxS4xzdnjIukoaTm8RZYSIgz/Z5KYcogo+BSxUuAHo7wZ2NMnBOpM eukL/PAEpt7XhyDnZ9FleFCwIM9lNk4nfeaTOPb9VJWokA5AXu1z1IqtlQcqjW0eGd d1LOymbOTEeLfLCAYecjZXXCzuAYBYIDyBol0rGs= Date: Tue, 7 May 2024 21:40:49 +0300 From: Laurent Pinchart To: Dmitry Baryshkov Cc: Bryan O'Donoghue , Hans de Goede , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , Christian =?utf-8?B?S8O2bmln?= , Lennart Poettering , Robert Mader , Sebastien Bacher , Linux Media Mailing List , "dri-devel@lists.freedesktop.org" , linaro-mm-sig@lists.linaro.org, Linux Kernel Mailing List , Milan Zamazal , Maxime Ripard , Andrey Konovalov Subject: Re: Safety of opening up /dev/dma_heap/* to physically present users (udev uaccess tag) ? Message-ID: <20240507184049.GC20390@pendragon.ideasonboard.com> References: <3c0c7e7e-1530-411b-b7a4-9f13e0ff1f9e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, May 07, 2024 at 06:19:18PM +0300, Dmitry Baryshkov wrote: > On Tue, 7 May 2024 at 18:15, Bryan O'Donoghue wrote: > > On 07/05/2024 16:09, Dmitry Baryshkov wrote: > > > Ah, I see. Then why do you require the DMA-ble buffer at all? If you are > > > providing data to VPU or DRM, then you should be able to get the buffer > > > from the data-consuming device. > > > > Because we don't necessarily know what the consuming device is, if any. > > > > Could be VPU, could be Zoom/Hangouts via pipewire, could for argument > > sake be GPU or DSP. > > > > Also if we introduce a dependency on another device to allocate the > > output buffers - say always taking the output buffer from the GPU, then > > we've added another dependency which is more difficult to guarantee > > across different arches. > > Yes. And it should be expected. It's a consumer who knows the > restrictions on the buffer. As I wrote, Zoom/Hangouts should not > require a DMA buffer at all. Why not ? If you want to capture to a buffer that you then compose on the screen without copying data, dma-buf is the way to go. That's the Linux solution for buffer sharing. > Applications should be able to allocate > the buffer out of the generic memory. If applications really want to copy data and degrade performance, they are free to shoot themselves in the foot of course. Applications (or compositors) need to support copying as a fallback in the worst case, but all components should at least aim for the zero-copy case. > GPUs might also have different > requirements. Consider GPUs with VRAM. It might be beneficial to > allocate a buffer out of VRAM rather than generic DMA mem. Absolutely. For that we need a centralized device memory allocator in userspace. An effort was started by James Jones in 2016, see [1]. It has unfortunately stalled. If I didn't have a camera framework to develop, I would try to tackle that issue :-) [1] https://www.x.org/wiki/Events/XDC2016/Program/Unix_Device_Memory_Allocation.pdf -- Regards, Laurent Pinchart