Re: [PATCH] gpu: drm: remove redundant dma_fence_put() when drm_sched_job_add_dependency() fails

From: Andrey Grodzovsky
Date: Fri Apr 29 2022 - 12:34:29 EST

Now it's easy to see it's redundant, it's a problematic design where the fence 'get' part is happening outside the job->dependencies array logic but the fence 'put' part is happening inside, leads to confusions such as adding this 'put'
in the first place. I will look into improving this if possible.

Patch is Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>


On 2022-04-28 23:03, Hangyu Hua wrote:
If fence is released in drm_sched_job_add_implicit_dependencies(), a dangling pointer will be in obj->resv.

specific scenario:
recount = 1 init, obj->resv->fence_excl = fence
recount = 1 before drm_sched_job_add_implicit_dependencies
recount = 2 in [2]
recount = 1 in [1]
recount = 0 in [3] <--- fence release. But fence still in obj->resv