From: Ben Skeggs <skeggsb@gmail.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: ML nouveau <nouveau@lists.freedesktop.org>,
dmoulding@me.com, Stefan Fritsch <sf@sfritsch.de>,
Ben Skeggs <bskeggs@redhat.com>,
ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [Nouveau] [PATCH] drm/nouveau: wait for the exclusive fence after the shared ones v2
Date: Thu, 16 Dec 2021 08:32:44 +1000 [thread overview]
Message-ID: <CACAvsv7D7=Mud1YQ+GACFAqdvBGNp3rjY-eudkXy3uaefY6q+Q@mail.gmail.com> (raw)
In-Reply-To: <8aee128c-0699-5057-2655-4f7d91ac235b@gmail.com>
On Tue, 14 Dec 2021 at 19:19, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> Am 11.12.21 um 10:59 schrieb Stefan Fritsch:
> > On 09.12.21 11:23, Christian König wrote:
> >> Always waiting for the exclusive fence resulted on some performance
> >> regressions. So try to wait for the shared fences first, then the
> >> exclusive fence should always be signaled already.
> >>
> >> v2: fix incorrectly placed "(", add some comment why we do this.
> >>
> >> Signed-off-by: Christian König <christian.koenig@amd.com>
> >
> > Tested-by: Stefan Fritsch <sf@sfritsch.de>
>
> Thanks.
>
> >
> > Please also add a cc for linux-stable, so that this is fixed in 5.15.x
>
> Sure, but I still need some acked-by or rb from one of the Nouveau guys.
> So gentle ping on that.
Acked-by: Ben Skeggs <bskeggs@redhat.com>
>
> Regards,
> Christian.
>
> >
> > Cheers,
> > Stefan
> >
> >> ---
> >> drivers/gpu/drm/nouveau/nouveau_fence.c | 28 +++++++++++++------------
> >> 1 file changed, 15 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c
> >> b/drivers/gpu/drm/nouveau/nouveau_fence.c
> >> index 05d0b3eb3690..0ae416aa76dc 100644
> >> --- a/drivers/gpu/drm/nouveau/nouveau_fence.c
> >> +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
> >> @@ -353,15 +353,22 @@ nouveau_fence_sync(struct nouveau_bo *nvbo,
> >> struct nouveau_channel *chan, bool e
> >> if (ret)
> >> return ret;
> >> - }
> >> - fobj = dma_resv_shared_list(resv);
> >> - fence = dma_resv_excl_fence(resv);
> >> + fobj = NULL;
> >> + } else {
> >> + fobj = dma_resv_shared_list(resv);
> >> + }
> >> - if (fence) {
> >> + /* Waiting for the exclusive fence first causes performance
> >> regressions
> >> + * under some circumstances. So manually wait for the shared
> >> ones first.
> >> + */
> >> + for (i = 0; i < (fobj ? fobj->shared_count : 0) && !ret; ++i) {
> >> struct nouveau_channel *prev = NULL;
> >> bool must_wait = true;
> >> + fence = rcu_dereference_protected(fobj->shared[i],
> >> + dma_resv_held(resv));
> >> +
> >> f = nouveau_local_fence(fence, chan->drm);
> >> if (f) {
> >> rcu_read_lock();
> >> @@ -373,20 +380,13 @@ nouveau_fence_sync(struct nouveau_bo *nvbo,
> >> struct nouveau_channel *chan, bool e
> >> if (must_wait)
> >> ret = dma_fence_wait(fence, intr);
> >> -
> >> - return ret;
> >> }
> >> - if (!exclusive || !fobj)
> >> - return ret;
> >> -
> >> - for (i = 0; i < fobj->shared_count && !ret; ++i) {
> >> + fence = dma_resv_excl_fence(resv);
> >> + if (fence) {
> >> struct nouveau_channel *prev = NULL;
> >> bool must_wait = true;
> >> - fence = rcu_dereference_protected(fobj->shared[i],
> >> - dma_resv_held(resv));
> >> -
> >> f = nouveau_local_fence(fence, chan->drm);
> >> if (f) {
> >> rcu_read_lock();
> >> @@ -398,6 +398,8 @@ nouveau_fence_sync(struct nouveau_bo *nvbo,
> >> struct nouveau_channel *chan, bool e
> >> if (must_wait)
> >> ret = dma_fence_wait(fence, intr);
> >> +
> >> + return ret;
> >> }
> >> return ret;
>
next prev parent reply other threads:[~2021-12-15 22:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 10:23 [PATCH] drm/nouveau: wait for the exclusive fence after the shared ones v2 Christian König
2021-12-10 9:06 ` [Nouveau] " Thorsten Leemhuis
2021-12-11 9:59 ` Stefan Fritsch
2021-12-14 9:19 ` Christian König
2021-12-15 22:32 ` Ben Skeggs [this message]
2021-12-21 10:11 ` [Nouveau] " Thorsten Leemhuis
2021-12-21 10:20 ` Christian König
2021-12-20 19:17 ` Dan Moulding
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='CACAvsv7D7=Mud1YQ+GACFAqdvBGNp3rjY-eudkXy3uaefY6q+Q@mail.gmail.com' \
--to=skeggsb@gmail.com \
--cc=bskeggs@redhat.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dmoulding@me.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
--cc=sf@sfritsch.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;
as well as URLs for NNTP newsgroup(s).