From: Philipp Stanner <phasta@mailbox.org>
To: "Christian König" <christian.koenig@amd.com>,
"Philipp Stanner" <phasta@kernel.org>,
"Lyude Paul" <lyude@redhat.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH 4/4] drm/nouveau: Check dma_fence in canonical way
Date: Thu, 08 May 2025 11:13:39 +0200 [thread overview]
Message-ID: <3b64a3e0659dbfa2c5f819f40f9f0624309d24ed.camel@mailbox.org> (raw)
In-Reply-To: <9793bfc7-5309-4e19-a0e4-5e298720aa9e@amd.com>
On Mon, 2025-04-28 at 16:45 +0200, Christian König wrote:
> On 4/24/25 15:02, Philipp Stanner wrote:
> > In nouveau_fence_done(), a fence is checked for being signaled by
> > manually evaluating the base fence's bits. This can be done in a
> > canonical manner through dma_fence_is_signaled().
> >
> > Replace the bit-check with dma_fence_is_signaled().
> >
> > Signed-off-by: Philipp Stanner <phasta@kernel.org>
>
>
> I think the bit check was used here as fast path optimization because
> we later call dma_fence_is_signaled() anyway.
That fast path optimization effectively saves one JMP instruction to
the function.
I'm increasingly of the opinion that we shall work towards all DRM
users only ever using infrastructure through officially documented API
functions, without touching internal data structures.
> Feel free to add my acked-by, but honestly what nouveau does here
> looks rather suspicious to me.
:)
P.
>
> Regards,
> Christian.
>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c
> > b/drivers/gpu/drm/nouveau/nouveau_fence.c
> > index fb9811938c82..d5654e26d5bc 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_fence.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
> > @@ -253,7 +253,7 @@ nouveau_fence_done(struct nouveau_fence *fence)
> > struct nouveau_channel *chan;
> > unsigned long flags;
> >
> > - if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence-
> > >base.flags))
> > + if (dma_fence_is_signaled(&fence->base))
> > return true;
> >
> > spin_lock_irqsave(&fctx->lock, flags);
>
next prev parent reply other threads:[~2025-05-08 9:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 13:02 [PATCH 0/4] drm/nouveau: Simplify nouveau_fence.c Philipp Stanner
2025-04-24 13:02 ` [PATCH 1/4] drm/nouveau: nouveau_fence: Standardize list iterations Philipp Stanner
2025-04-24 13:02 ` [PATCH 2/4] drm/nouveau: Simplify calls to nvif_event_block() Philipp Stanner
2025-04-24 13:02 ` [PATCH 3/4] drm/nouveau: Simplify nouveau_fence_done() Philipp Stanner
2025-04-28 14:43 ` Christian König
2025-04-24 13:02 ` [PATCH 4/4] drm/nouveau: Check dma_fence in canonical way Philipp Stanner
2025-04-24 13:24 ` Danilo Krummrich
2025-04-24 13:25 ` Philipp Stanner
2025-04-24 13:34 ` Danilo Krummrich
2025-04-28 14:45 ` Christian König
2025-05-08 9:13 ` Philipp Stanner [this message]
2025-05-08 9:54 ` Christian König
2025-05-16 14:10 ` [PATCH 0/4] drm/nouveau: Simplify nouveau_fence.c Danilo Krummrich
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=3b64a3e0659dbfa2c5f819f40f9f0624309d24ed.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.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
all inboxes | Powered by JetHome®