Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: thomas.hellstrom@linux.intel.com, dakr@kernel.org,
	ecourtney@nvidia.com, matthew.brost@intel.com,
	nat@pixelcluster.dev, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org
Subject: Refcounting dma_resv v3
Date: Thu,  3 Sep 2026 15:27:55 +0200	[thread overview]
Message-ID: <20260903134408.105317-1-christian.koenig@amd.com> (raw)

Hi everybody,

The idea of ref-counting dma_resv or ww_mutex came up multiple times from
different people, but so far at least I have abandoned that as to
complicated to implement considering how widely used that object is.

Thanks to AI I gave the task to refcount dma_resv to Claude Sonet 4 just
to check how horrible it would look like.

Well turns out that this is actually a cleanup we should most likely aim
for and I'm really wondering why we haven't done it like this in the
first place.

Not only resolves it a bunch of issues with dma_resv instances shared by
multiple GEM objects (we just recently had a bunch of patches for that on
the mailing list), but also allows TTM to implement it's delayed delete
handling without any zombie resurrection or similar hacks and DMA-buf to
have better contention handling on map/pin in the future.

v2:

This patch set here is now the idea full flashed out. I smoke tested it
with amdgpu, self tests and checked everything with kmemleak and of hand
it seems to work.

Patch #1 introduces an interim allocated flag to allow switching users
over to the new interface one by one. Patch #10 then removes that flag
again after everything is done.

v3:

Well distrusting Sonet proved to be correct. It turned out that the AI
missed tons of issues. Most of them are hopefully fixed in this
iteration of the patch set now.

Sashiko-bot on the other hand proved to be extremely useful. It not only
pointed out tons of stuff Sonet missed but also a complicated pre-existing
bug in i915.

The first patch in this series is now fixing this i915 bug, I've send
this to the relevant mainatiners separately and only include it here for
completeness.

Please review and comment.

Cheers,
Christian.




             reply	other threads:[~2026-09-03 13:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 13:27 Christian König [this message]
2026-09-03 13:27 ` [PATCH 01/11] drm/i915: fix incorrect RCU teardown order Christian König
2026-09-03 13:27 ` [PATCH 02/11] dma-buf: Add reference counting to dma_resv v2 Christian König
2026-09-03 13:27 ` [PATCH 03/11] dma-buf/tests: Convert st-dma-resv tests to use dma_resv_alloc v2 Christian König
2026-09-03 13:27 ` [PATCH 04/11] drm/gem: Add helper for drm_gem_object resv assignment v2 Christian König
2026-09-03 13:28 ` [PATCH 05/11] drm/gem: Convert drm_gem_private_object_init to return error code v2 Christian König
2026-09-03 13:28 ` [PATCH 06/11] drm/mode_config: Use dma_resv_alloc for lockdep annotation Christian König
2026-09-03 13:28 ` [PATCH 07/11] drm/xe: " Christian König
2026-09-03 13:28 ` [PATCH 08/11] drm/i915/gt: Use dma_resv_alloc for VM reservation objects v2 Christian König
2026-09-03 13:28 ` [PATCH 09/11] drm/ttm/tests: Use dma_resv_alloc in test files Christian König
2026-09-03 13:28 ` [PATCH 10/11] drm/gem: Use dynamic allocation for GEM object dma_resv Christian König
2026-09-03 13:28 ` [PATCH 11/11] dma-buf: Inline dma_resv_init and remove allocated flag Christian König
2026-09-03 19:38 ` Refcounting dma_resv v3 Matthew Brost

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=20260903134408.105317-1-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=nat@pixelcluster.dev \
    --cc=thomas.hellstrom@linux.intel.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