From: Philipp Stanner <phasta@mailbox.org>
To: "Tvrtko Ursulin" <tursulin@ursulin.net>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
alexdeucher@gmail.com, simona.vetter@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 05/15] dma-buf: inline spinlock for fence protection
Date: Mon, 03 Nov 2025 14:07:06 +0100 [thread overview]
Message-ID: <28db478040c23a237e859d288993208aee29cbc8.camel@mailbox.org> (raw)
In-Reply-To: <17248bf5-39d6-44df-a2f3-f832abe48fcd@ursulin.net>
On Thu, 2025-10-16 at 10:26 +0100, Tvrtko Ursulin wrote:
>
> Hi Christian,
>
> Only some preliminary comments while I am building a complete picture.
>
> On 13/10/2025 14:48, Christian König wrote:
> > Allow implementations to not give a spinlock to protect the fence
> > internal state, instead a spinlock embedded into the fence structure
> > itself is used in this case.
> >
> > Apart from simplifying the handling for containers and the stub fence
> > this has the advantage of allowing implementations to issue fences
> > without caring about theit spinlock lifetime.
> >
> > That in turn is necessary for independent fences who outlive the module
> > who originally issued them.
I like the overall idea and think that separate locks will help me with
Rust dma_fence, where I also had begun to investigate the issue of
module unload vs backend_ops.
> >
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> >
[…]
> >
> > static inline struct sync_timeline *dma_fence_parent(struct dma_fence *fence)
> > {
> > - return container_of(fence->lock, struct sync_timeline, lock);
> > + return container_of(fence->extern_lock, struct sync_timeline, lock);
>
> These container_ofs are a bit annoying. Maybe even a bit fragile if
> someone switches to embedded lock and forgets to update them all.
>
> Would prep patch to first replace them with some dma_fence_container_of
> wrapper make sense?
>
+1, would be a nice change.
It's not related to the series, though, so should be done in an
independent patch (IMO).
> Then it could even have a (debug builds only) assert
> added to check for correct usage.
>
> > }
> >
> > /**
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> >
> >
[…]
> > *
> > + * DMA_FENCE_FLAG_INLINE_LOCK_BIT - use inline spinlock instead of external one
> > * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled
> > * DMA_FENCE_FLAG_TIMESTAMP_BIT - timestamp recorded for fence signaling
> > * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called
> > @@ -65,7 +67,10 @@ struct seq_file;
> > * been completed, or never called at all.
> > */
> > struct dma_fence {
> > - spinlock_t *lock;
> > + union {
> > + spinlock_t *extern_lock;
> > + spinlock_t inline_lock;
>
> This will grow the struct on some architectures so I think, given the
> strong push back to struct past a 64B cacheline in the past, it should
> be called out in the commit message.
+1
Although: Christian, you told me at XDC that you did some exact
measurements about the new vs old cache line size. Can you help out my
memory here, what were those sizes?
P.
next prev parent reply other threads:[~2025-11-03 14:06 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 13:48 Independence for dma_fences! Christian König
2025-10-13 13:48 ` [PATCH 01/15] dma-buf: cleanup dma_fence_describe Christian König
2025-10-14 14:37 ` Tvrtko Ursulin
2025-10-23 3:45 ` Matthew Brost
2025-10-13 13:48 ` [PATCH 02/15] dma-buf: rework stub fence initialisation Christian König
2025-10-14 15:03 ` Tvrtko Ursulin
2025-10-24 7:29 ` Tvrtko Ursulin
2025-10-13 13:48 ` [PATCH 03/15] dma-buf: protected fence ops by RCU Christian König
2025-10-16 18:04 ` Tvrtko Ursulin
2025-10-31 10:35 ` Tvrtko Ursulin
2025-10-13 13:48 ` [PATCH 04/15] dma-buf: detach fence ops on signal Christian König
2025-10-16 8:56 ` Tvrtko Ursulin
2025-10-16 15:57 ` Tvrtko Ursulin
2025-10-23 4:23 ` Matthew Brost
2025-10-23 4:44 ` Matthew Brost
2025-10-30 13:52 ` Christian König
2025-10-31 10:31 ` Tvrtko Ursulin
2025-10-17 9:14 ` Philipp Stanner
2025-10-30 15:05 ` Christian König
2025-10-13 13:48 ` [PATCH 05/15] dma-buf: inline spinlock for fence protection Christian König
2025-10-16 9:26 ` Tvrtko Ursulin
2025-11-03 13:07 ` Philipp Stanner [this message]
2025-10-23 18:09 ` Matthew Brost
2025-10-30 15:14 ` Christian König
2025-10-13 13:48 ` [PATCH 06/15] dma-buf: use inline lock for the stub fence Christian König
2025-10-13 13:48 ` [PATCH 07/15] dma-buf: use inline lock for the dma-fence-array Christian König
2025-10-13 13:48 ` [PATCH 08/15] dma-buf: use inline lock for the dma-fence-chain Christian König
2025-10-13 13:48 ` [PATCH 09/15] drm/sched: use inline locks for the drm-sched-fence Christian König
2025-10-13 13:48 ` [PATCH 10/15] drm/amdgpu: fix KFD eviction fence enable_signaling path Christian König
2025-10-13 13:48 ` [PATCH 11/15] drm/amdgpu: independence for the amdgpu_fence! Christian König
2025-10-13 13:48 ` [PATCH 12/15] drm/amdgpu: independence for the amdgpu_eviction_fence! Christian König
2025-10-13 13:48 ` [PATCH 13/15] drm/amdgpu: independence for the amdgpu_vm_tlb_fence! Christian König
2025-10-13 13:48 ` [PATCH 14/15] drm/amdgpu: independence for the amdkfd_fence! Christian König
2025-10-17 22:22 ` Felix Kuehling
2025-10-30 15:07 ` Christian König
2025-10-30 20:04 ` Felix Kuehling
2025-10-13 13:48 ` [PATCH 15/15] drm/amdgpu: independence for the amdgpu_userq__fence! Christian König
2025-10-13 14:54 ` Independence for dma_fences! Philipp Stanner
2025-10-14 15:54 ` Christian König
2025-10-17 8:32 ` Philipp Stanner
2025-10-28 14:06 ` Christian König
2025-10-29 20:53 ` Matthew Brost
2025-10-30 10:59 ` Christian König
2025-10-31 17:44 ` Matthew Brost
2025-11-03 11:43 ` Christian König
2025-11-03 19:32 ` Matthew Brost
2025-10-15 0:51 ` Dave Airlie
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=28db478040c23a237e859d288993208aee29cbc8.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=phasta@kernel.org \
--cc=simona.vetter@ffwll.ch \
--cc=tursulin@ursulin.net \
/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