From: Matthew Brost <matthew.brost@intel.com>
To: <phasta@kernel.org>
Cc: "Sumit Semwal" <sumit.semwal@linaro.org>,
"Gustavo Padovan" <gustavo@padovan.org>,
"Christian König" <christian.koenig@amd.com>,
"Felix Kuehling" <Felix.Kuehling@amd.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"Huang Rui" <ray.huang@amd.com>,
"Matthew Auld" <matthew.auld@intel.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 4/8] drm/xe: Use dma_fence_check_and_signal_locked()
Date: Tue, 2 Dec 2025 07:57:13 -0800 [thread overview]
Message-ID: <aS8MWTnmjmEkn6YG@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <e2799662727a10b77b77ceb2fc2cdabe27537e3e.camel@mailbox.org>
On Tue, Dec 02, 2025 at 08:17:17AM +0100, Philipp Stanner wrote:
> On Mon, 2025-12-01 at 11:38 -0800, Matthew Brost wrote:
> > On Mon, Dec 01, 2025 at 11:50:08AM +0100, Philipp Stanner wrote:
> > > Xe is one of the few users utilizing the return code of
> > > dma_fence_signal() to check whether a fence had already been signaled by
> > > someone else.
> > >
> > > To clean up and simplify the dma_fence API, the few kernel users relying
> > > on that behavior shall be ported to an alternative function.
> > >
> > > Replace dma_fence_signal_locked() with
> > > dma_fence_check_and_signal_locked().
> > >
> > > Signed-off-by: Philipp Stanner <phasta@kernel.org>
> > > ---
> > > drivers/gpu/drm/xe/xe_hw_fence.c | 4 +---
> > > 1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_hw_fence.c b/drivers/gpu/drm/xe/xe_hw_fence.c
> > > index b2a0c46dfcd4..f6057456e460 100644
> > > --- a/drivers/gpu/drm/xe/xe_hw_fence.c
> > > +++ b/drivers/gpu/drm/xe/xe_hw_fence.c
> > > @@ -85,7 +85,6 @@ void xe_hw_fence_irq_finish(struct xe_hw_fence_irq *irq)
> > > {
> > > struct xe_hw_fence *fence, *next;
> > > unsigned long flags;
> > > - int err;
> > > bool tmp;
> > >
> > > if (XE_WARN_ON(!list_empty(&irq->pending))) {
> > > @@ -93,9 +92,8 @@ void xe_hw_fence_irq_finish(struct xe_hw_fence_irq *irq)
> > > spin_lock_irqsave(&irq->lock, flags);
> > > list_for_each_entry_safe(fence, next, &irq->pending, irq_link) {
> > > list_del_init(&fence->irq_link);
> > > - err = dma_fence_signal_locked(&fence->dma);
> > > + XE_WARN_ON(dma_fence_check_and_signal_locked(&fence->dma));
> >
> > I think XE_WARN_ON can compile out in certain builds. Best to leave warn on logic as is.
>
> OK, will adjust.
>
> >
> > Also a little confused by this new helper... Doesn't
> > dma_fence_signal_locked already check if a fence is already signaled and
> > bail? Running out the door so I don't have time dig in here, but can you
> > explain?
>
> Yes, that is what dma_fence_signal_locked() *currently* does. The
> series, however, is about removing that check from the default
> interfaces because barely anyone uses dma_fence_signal() et.al.'s
> return code. To simplify the interfaces.
> The 2-3 users who need the code get this new function. See cover
> letter.
>
Thanks for explaination. This should work then with XE_WARN_ON refactor.
Matt
>
> P.
>
> >
> > Matt
> >
> > > dma_fence_put(&fence->dma);
> > > - XE_WARN_ON(err);
> > > }
> > > spin_unlock_irqrestore(&irq->lock, flags);
> > > dma_fence_end_signalling(tmp);
> > > --
> > > 2.49.0
> > >
>
next prev parent reply other threads:[~2025-12-02 15:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 10:50 [PATCH 0/6] dma-fence: Remove return code of dma_fence_signal() et al Philipp Stanner
2025-12-01 10:50 ` [PATCH v2 1/8] dma-buf/dma-fence: Add dma_fence_test_signaled_flag() Philipp Stanner
2025-12-03 13:03 ` Christian König
2025-12-01 10:50 ` [PATCH v2 2/8] dma-buf/dma-fence: Add dma_fence_check_and_signal() Philipp Stanner
2025-12-01 13:23 ` Christian König
2025-12-01 13:55 ` Philipp Stanner
2025-12-01 15:20 ` Christian König
2025-12-01 15:34 ` Philipp Stanner
2025-12-01 16:06 ` Christian König
2025-12-01 15:53 ` Philipp Stanner
2025-12-01 16:08 ` Christian König
2025-12-02 9:19 ` Philipp Stanner
2025-12-03 13:05 ` Christian König
2025-12-01 10:50 ` [PATCH v2 3/8] amd/amdkfd: Use dma_fence_check_and_signal() Philipp Stanner
2025-12-01 15:21 ` Felix Kuehling
2025-12-03 13:10 ` Christian König
2025-12-01 10:50 ` [PATCH v2 4/8] drm/xe: Use dma_fence_check_and_signal_locked() Philipp Stanner
2025-12-01 19:38 ` Matthew Brost
2025-12-02 7:17 ` Philipp Stanner
2025-12-02 15:57 ` Matthew Brost [this message]
2025-12-02 20:47 ` Andi Shyti
2025-12-02 21:04 ` Matthew Brost
2025-12-03 21:13 ` Rodrigo Vivi
2025-12-03 13:14 ` Christian König
2025-12-01 10:50 ` [PATCH v2 5/8] dma-buf: Don't misuse dma_fence_signal() Philipp Stanner
2025-12-03 13:11 ` Christian König
2025-12-01 10:50 ` [PATCH v2 6/8] drm/ttm: Use dma_fence_check_and_signal() Philipp Stanner
2025-12-03 13:11 ` Christian König
2025-12-01 10:50 ` [PATCH v2 7/8] dma-buf/dma-fence: Remove return code of signaling-functions Philipp Stanner
2025-12-03 13:13 ` Christian König
2025-12-01 10:50 ` [PATCH v2 8/8] drm/xe: Use dma_fence_test_signaled_flag() Philipp Stanner
2025-12-01 19:33 ` Matthew Brost
2025-12-02 8:29 ` Philipp Stanner
2025-12-03 13:15 ` Christian König
2025-12-03 15:18 ` Philipp Stanner
2025-12-03 15:24 ` Christian König
2025-12-03 17:31 ` Matthew Brost
2025-12-03 21:12 ` Rodrigo Vivi
2025-12-04 14:10 ` [PATCH 0/6] dma-fence: Remove return code of dma_fence_signal() et al Philipp Stanner
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=aS8MWTnmjmEkn6YG@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=Felix.Kuehling@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@padovan.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=ray.huang@amd.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
/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®