Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1902326lqo; Mon, 13 May 2024 01:40:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVS9hezwvhxfcaly3qpQhjQHbLZAE1myBHUzkyu9LsmbVTqj4VF/P0Jv9UxuhFhvwJwSaevIH0CsbHUNO/7wV60fTnEylr8FKg1/5prEg== X-Google-Smtp-Source: AGHT+IGYCcI+6YqvdPbxz5j9XKA5tkpcz4xmqnYC/nV/yeA572iAddLhraKyqczhZLUlqcWWZR/8 X-Received: by 2002:a17:907:3208:b0:a59:ad15:6133 with SMTP id a640c23a62f3a-a5a2d6759d9mr741567466b.71.1715589608249; Mon, 13 May 2024 01:40:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715589608; cv=pass; d=google.com; s=arc-20160816; b=Woy/43PJCSPnL2RpqVtMOiP0tE9N3grxnOx3RU4hMemMHSUnssU1E5QFHLddhuaAky G8BbW6EkC9fzy71aGlpYO8/yAA64Kn5+WnAGaWEresI5l0n5A5eW3Ibxly+9vjM7D0uJ g+HyrvOT2qInJksaZ565WQKohek8+2Nvr1f/hsmCcwgpAuPs0IN/HHuNLmHYvk/UGX+k VZrBacN2HBGN4bhkfyyKjscxYv6Sj/Nz6jbwfWAxW5gw0KE6lria0oJLZxckoBYGHZAx 5WPOM4rryrZ8AO1luuCLIRdmPC42GjBq3oOA+oVbAjjncRR/gelfxR8Q0iQtBCHrXLrz NSQw== 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=NafnT6nxtfip1QG/byPJKrL48bOdfUlcszFB+gXZGRk=; fh=gJDQbzEXDVbWTqLxiehJA//WmgcU5f4aSiNzrGY6Xg0=; b=X8Blwt2ksMisV37IQMAhNJtxc/3PF1UJvcNTsWNbFgDqPJEgRn2mD6fV8j7PZ6IsYT RYAsi9OOKE8MEgteoSypZSFxz8vbv7KNZDX2zST5RonhHqZdDSSBBOhJBW5pgGKdSd26 MfbZpI7J0sK+WZzzY/2zqTQ3ctGqmwRN8HWeO3zLVtb/GOgticIYBJV08W6iFLWxo1nV ch2FSn73EJsHp1W8EjTxeq2Wcg7em+ZAd8SlcpYv/ViZUiyjCnqe7GHa4YVOs3Do8DTz Iymz23YF2NFAflR7pQdEzqG/C//V9GXVWjM3xeZk/aoWH5qcLVrw8Qqmq6OGowqdhz8T 5d2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hVGXIn4S; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-177355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba2ad7si502696066b.553.2024.05.13.01.40.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 01:40:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177355-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 header.i=@redhat.com header.s=mimecast20190719 header.b=hVGXIn4S; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-177355-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 CBC141F21F35 for ; Mon, 13 May 2024 08:40:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 599491482F0; Mon, 13 May 2024 08:40:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hVGXIn4S" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C6D69147C8F for ; Mon, 13 May 2024 08:39:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715589599; cv=none; b=s6SLWVK88PX6q+c/UV8d8rUzCsItVwh7lrg7uUiFVocrmn/3Kk8WT28Dx4s8RuuI4MhkUq/NxE2g2OzM0R2Bn2pwqjHWP60JpFkZWqpfwEsea7betKV1iflhuFN2JuUp6IL4+4HyvzUIY0oVsvOcTBH+ApfE9/xRfTBK47GVLeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715589599; c=relaxed/simple; bh=NafnT6nxtfip1QG/byPJKrL48bOdfUlcszFB+gXZGRk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RXtC60wy8KokgnjTuzVV2Xdcbe1ODdyxH74DEnoHtO8SuWnABbp5eDddU+4qWgpEVTJlaTmMGb+mJ5Ofb5Ff7rGXVU65UMODPJkomCqL4XjhuFY+HtZs8+i8ACnFxwnXKh8j86n7baJERzQRlq25TMQX9uyEDkng4g0urVFznrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hVGXIn4S; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715589596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NafnT6nxtfip1QG/byPJKrL48bOdfUlcszFB+gXZGRk=; b=hVGXIn4S/exlX1urmj+PfuzWgXZkp9iMCjqmtseVX6ZczbcguadZIu8NTaQGWrGRhy1h2v yASVuLhYl3s1TXM6kllaa10OFfcekjNh3qE0I71W0cB3it26p/bXnpLq70EVYdbBxr2JiJ EWgx8PLWCwyi1GwsU3RyC4EJRoK3mNw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-462-g7u-hQicPg-DezHkK-QerA-1; Mon, 13 May 2024 04:39:50 -0400 X-MC-Unique: g7u-hQicPg-DezHkK-QerA-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41fe6df6ef3so14287825e9.2 for ; Mon, 13 May 2024 01:39:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715589589; x=1716194389; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NafnT6nxtfip1QG/byPJKrL48bOdfUlcszFB+gXZGRk=; b=st28+3yTBAbFt8sOGwQDjg8Qgggio3aYd22lAGHrkWHwmH3aI4yLhTuthSyhB6g0zO ZvJ76md2rQtPi1HnEEK1+x0JeGh5pGFxaBqeYV8YQT+g2KCXf40Y1I4jkH4rgDbTa8kL X05bcFWmU64PpgZNekjZxm4o2BXXcSZLqxS8rZ1ay/snHlbpO8DFyfzVFxIupfPrNZSn kV+3jsJxePpq0RJRYlBjnpOiMEfJo3i0kvG81cIFaQzHkpuWYw6wN78kPCG0OoaKaJ9c c1dPVK1nAvXONkBkIjircis1hpQVaXCHhpYcRMijh6SXlfxQ01TSz6eUt1k61LKt6vLI i+rg== X-Forwarded-Encrypted: i=1; AJvYcCUxqXaO2js6t/HejWTv/Igp/yM9gZ9zz5i1X5tK+22a402Rr7h4rABFxj0J0wBSUNgzF/X4r2D4PgT/uXyIPP9/Ia7nHKKqfgj02SnU X-Gm-Message-State: AOJu0YwZtv/H+h+1Ek/nLP2DcktVPb88MIqfD1/U5HDi+Uypj7xNWIGf XwFdK/owP6ySkjbIPBaH7503Kh0P4S5N6qfubH04PL4svpMIHGSAyBW5Nz8uBNdVjkNPg9iSPvc suc9xYqF6w3Lqy3+QPdcH4LT/sHx5fSkY7zFDntldUFtn6tspEYcHdIZFuaQMzg== X-Received: by 2002:a05:600c:3caa:b0:41b:55b1:6cfc with SMTP id 5b1f17b1804b1-41feaa2f3a3mr60665345e9.1.1715589589263; Mon, 13 May 2024 01:39:49 -0700 (PDT) X-Received: by 2002:a05:600c:3caa:b0:41b:55b1:6cfc with SMTP id 5b1f17b1804b1-41feaa2f3a3mr60665135e9.1.1715589588807; Mon, 13 May 2024 01:39:48 -0700 (PDT) Received: from localhost ([2a01:e34:ec60:48a0:b89c:e3fb:cb18:893d]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f87b2648fsm185332075e9.7.2024.05.13.01.39.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 01:39:48 -0700 (PDT) Date: Mon, 13 May 2024 10:39:48 +0200 From: Maxime Ripard To: Dmitry Baryshkov Cc: Laurent Pinchart , 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 , Andrey Konovalov Subject: Re: Safety of opening up /dev/dma_heap/* to physically present users (udev uaccess tag) ? Message-ID: <20240513-delectable-busy-serval-fbe3fe@penduick> References: <3c0c7e7e-1530-411b-b7a4-9f13e0ff1f9e@redhat.com> <20240507184049.GC20390@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="qh6aaiqzlccizapn" Content-Disposition: inline In-Reply-To: --qh6aaiqzlccizapn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 07, 2024 at 10:59:42PM +0300, Dmitry Baryshkov wrote: > On Tue, 7 May 2024 at 21:40, Laurent Pinchart > wrote: > > > > 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 argume= nt > > > > 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. >=20 > Yes. But it should be allocated by the DRM driver. As Sima wrote, > there is no guarantee that the buffer allocated from dma-heaps is > accessible to the GPU. And there is no guarantee that the buffer allocated from the GPU is accessible to the display engine. In practice, I've yet to see an issue with that assumption. And there's the other elephant in the room that hasn't been addressed. Buffers typically allocated by the data-consuming frameworks are coherent buffers, which on arm/arm64 usually mean non-cacheable. Performances are *terrible*. Meanwhile, dma-heaps and dma-buf provide cacheable buffers with a cache synchronization API, which allow to have it run much faster. Maxime --qh6aaiqzlccizapn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZkHR0wAKCRAnX84Zoj2+ dmpnAYCn9sxfeRSm1Faf0OjKfvfKYpA6+XhCEJJVQzH6jGId/Sk32BahqCR3ZucO /1TsALQBf160+BzC2jF6k7Xud+ixD5QuBdXfxo6UziSenQ1ClVh2UFdyf0TG2Tzj I+TfIOqSEg== =cY/A -----END PGP SIGNATURE----- --qh6aaiqzlccizapn--