All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Rob Clark <robdclark@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: frattaroli.nicolas@gmail.com,
	Yassine Oudjana <y.oudjana@protonmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/sched: fix dropping the last fence ref
Date: Wed, 17 Nov 2021 07:17:07 +0100	[thread overview]
Message-ID: <1b754ce5-a293-cc92-e848-1b6cc307669f@gmail.com> (raw)
In-Reply-To: <CAF6AEGvmgE1N=c5YexCyxWTVUpC6V5LEtvUnxxZ3eNAA5z6MGg@mail.gmail.com>



Am 16.11.21 um 19:07 schrieb Rob Clark:
> On Tue, Nov 16, 2021 at 8:37 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>> 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.
> oh, I sent https://patchwork.freedesktop.org/patch/463329/ before I
> saw this.. it already has the fixes tag, and IMO a better description,
> so I think you can just pick that one instead

Yeah, agree. You also have the missing Fixes line already.

Going to add Daniels rb to your patch as well since it is technically 
the same.

Thanks,
Christian.

>
> BR,
> -R
>
>> 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


      reply	other threads:[~2021-11-17  6:17 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
2021-11-16 18:07     ` Rob Clark
2021-11-17  6:17       ` Christian König [this message]

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=1b754ce5-a293-cc92-e848-1b6cc307669f@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=robdclark@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.