Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp631198lqo; Wed, 8 May 2024 09:54:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUCR4c+gaFVkPHPUuyRPt2fJ7DyuC9ijzlHZ1R94jGxIVoZpVIeyJhF9uVyjLVA6x98y14cS+wJNssluhtwVgBouC7FVPXT4g6enMpVw== X-Google-Smtp-Source: AGHT+IFNIPh5xV0VE81Ohpo4jDSVzfjjmUOew0TSPqjSl0tQISM8VvYloK4Nuw2VW/ejtb0Elva8 X-Received: by 2002:a17:90b:1207:b0:2a4:833f:2c1b with SMTP id 98e67ed59e1d1-2b61639cb22mr3524645a91.9.1715187276504; Wed, 08 May 2024 09:54:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715187276; cv=pass; d=google.com; s=arc-20160816; b=w9H+ufIb8n3B/8LP+PXXzhaq0L374kYClb1bX8jL3qHZOCrPkLtMfdKKTKJXrX3XyM qJt5jYrWZjIjHP2Ohp/EGDWNS6E70LMU9aLXrpqng3CFFEys0jy3wXdnwCOCegSgCClz JXZhApve0LE1N/4bMluYPqRgmmUv46nHgCtn/MT7aMu8BMx9MvhRPD0Rr5ECBPAHeTM+ dT+LJ0MB3KOmzE2ukvMwYg+608GuA+nXJVyXz+05v0LUeefXwEX8mR+5LWzqHvrZSCvJ f4p6gKqXmd8ZT7Aoxqeb0qFZOvoKpThYmjQ6yhD4fbUMl0QDSaND02MHEyt/V/LYseaM mpvg== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=CoDqdwsBKbW6uamNTf2oglOPRrPuT52r8TIKcUq8IZI=; fh=wv+RGgDx/Zy1bjTuvDH6i3hb92LgtNuqvn4GYBwULnI=; b=wUvRNzQQAdXwVCqAvOEUi5ZBhj4FvXV4MQ1lysI9i1Jkf2KEztdJLjUddo/ojsNKcf 7/VTWwvPcojrhcEb6CGTNj2+Wh5EMl7KnhoibOkpsQ0vNXSh7FeSy9M/ceRpF5dkvUWz ocrIG9AGUkhiRwHzDbqSE8Y81s4QBW6+YYgjdbCcS219XU540lXSp4XYwiHlG/ARlMoJ jNzTS+VsmbwsTzLBHRIDKNQDLT2OCslBvW70Ur27jRkOybn5NAGwX7BceiyqPbox6Xv2 9K55ZwTCvKh5xc2lBpATgaloovxSLYWj8HqB20q8sMgJVrsyQurXhlEOH/eZUeJLeGeZ 5wmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="i9NmfYy/"; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-173508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173508-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o15-20020a17090a9f8f00b002b157e900b8si1700493pjp.116.2024.05.08.09.54.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 09:54:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b="i9NmfYy/"; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-173508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173508-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B5C7E28403F for ; Wed, 8 May 2024 15:49:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BADB712839F; Wed, 8 May 2024 15:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="i9NmfYy/" Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 651A91A2C05 for ; Wed, 8 May 2024 15:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715183356; cv=none; b=hUXBF+MS7VGkt+37zAekeG+2Nf5OaQdPu9UEN0T0RFwp8BsELQmm2Za/Dgq0I6gGPWKj8d3liQ7GNNg0Bc4qHMoC2P7ymzuD1ZJ67xebSC5QROU2TG9WeKXv/LM/ZN2M4LLldrlGoh6ld7/r/11n/m2lgQXTv4Ja/7bpjDgH6iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715183356; c=relaxed/simple; bh=dDldPAWgK3aHYxFKJeEMDAHPihDjHWlCbgRnE2GA0II=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WfeVZj/mjrUz6VX3noagYqn+WUzRQ9cW5Y/fFYQFbqONRWKCmYT6uONNMgVQtaWluOIVkitOJCOrQ9G34V50Ujum5TEyycjHFEHrY/BEiAbNfc1IPxkFQ1H4BQT7gk8RyaCMQ3Wp8Jg//xBTzmDLSTAXTiqhi0gwPWTUW3m3SrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=i9NmfYy/; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a59a86fb052so150489166b.0 for ; Wed, 08 May 2024 08:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1715183354; x=1715788154; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=CoDqdwsBKbW6uamNTf2oglOPRrPuT52r8TIKcUq8IZI=; b=i9NmfYy/riqdrrMCeh//gZF/MwoaYfymy7aP0+5sILKjmifMJwz9nRlO9w2nXSiqBO Lv+NtYL0qknyDjaYosvL7Ii3E25oQ5ZSJAzZWG63RRmjIj9Qp4GoVV6TCiNNwD+fYmTy NR6s8tiAasRCfChRaRSmr281HfQEeo+ezfsig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715183354; x=1715788154; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CoDqdwsBKbW6uamNTf2oglOPRrPuT52r8TIKcUq8IZI=; b=EfM5C6baYzGndeGY7UiG2Jz1I6EQRAAH63IlOTTP1mqPRJjYc77R6eb9jZBf0He13b HIiBvyBNSfw/BSrFUYZhePGX25o8wPSaPdFnGbDz/cZhocIk7Ccb3lJBvm+/TijmxGKq I3sus6iYWfDdkDoR+fB0vYWWkYvRzKbZJjF7QpwFP4VrJ6xzffpiU+JRIeF9ewuCLAYH AMZ3ssPgOJs90QXg+kg035VYeVpxgN62l8KlHm85k1EBwmvmia/w1bznJ7vb21xwab7o M3cPibMz4E09tfWPkDzRpTDpg2QuYHI9XpXywFJYojS1ih15LwPo+pMlu6m+BPxkQqGP m0nQ== X-Forwarded-Encrypted: i=1; AJvYcCUYBxw3KVj39CbavviGlKnVDvjRIgbdZHyKYHbKNmv6uO/hByr/ovx1HxVIIg6MyufJ4ymwnP6SfzG1h/BO5CZT3LQCaA86zEuzhmXe X-Gm-Message-State: AOJu0Yz2cP7076l3NHtHKeM/mkYq66y4cfdukoWbua5JNrl+pJ86bW1B B1jEysRaLKCwoqHc6zenwxwKzimgxAp1anRXRRM8Qis3rrL9mI3o2SiRy7GCv3U= X-Received: by 2002:a17:906:df14:b0:a59:bce9:8454 with SMTP id a640c23a62f3a-a59fb94f6d3mr192308366b.1.1715183353735; Wed, 08 May 2024 08:49:13 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id uz14-20020a170907118e00b00a599adfd49dsm6452017ejb.64.2024.05.08.08.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 08:49:13 -0700 (PDT) Date: Wed, 8 May 2024 17:49:11 +0200 From: Daniel Vetter To: Daniel Stone Cc: Hans de Goede , Maxime Ripard , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , Christian =?iso-8859-1?Q?K=F6nig?= , 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: Mail-Followup-To: Daniel Stone , Hans de Goede , Maxime Ripard , Sumit Semwal , Benjamin Gaignard , Brian Starkey , John Stultz , "T.J. Mercier" , Christian =?iso-8859-1?Q?K=F6nig?= , 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 References: <20240506-dazzling-nippy-rhino-eabccd@houat> 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=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 6.6.15-amd64 On Wed, May 08, 2024 at 09:38:33AM +0100, Daniel Stone wrote: > On Wed, 8 May 2024 at 09:33, Daniel Vetter wrote: > > On Wed, May 08, 2024 at 06:46:53AM +0100, Daniel Stone wrote: > > > That would have the unfortunate side effect of making sandboxed apps > > > less efficient on some platforms, since they wouldn't be able to do > > > direct scanout anymore ... > > > > I was assuming that everyone goes through pipewire, and ideally that is > > the only one that can even get at these special chardev. > > > > If pipewire is only for sandboxed apps then yeah this aint great :-/ > > No, PipeWire is fine, I mean graphical apps. > > 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. > > 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 ... Imo the right fix is to ask the compositor to allocate the buffers in this 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. 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. So yeah on the display side the problem isn't solved either, but we knew that already. -Sima -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch