linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@redhat.com>
To: John Stultz <jstultz@google.com>
Cc: "Sumit Semwal" <sumit.semwal@linaro.org>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Brian Starkey" <Brian.Starkey@arm.com>,
	"T.J. Mercier" <tjmercier@google.com>,
	"Christian König" <christian.koenig@amd.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org
Subject: Re: ECC memory semantics for heaps
Date: Mon, 4 Mar 2024 14:46:39 +0100	[thread overview]
Message-ID: <20240304-bizarre-quizzical-dugong-caec1a@houat> (raw)
In-Reply-To: <CANDhNCquJn6bH3KxKf65BWiTYLVqSd9892-xtFDHHqqyrroCMQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]

Hi John,

Thanks for your answer

On Wed, Feb 28, 2024 at 08:17:55PM -0800, John Stultz wrote:
> On Wed, Feb 28, 2024 at 7:24 AM Maxime Ripard <mripard@redhat.com> wrote:
> >
> > I'm currently working on a platform that seems to have togglable RAM ECC
> > support. Enabling ECC reduces the memory capacity and memory bandwidth,
> > so while it's a good idea to protect most of the system, it's not worth
> > it for things like framebuffers that won't really be affected by a
> > bitflip.
> >
> > It's currently setup by enabling ECC on the entire memory, and then
> > having a region of memory where ECC is disabled and where we're supposed
> > to allocate from for allocations that don't need it.
> >
> > My first thought to support this was to create a reserved memory region
> > for the !ECC memory, and to create a heap to allocate buffers from that
> > region. That would leave the system protected by ECC, while enabling
> > userspace to be nicer to the system by allocating buffers from the !ECC
> > region if it doesn't need it.
> >
> > However, this creates basically a new combination compared to the one we
> > already have (ie, physically contiguous vs virtually contiguous), and we
> > probably would want to throw in cacheable vs non-cacheable too.
> >
> > If we had to provide new heaps for each variation, we would have 8 heaps
> > (and 6 new ones), which could be fine I guess but would still increase
> > quite a lot the number of heaps we have so far.
> >
> > Is it something that would be a problem? If it is, do you see another
> > way to support those kind of allocations (like providing hints through
> > the ioctl maybe?)?
> 
> So, the dma-buf heaps interface uses chardevs so that we can have a
> lot of flexibility in the types of heaps (and don't have the risk of
> bitmask exhaustion like ION had). So I don't see adding many
> differently named heaps as particularly problematic.

Ok

> That said, if there are truly generic properties (cacheable vs
> non-cachable is maybe one of those) which apply to most heaps, I'm
> open to making use of the flags. But I want to avoid having per-heap
> flags, it really needs to be a generic attribute.
> 
> And I personally don't mind the idea of having things added as heaps
> initially, and potentially upgrading them to flags if needed (allowing
> heap drivers to optionally enumerate the old chardevs behind a config
> option for backwards compatibility).
> 
> How common is the hardware that is going to provide this configurable
> ECC option

In terms of number of SoCs with the feature, it's probably a handful. In
terms of number of units shipped, we're in the fairly common range :)

> and will you really want the option on all of the heap types?

Aside from the cacheable/uncacheable discussion, yes. We could probably
get away with only physically contiguous allocations at the moment
though, I'll double check.

> Will there be any hardware constraint limitations caused by the
> ECC/!ECC flags? (ie: Devices that can't use !ECC allocated buffers?)

My understanding is that there's no device restriction. It will be a
carved out memory so we will need to maintain a separate pool and it
will be limited in size, but that's pretty much the only one afaik.

> If not, I wonder if it would make sense to have something more along
> the lines using a fcntl()  like how F_SEAL_* is used with memfds?
> With some of the discussion around "restricted"/"secure" heaps that
> can change state, I've liked this idea of just allocating dmabufs from
> normal heaps and then using fcntl or something similar to modify
> properties of the buffer that are separate from the type of memory
> that is needed to be allocated to satisfy device constraints.

Sorry, I'm not super familiar with F_SEAL so I don't really follow what
you have in mind here. Do you have any additional resources I could read
to understand better what you're thinking about?

Also, if we were to modify the ECC attributes after the dma-buf has been
allocated by dma-buf, and if the !ECC memory is carved out only, then
wouldn't that mean we would need to reallocate the backing buffer for
that dma-buf?

Thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-03-04 13:46 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 18:13 [PATCH v7 00/36] drm/connector: Create HDMI Connector infrastructure Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 01/36] drm/tests: helpers: Include missing drm_drv header Maxime Ripard
2024-02-26 10:42   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 02/36] drm/tests: helpers: Add atomic helpers Maxime Ripard
2024-02-26 12:23   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 03/36] drm/tests: Add helper to create mock plane Maxime Ripard
2024-02-26 12:24   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 04/36] drm/tests: Add helper to create mock crtc Maxime Ripard
2024-02-26 12:26   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 05/36] drm/tests: connector: Add tests for drmm_connector_init Maxime Ripard
2024-02-26 12:27   ` Maíra Canal
2024-02-28 15:40   ` (subset) " Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 06/36] drm/connector: Introduce an HDMI connector initialization function Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 07/36] drm/tests: connector: Add tests for drmm_connector_hdmi_init Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 08/36] drm/connector: hdmi: Create an HDMI sub-state Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 09/36] drm/connector: hdmi: Add output BPC to the connector state Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 10/36] drm/tests: Add output bpc tests Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 11/36] drm/connector: hdmi: Add support for output format Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 12/36] drm/tests: Add output formats tests Maxime Ripard
2024-02-22 18:13 ` [PATCH v7 13/36] drm/connector: hdmi: Add HDMI compute clock helper Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 14/36] drm/tests: Add HDMI TDMS character rate tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 15/36] drm/connector: hdmi: Calculate TMDS character rate Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 16/36] drm/tests: Add TDMS character rate connector state tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 17/36] drm/connector: hdmi: Add custom hook to filter TMDS character rate Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 18/36] drm/tests: Add HDMI connector rate filter hook tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 19/36] drm/connector: hdmi: Compute bpc and format automatically Maxime Ripard
2024-02-25 13:56   ` Alex Bee
2024-02-27 14:01     ` Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 20/36] drm/tests: Add HDMI connector bpc and format tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 21/36] drm/connector: hdmi: Add Broadcast RGB property Maxime Ripard
2024-02-23  9:28   ` Pekka Paalanen
2024-02-29 19:47   ` Sebastian Wick
2024-03-01  8:29     ` Hans Verkuil
2024-03-01 11:26       ` Sebastian Wick
2024-03-01 10:30     ` Maxime Ripard
2024-03-01 11:29       ` Sebastian Wick
2024-03-01 12:12         ` Maxime Ripard
2024-03-01 12:19           ` Pekka Paalanen
2024-03-01 13:15           ` Sebastian Wick
2024-02-22 18:14 ` [PATCH v7 22/36] drm/tests: Add tests for " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 23/36] drm/connector: hdmi: Add RGB Quantization Range to the connector state Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 24/36] drm/tests: Add RGB Quantization tests Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 25/36] drm/connector: hdmi: Add Infoframes generation Maxime Ripard
2024-02-25 15:02   ` Dmitry Baryshkov
2024-02-27 12:08     ` Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 26/36] drm/tests: Add infoframes test Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 27/36] drm/connector: hdmi: Create Infoframe DebugFS entries Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 28/36] drm/vc4: hdmi: Switch to HDMI connector Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 29/36] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2024-02-26 12:29   ` Maíra Canal
2024-02-27 13:02     ` Maxime Ripard
2024-02-27 22:45       ` Maíra Canal
2024-02-28 15:23         ` ECC memory semantics for heaps Maxime Ripard
2024-02-28 16:16           ` [PATCH v7 29/36] drm/vc4: tests: Remove vc4_dummy_plane structure Maxime Ripard
2024-02-29  4:17           ` ECC memory semantics for heaps John Stultz
2024-03-04 13:46             ` Maxime Ripard [this message]
2024-03-04 21:12               ` John Stultz
2024-02-22 18:14 ` [PATCH v7 30/36] drm/vc4: tests: Convert to plane creation helper Maxime Ripard
2024-02-26 12:30   ` Maíra Canal
2024-02-22 18:14 ` [PATCH v7 31/36] drm/rockchip: inno_hdmi: Switch to HDMI connector Maxime Ripard
2024-02-23  9:40   ` Heiko Stübner
2024-02-22 18:14 ` [PATCH v7 32/36] drm/sun4i: hdmi: Convert encoder to atomic Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 33/36] drm/sun4i: hdmi: Move mode_set into enable Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 34/36] drm/sun4i: hdmi: Switch to container_of_const Maxime Ripard
2024-02-22 19:08   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 35/36] drm/sun4i: hdmi: Consolidate atomic_check and mode_valid Maxime Ripard
2024-02-22 19:12   ` Jernej Škrabec
2024-02-26  9:55   ` (subset) " Maxime Ripard
2024-02-22 18:14 ` [PATCH v7 36/36] drm/sun4i: hdmi: Switch to HDMI connector Maxime Ripard
2024-02-22 19:14   ` Jernej Škrabec
2024-02-23 13:24   ` Sui Jingfeng
2024-02-25 14:50 ` [PATCH v7 00/36] drm/connector: Create HDMI Connector infrastructure Dmitry Baryshkov
2024-02-26 13:22   ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240304-bizarre-quizzical-dugong-caec1a@houat \
    --to=mripard@redhat.com \
    --cc=Brian.Starkey@arm.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jstultz@google.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).