Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp911585lqp; Thu, 23 May 2024 04:02:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+AewVgqyjxQLoa8PEKmqBsxFmV/kHf1uKkoFsd6lquK4kCwymWeh+4tsR5rerSNjelrCkye5cSdj6XpjPOrtFs0yrwWvuvz69EANuBw== X-Google-Smtp-Source: AGHT+IH3rvqwSk+FA3Iy9cVwed/GoZYQBDbAwB3HTqCs0zCX8cnHFZ1iH5CmHdKyPlLqGOuyRgpN X-Received: by 2002:a05:6402:1118:b0:578:3336:92b with SMTP id 4fb4d7f45d1cf-57833360a65mr2795210a12.0.1716462145384; Thu, 23 May 2024 04:02:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716462145; cv=pass; d=google.com; s=arc-20160816; b=AeE0xEzxToKvzrTfVRXlFa9/r8tm5utt26ENAKjYmo6Re/IyKcCn7iaKPp1vyFS8rB th73S1m5P7sVd0YNgQ8L3ZwXq1XeQiKG7n+4ZY1Q7MgVKgNAre6MxrCaBTL8bh6pn+Ge mDZcSHpj3FkzcKBHt286QLlVlR0oOkTQ2OtUP2JXDmITmZ5YrWikFwCYKD9lYK9cLPn7 i6TEc2015+lxllWNYTfDWh+/9VWDESUvZJ9C4QBngrxU/uRmPzBKECy2EIQeIQYg6AJo kFRhw+nfjOTrd5jWe+gFEnTU/g325KQTtZfnHHgV9xDrRkQf5SCA9ZyxMc+gmPocfnqo xLmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding: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=rua3OglaGtRzvLpfCStU07S245n5hB3FYrd8MuHxXyo=; fh=uQKqsH0oQW/+QC8trYEkWRDsu58wULEwgzeiQUWRpzE=; b=z3s00w+n0K0q4xpo16ZjxVbIRuBnWQMfgGhZ7r3ahVjpdJfLj/AwZYLResBSV0eHmR Qz/qfThmE4MxmbsPep/2xiNn5jaC/KRMWA13OWiWUwHFdfcrZrSl3u8NsbcQ0E6pyJoR lZ2Mm55b1EKnILW8tAqkjTCyCj9fC/cMC5N+q2dCMXv0Z8OH7enAB0zDeUBWtwheou43 9URkO2CvmLjNOTVAaMujXNyg+Mmx/MAc4Oz9zfX0bwtS5o4r7BfAAhX4EYU7NdnGgK0w C0gFVYS6S49bEzlJxrwFDOJXx5XAg71eRqVdcQCRjR8naqgO0A7QfgewwOWAvWc1u8tI Aieg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=NWhFxiDA; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-187290-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187290-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 4fb4d7f45d1cf-5733c327616si16981526a12.396.2024.05.23.04.02.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 04:02:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187290-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=@ffwll.ch header.s=google header.b=NWhFxiDA; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-187290-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187290-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 D612B1F22425 for ; Thu, 23 May 2024 09:45:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB43313D511; Thu, 23 May 2024 09:45:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="NWhFxiDA" Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 3781313A88D for ; Thu, 23 May 2024 09:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716457534; cv=none; b=mU3ubbCaJnPuDV8nSqF2HXBSr0pqbnJGAyy+yyaiFVEQ2+X6D84sMNeZCCHYHpdwS8TIeYYgu1q1oSmSgkXdKmrtnYsT8z15fTSmLIHAJJEqFs32AEaTyacz+VPMVmhve9NXJ9H6lIAdW4yW9u/eLO4WR+vk9JPM8QmGhwjtG/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716457534; c=relaxed/simple; bh=AKnmMDa3xsyKPpyTzzjMqUtRMDJBkMsw9OnRetaowUc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WOIUfypZ1oOovQSZ67w2IeslZZp2tM1ka99rJ3n95OGtTEhAVz7NVja8iMs3NaOL+CniXmKGdRM3brX2VB2QvQg/QKAB32DRzVeZszKhxRg1+yMTUk4L+I4SL2cVQP+ewml3afevPrvVofV4vQjO0CjUVz1cBKXF83Pdp9Xtt2c= 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=NWhFxiDA; arc=none smtp.client-ip=209.85.221.41 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-wr1-f41.google.com with SMTP id ffacd0b85a97d-354fadfd8b9so70702f8f.3 for ; Thu, 23 May 2024 02:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1716457531; x=1717062331; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding: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=rua3OglaGtRzvLpfCStU07S245n5hB3FYrd8MuHxXyo=; b=NWhFxiDAYYBwWPPiW3sg1oDiha23tvxlJbw7fPOYY1LX5Ko4Fzw/AbG8uFksH4io0n 1mIIPjYVHd8dH9qoTWUUU7CSaaNXaY6fBI1GMAgQdwnjey/NPn1/0r4qQYR1QfAnbxWM nM3eocl26+1ToWy2qU6/uRn1APAcQGZ722ig8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716457531; x=1717062331; h=in-reply-to:content-transfer-encoding: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=rua3OglaGtRzvLpfCStU07S245n5hB3FYrd8MuHxXyo=; b=By1ZFvBWqgRf7YaRYU7QBeA8SVvd+wnLF5jHABPaB4KQF8H58QEEykC3/srP9E/YFm qzgOR+nzlsZOwsjoSDzTAm45LheiUh46Jb3Z3gFzgbGvGG5sjUDaDLvXZls0uxfRqADY LF8yklIaZxtjqmjnqRXy93fUC7wNE74lUyvytnNnOISNR3H6Bgc3igbPFrfQj5cRzUMc A6zt4FMEZI4fNZNMVVWpaMPy2W9wt9Cpb4GpHQ/sRROETfm2art71Toua+1syDvhrK0N WghdzTa+Weyr0rrDDzPUejhuCYdMMJ0+AhExRnUcB6yZusmMIvrfQZHqke2p1FbiwTx4 JOjQ== X-Forwarded-Encrypted: i=1; AJvYcCWJrOcqFUwuoYzL29ZTNEkUuB0O3utbr0OZxfjLnhViLzzcYe2iQcbD4bpuR+bN4O1xipI3cxnz4zX+9wuSRqFtI4HYDYgsd8QFqzYf X-Gm-Message-State: AOJu0YyHidzu4fMUhnnzxNgYeRosiZuJMAw4f5f6WJTuMF+cf3KjtRdu 68Lk/PPkg77a/7/oM2mXN3M9DqoLM7C3SilqoBpwHAo2M1SfesimlQSpqJStR88= X-Received: by 2002:a05:600c:511e:b0:41b:e58c:e007 with SMTP id 5b1f17b1804b1-420fd386158mr32798045e9.4.1716457531398; Thu, 23 May 2024 02:45:31 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42100f7b7f9sm20030635e9.27.2024.05.23.02.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 02:45:30 -0700 (PDT) Date: Thu, 23 May 2024 11:45:28 +0200 From: Daniel Vetter To: Maxime Ripard Cc: John Stultz , Rob Herring , Saravana Kannan , Sumit Semwal , Benjamin Gaignard , Brian Starkey , "T.J. Mercier" , Christian =?iso-8859-1?Q?K=F6nig?= , Mattijs Korpershoek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH 0/8] dma-buf: heaps: Support carved-out heaps and ECC related-flags Message-ID: Mail-Followup-To: Maxime Ripard , John Stultz , Rob Herring , Saravana Kannan , Sumit Semwal , Benjamin Gaignard , Brian Starkey , "T.J. Mercier" , Christian =?iso-8859-1?Q?K=F6nig?= , Mattijs Korpershoek , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org References: <20240515-dma-buf-ecc-heap-v1-0-54cbbd049511@kernel.org> <20240522-coral-fennec-from-uranus-fb7263@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240522-coral-fennec-from-uranus-fb7263@houat> X-Operating-System: Linux phenom 6.8.9-amd64 On Wed, May 22, 2024 at 03:18:02PM +0200, Maxime Ripard wrote: > On Tue, May 21, 2024 at 02:06:19PM GMT, Daniel Vetter wrote: > > On Thu, May 16, 2024 at 09:51:35AM -0700, John Stultz wrote: > > > On Thu, May 16, 2024 at 3:56 AM Daniel Vetter wrote: > > > > On Wed, May 15, 2024 at 11:42:58AM -0700, John Stultz wrote: > > > > > But it makes me a little nervous to add a new generic allocation flag > > > > > for a feature most hardware doesn't support (yet, at least). So it's > > > > > hard to weigh how common the actual usage will be across all the > > > > > heaps. > > > > > > > > > > I apologize as my worry is mostly born out of seeing vendors really > > > > > push opaque feature flags in their old ion heaps, so in providing a > > > > > flags argument, it was mostly intended as an escape hatch for > > > > > obviously common attributes. So having the first be something that > > > > > seems reasonable, but isn't actually that common makes me fret some. > > > > > > > > > > So again, not an objection, just something for folks to stew on to > > > > > make sure this is really the right approach. > > > > > > > > Another good reason to go with full heap names instead of opaque flags on > > > > existing heaps is that with the former we can use symlinks in sysfs to > > > > specify heaps, with the latter we need a new idea. We haven't yet gotten > > > > around to implement this anywhere, but it's been in the dma-buf/heap todo > > > > since forever, and I like it as a design approach. So would be a good idea > > > > to not toss it. With that display would have symlinks to cma-ecc and cma, > > > > and rendering maybe cma-ecc, shmem, cma heaps (in priority order) for a > > > > SoC where the display needs contig memory for scanout. > > > > > > So indeed that is a good point to keep in mind, but I also think it > > > might re-inforce the choice of having ECC as a flag here. > > > > > > Since my understanding of the sysfs symlinks to heaps idea is about > > > being able to figure out a common heap from a collection of devices, > > > it's really about the ability for the driver to access the type of > > > memory. If ECC is just an attribute of the type of memory (as in this > > > patch series), it being on or off won't necessarily affect > > > compatibility of the buffer with the device. Similarly "uncached" > > > seems more of an attribute of memory type and not a type itself. > > > Hardware that can access non-contiguous "system" buffers can access > > > uncached system buffers. > > > > Yeah, but in graphics there's a wide band where "shit performance" is > > defacto "not useable (as intended at least)". > > Right, but "not useable" is still kind of usage dependent, which > reinforces the need for flags (and possibly some way to discover what > the heap supports). > > Like, if I just want to allocate a buffer for a single writeback frame, > then I probably don't have the same requirements than a compositor that > needs to output a frame at 120Hz. > > The former probably doesn't care about the buffer attributes aside that > it's accessible by the device. The latter probably can't make any kind > of compromise over what kind of memory characteristics it uses. > > If we look into the current discussions we have, a compositor would > probably need a buffer without ECC, non-secure, and probably wouldn't > care about caching and being physically contiguous. > > Libcamera's SoftISP would probably require that the buffer is cacheable, > non-secure, without ECC and might ask for physically contiguous buffers. > > As we add more memory types / attributes, I think being able to discover > and enforce a particular set of flags will be more and more important, > even more so if we tie heaps to devices, because it just gives a hint > about the memory being reachable from the device, but as you said, you > can still get a buffer with shit performance that won't be what you > want. > > > So if we limit the symlink idea to just making sure zero-copy access is > > possible, then we might not actually solve the real world problem we need > > to solve. And so the symlinks become somewhat useless, and we need to > > somewhere encode which flags you need to use with each symlink. > > > > But I also see the argument that there's a bit a combinatorial explosion > > possible. So I guess the question is where we want to handle it ... > > > > Also wondering whether we should get the symlink/allocator idea off the > > ground first, but given that that hasn't moved in a decade it might be too > > much. But then the question is, what userspace are we going to use for all > > these new heaps (or heaps with new flags)? > > For ECC here, the compositors are the obvious target. Which loops backs > into the discussion with John. Do you consider dma-buf code have the > same uapi requirements as DRM? Imo yes, otherwise we'll get really funny stuff like people bypass drm's userspace requirement for e.g. content protected buffers by just shipping the feature in a dma-buf heap ... Been there, done that. Also I think especially with interop across components there's a huge difference between a quick test program toy and the real thing. And dma-buf heaps are kinda all about cross component interop. -Sima -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch