Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2057903lqo; Mon, 13 May 2024 06:51:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdWiu2zuAZ8tFUqNz7ixMqVkvnhs1jB+UXbTx287Le2kMYn5IJpqhXMk7MF74mNhtNVe/QV5ZHCNS1sWVoJjS/zhNMApD0gyJ8QVchow== X-Google-Smtp-Source: AGHT+IFs4ayNd1Je2s8CZ9gB0wpL1e1GqRrZTvfAPQTendA5OTgRXLAVtWRpqhq5dk1IfnKF+kIY X-Received: by 2002:a50:8d50:0:b0:572:6ae4:a9ac with SMTP id 4fb4d7f45d1cf-5734d5e35d6mr7461295a12.21.1715608305413; Mon, 13 May 2024 06:51:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715608305; cv=pass; d=google.com; s=arc-20160816; b=g9wGTCminyaYnzQZ3ZIspZ+jYwFDvNB2kbUAYfqZGLV6EXXKjyejNje2hFLJ9bW7Ys 6hm44be0Ulp9bbSVuLgNe3ROrEjmZZ7E54KVInpS0GHjvE7qDAeAKC2yyT0cBFORh4/x c1c/t/ZR8NpEFROviM5hZLFd8RTEi7xOixCXsLCnJp/G2PYmdZsYFN1tKrDUoToGnn5x W8myf97r1eCxat3K40h4g3iL0aYo4vAAx2NQziA5hZun/xRc5uRGl5Y7C+EydsaX4y+Z UH6DSCFEFww98/VR+h9nK/fkthB5/VGiQQvOgVO34tF7F6YjUrsyLu+UcUhL6K6jYZab NWGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=rCp4a/BDWi17CHMvgY5xOFl3QoPKRxwfeBuT/Fb98Nk=; fh=BEtGUyfyTP4syirfsCIhtwxlR87UjTIVKTnaF4vb6D8=; b=aDwEPZsa9WaAuJhuQWbulrTIt7rvPKfPDVk1T4bdx3tJjFKE10ZISa8oDDmRPfg3m/ CXdBpXEbwy5No0R+NLC558RFmbJjQAFiKKJ+633cgo4z314ZP+DRUCPJS2cnaef8t4fD 0lh9VOo2IJkXQ94R2HFeaw6kC1A3nDKTKRktvvObrD2bu3Jg3Lef5pBIzZT3oHlao4C2 PkSJE46AXpktOa+sR8OjuXo55E3ZZ6GuPuN59zDNQKp7WEqPPIfU0EGb2kid5YllTuiT kWuNtv3xlV6e1iJ1jfRXF8685d0nOFtj3+H9hcyu/zzaWTWAW7MIbIe8VIe+z+OCqJPa J+QQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail3 header.b=aWKGTxcY; arc=pass (i=1 spf=pass spfdomain=emersion.fr dkim=pass dkdomain=emersion.fr dmarc=pass fromdomain=emersion.fr); spf=pass (google.com: domain of linux-kernel+bounces-177657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177657-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733beacff4si4955515a12.21.2024.05.13.06.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 06:51:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail3 header.b=aWKGTxcY; arc=pass (i=1 spf=pass spfdomain=emersion.fr dkim=pass dkdomain=emersion.fr dmarc=pass fromdomain=emersion.fr); spf=pass (google.com: domain of linux-kernel+bounces-177657-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177657-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr 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 293A81F22020 for ; Mon, 13 May 2024 13:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6889A153581; Mon, 13 May 2024 13:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=emersion.fr header.i=@emersion.fr header.b="aWKGTxcY" Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) (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 E80AF145B10 for ; Mon, 13 May 2024 13:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.40.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715608299; cv=none; b=MhVMOQ8VU8fH5EjFX2Tekh/JcSsXtVgozF5dtpzwqiUDBjwgVQ2cggG7Ncd+HMNuYeBE6QrjrxL6uy6sE2dSGz/Yx/SKT+mrEujoF1R4uMkVWIbL59ObAdOJgYBaGPSRL+DlsvkSp+Yysfy+UrakKmB3Eyg58Kq2bNEiatY+Po8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715608299; c=relaxed/simple; bh=rCp4a/BDWi17CHMvgY5xOFl3QoPKRxwfeBuT/Fb98Nk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SprnRPAO9+Fm+aKEP7WgasR3A5DsgVIdoMhvwHa0GW3kZp2RYjt2qzQaYviSNNdfzhNo0+IHyVt0Tb2C+ZbIJi3QXqIyT5bGyzZp1Mv+waL5v/53SmL0pFD4U4TbiCoTwIP+xbMLWD8j2OLePZzp37Zu5gQZIhY2MlJFxJy1bBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=emersion.fr; spf=pass smtp.mailfrom=emersion.fr; dkim=pass (2048-bit key) header.d=emersion.fr header.i=@emersion.fr header.b=aWKGTxcY; arc=none smtp.client-ip=185.70.40.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=emersion.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emersion.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1715608289; x=1715867489; bh=rCp4a/BDWi17CHMvgY5xOFl3QoPKRxwfeBuT/Fb98Nk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=aWKGTxcY4wKQzfazyx23U28lrFiumZcz/zIWjprWPjlb+90HEZ3QinH0QcLZhB0w1 AU+tYlAaAjNrUCRfki7nrcCXtQjCFzjBSva5vjijed5vbJr6GWsUQlPalvQJ5y97Rt hOddSllCePkYcy/13GUkJzkFK4K4f5X4V/AkRM+Oj/Fb5m4h9mGAeYfzGiElsKBUSS Ne2uofSfC78mYkVdNUrDxiZpK5IMOdrgD2qV6pT7wO7I5IoSJ2IVqiRfPQvcPeF5bg w4B9PkQd4Pt96uvhvTkfJt2RJUYEAKdGj4GKMpLuYSzLfAzHL6UWqPQV0ypt4Ie8yZ LS37it/d2kEgw== Date: Mon, 13 May 2024 13:51:23 +0000 To: Daniel Vetter From: Simon Ser Cc: Daniel Stone , Hans de Goede , Maxime Ripard , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , =?utf-8?Q?Christian_K=C3=B6nig?= , 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 , Bryan O'Donoghue , Milan Zamazal , Andrey Konovalov Subject: Re: Safety of opening up /dev/dma_heap/* to physically present users (udev uaccess tag) ? Message-ID: In-Reply-To: References: <20240506-dazzling-nippy-rhino-eabccd@houat> Feedback-ID: 1358184:user:proton X-Pm-Message-ID: d2a6e70754ffedf294a79e2c65504e513c8e9b24 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-Transfer-Encoding: quoted-printable On Wednesday, May 8th, 2024 at 17:49, Daniel Vetter wrote= : > On Wed, May 08, 2024 at 09:38:33AM +0100, Daniel Stone wrote: >=20 > > On Wed, 8 May 2024 at 09:33, Daniel Vetter daniel@ffwll.ch wrote: > >=20 > > > On Wed, May 08, 2024 at 06:46:53AM +0100, Daniel Stone wrote: > > >=20 > > > > That would have the unfortunate side effect of making sandboxed app= s > > > > less efficient on some platforms, since they wouldn't be able to do > > > > direct scanout anymore ... > > >=20 > > > I was assuming that everyone goes through pipewire, and ideally that = is > > > the only one that can even get at these special chardev. > > >=20 > > > If pipewire is only for sandboxed apps then yeah this aint great :-/ > >=20 > > No, PipeWire is fine, I mean graphical apps. > >=20 > > Right now, if your platform requires CMA for display, then the app > > needs access to the GPU render node and the display node too, in order > > to allocate buffers which the compositor can scan out directly. If it > > only has access to the render nodes and not the display node, it won't > > be able to allocate correctly, so its content will need a composition > > pass, i.e. performance penalty for sandboxing. But if it can allocate > > correctly, then hey, it can exhaust CMA just like heaps can. > >=20 > > Personally I think we'd be better off just allowing access and > > figuring out cgroups later. It's not like the OOM story is great > > generally, and hey, you can get there with just render nodes ... >=20 > Imo the right fix is to ask the compositor to allocate the buffers in thi= s > case, and then maybe have some kind of revoke/purge behaviour on these > buffers. Compositor has an actual idea of who's a candidate for direct > scanout after all, not the app. Or well at least force migrate the memory > from cma to shmem. >=20 > If you only whack cgroups on this issue you're still stuck in the world > where either all apps together can ddos the display or no one can > realistically direct scanout. >=20 > So yeah on the display side the problem isn't solved either, but we knew > that already. What makes scanout memory so special? The way I see it, any kind of memory will always be a limited resource: regular programs can exhaust system memory, as well as GPU VRAM, as well as scanout memory. I think we need to have ways to limit/control/arbiter the allocations regardless, and I don't think scanout memory should be a special case here.