From: Daniel Vetter <daniel@ffwll.ch>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: frattaroli.nicolas@gmail.com, dri-devel@lists.freedesktop.org,
y.oudjana@protonmail.com
Subject: Re: [PATCH 2/2] drm/sched: fix dropping the last fence ref
Date: Tue, 16 Nov 2021 17:37:51 +0100 [thread overview]
Message-ID: <YZPeXyCSaRRtUN21@phenom.ffwll.local> (raw)
In-Reply-To: <20211116092519.99206-2-christian.koenig@amd.com>
On Tue, Nov 16, 2021 at 10:25:19AM +0100, Christian König wrote:
> We need to grab another ref before trying to add the fence to the sched
> job and not after.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
I wondered first why this goes boom, but then I realized that in some
cases add_dependency() drops the reference of the passed-in fence.
Please also add the Fixes: line like in the previous patch.
Cheers, Daniel
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 94fe51b3caa2..400d201c3c28 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -704,12 +704,14 @@ int drm_sched_job_add_implicit_dependencies(struct drm_sched_job *job,
> int ret;
>
> dma_resv_for_each_fence(&cursor, obj->resv, write, fence) {
> - ret = drm_sched_job_add_dependency(job, fence);
> - if (ret)
> - return ret;
> -
> /* Make sure to grab an additional ref on the added fence */
> dma_fence_get(fence);
> +
> + ret = drm_sched_job_add_dependency(job, fence);
> + if (ret) {
> + dma_fence_put(fence);
> + return ret;
> + }
> }
> return 0;
> }
> --
> 2.25.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2021-11-16 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 9:25 [PATCH 1/2] drm/scheduler: fix drm_sched_job_add_implicit_dependencies Christian König
2021-11-16 9:25 ` [PATCH 2/2] drm/sched: fix dropping the last fence ref Christian König
2021-11-16 16:37 ` Daniel Vetter [this message]
2021-11-16 18:07 ` Rob Clark
2021-11-17 6:17 ` Christian König
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=YZPeXyCSaRRtUN21@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=frattaroli.nicolas@gmail.com \
--cc=y.oudjana@protonmail.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