From: Philipp Stanner <phasta@mailbox.org>
To: "Steven Price" <steven.price@arm.com>,
"Philipp Stanner" <phasta@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Gustavo Padovan" <gustavo@padovan.org>,
"Christian König" <christian.koenig@amd.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>
Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Subject: Re: [PATCH 1/2] dma-buf: Add __dma_fence_is_signaled()
Date: Mon, 01 Dec 2025 16:48:59 +0100 [thread overview]
Message-ID: <671926034e54072cb096c22e72cc826a19c84862.camel@mailbox.org> (raw)
In-Reply-To: <1d9cef1f-3b51-42a9-b1e8-794d67f8e328@arm.com>
On Mon, 2025-12-01 at 15:46 +0000, Steven Price wrote:
> On 25/11/2025 10:44, Philipp Stanner wrote:
> > The dma_fence framework checks at many places whether the signaled bit
> > of a fence is already set. The code can be simplified and made more
> > readable by providing a helper function for that.
> >
> > Add __dma_fence_is_signaled(), which _only_ checks whether a fence is
> > signaled. Use it internally.
> >
> > Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
> > ---
> > drivers/dma-buf/dma-fence.c | 19 +++++++++----------
> > include/linux/dma-fence.h | 24 ++++++++++++++++++++++--
> > 2 files changed, 31 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> > index 39e6f93dc310..3a48896ded62 100644
> > --- a/drivers/dma-buf/dma-fence.c
> > +++ b/drivers/dma-buf/dma-fence.c
> > @@ -372,8 +372,7 @@ int dma_fence_signal_timestamp_locked(struct dma_fence *fence,
> >
> > lockdep_assert_held(fence->lock);
> >
> > - if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
> > - &fence->flags)))
> > + if (unlikely(__dma_fence_is_signaled(fence)))
>
> Here you are replacing test_and_set_bit(), but the helper just does
> test_bit() - so this is changing the behaviour (and I suspect is wrong).
>
> Thanks,
> Steve
>
>
Yes, that is a bug and has already been caught by various parties – but
it's good that you're paying attention :)
We're currently in this revision, where the bug is fixed:
https://lore.kernel.org/dri-devel/20251201105011.19386-2-phasta@kernel.org/
P.
next prev parent reply other threads:[~2025-12-01 15:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 10:44 Philipp Stanner
2025-11-25 10:44 ` [PATCH 2/2] dma-buf/dma-fence: Unify return codes for signalled fences Philipp Stanner
2025-11-25 13:20 ` Tvrtko Ursulin
2025-11-25 13:28 ` Philipp Stanner
2025-11-25 13:30 ` Christian König
2025-11-25 13:35 ` [PATCH 1/2] dma-buf: Add __dma_fence_is_signaled() Christian König
2025-12-01 15:46 ` Steven Price
2025-12-01 15:48 ` Philipp Stanner [this message]
2025-12-09 15:45 ` kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2025-05-22 11:25 Philipp Stanner
2025-05-23 14:47 ` Tvrtko Ursulin
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=671926034e54072cb096c22e72cc826a19c84862.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=christian.koenig@amd.com \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@padovan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=phasta@kernel.org \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=tvrtko.ursulin@igalia.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
all inboxes | Powered by JetHome®