From: Matthew Brost <matthew.brost@intel.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: <dri-devel@lists.freedesktop.org>, <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] dma-buf: revert "use inline lock for the dma-fence-chain"
Date: Tue, 24 Feb 2026 07:27:33 -0800 [thread overview]
Message-ID: <aZ3DZU2wFD0b4Ecf@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <aZy2Hhu3SGQQPQbN@lstrano-desk.jf.intel.com>
On Mon, Feb 23, 2026 at 12:18:38PM -0800, Matthew Brost wrote:
> On Mon, Feb 23, 2026 at 08:57:05PM +0100, Christian König wrote:
> > This reverts commit a408c0ca0c411ca1ead995bdae3112a806c87556.
> >
> > This causes a lockdep splat. Not really the right fix, but changing this
> > is more work than expected.
> >
Ping - this is blocking our CI so if we can figure out the best way to
move forward soon, it is would be helpful.
Mstt
>
> I think dma-fence-arrays will have the same issue.
>
> Can’t we just assign a lockdep key for chains and arrays?
>
> Typing as fast as I could, I came up with this, and it seems to work:
>
> diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
> index cd970eceaefb..d5cce24dca5b 100644
> --- a/drivers/dma-buf/dma-fence-array.c
> +++ b/drivers/dma-buf/dma-fence-array.c
> @@ -200,6 +200,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
> u64 context, unsigned seqno,
> bool signal_on_any)
> {
> +#if IS_ENABLED(CONFIG_PROVE_LOCKING)
> + static struct lock_class_key dma_fence_array_lock_key;
> +#endif
> +
> WARN_ON(!num_fences || !fences);
>
> array->num_fences = num_fences;
> @@ -208,6 +212,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
> seqno);
> init_irq_work(&array->work, irq_dma_fence_array_work);
>
> +#if IS_ENABLED(CONFIG_PROVE_LOCKING)
> + lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key);
> +#endif
> +
> atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
> array->fences = fences;
>
> diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c
> index a707792b6025..aa144b8c3534 100644
> --- a/drivers/dma-buf/dma-fence-chain.c
> +++ b/drivers/dma-buf/dma-fence-chain.c
> @@ -242,6 +242,9 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
> struct dma_fence *fence,
> uint64_t seqno)
> {
> +#if IS_ENABLED(CONFIG_PROVE_LOCKING)
> + static struct lock_class_key dma_fence_chain_lock_key;
> +#endif
> struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
> uint64_t context;
>
> @@ -263,6 +266,10 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
> dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
> context, seqno);
>
> +#if IS_ENABLED(CONFIG_PROVE_LOCKING)
> + lockdep_set_class(&chain->base.inline_lock, &dma_fence_chain_lock_key);
> +#endif
> +
> /*
> * Chaining dma_fence_chain container together is only allowed through
> * the prev fence and not through the contained fence.
>
> Matt
>
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> > ---
> > drivers/dma-buf/dma-fence-chain.c | 3 ++-
> > include/linux/dma-fence-chain.h | 1 +
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma-buf/dma-fence-chain.c b/drivers/dma-buf/dma-fence-chain.c
> > index a707792b6025..a8a90acf4f34 100644
> > --- a/drivers/dma-buf/dma-fence-chain.c
> > +++ b/drivers/dma-buf/dma-fence-chain.c
> > @@ -245,6 +245,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
> > struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
> > uint64_t context;
> >
> > + spin_lock_init(&chain->lock);
> > rcu_assign_pointer(chain->prev, prev);
> > chain->fence = fence;
> > chain->prev_seqno = 0;
> > @@ -260,7 +261,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
> > seqno = max(prev->seqno, seqno);
> > }
> >
> > - dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
> > + dma_fence_init64(&chain->base, &dma_fence_chain_ops, &chain->lock,
> > context, seqno);
> >
> > /*
> > diff --git a/include/linux/dma-fence-chain.h b/include/linux/dma-fence-chain.h
> > index df3beadf1515..5cd3ba53b4a1 100644
> > --- a/include/linux/dma-fence-chain.h
> > +++ b/include/linux/dma-fence-chain.h
> > @@ -46,6 +46,7 @@ struct dma_fence_chain {
> > */
> > struct irq_work work;
> > };
> > + spinlock_t lock;
> > };
> >
> >
> > --
> > 2.43.0
> >
next prev parent reply other threads:[~2026-02-24 15:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 19:57 [PATCH] dma-buf: revert "use inline lock for the dma-fence-chain" Christian König
2026-02-23 20:18 ` Matthew Brost
2026-02-24 15:27 ` Matthew Brost [this message]
2026-02-23 20:45 ` ✗ i915.CI.BAT: failure for " Patchwork
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=aZ3DZU2wFD0b4Ecf@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/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