[PATCH] drm/amdgpu: grab extra fence reference for drm_sched_job_add_dependency

Michal Kubecek mkubecek at suse.cz
Fri Dec 23 10:00:38 UTC 2022


On Mon, Dec 19, 2022 at 11:47:18AM +0100, Christian König wrote:
> That function consumes the reference.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> Fixes: aab9cf7b6954 ("drm/amdgpu: use scheduler dependencies for VM updates")

Tested-by: Michal Kubecek <mkubecek at suse.cz>

I can still see weird artefacts in some windows (firefox, konsole) but
those are probably unrelated, the refcount errors are gone with this patch.

Michal

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
> index 59cf64216fbb..535cd6569bcc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
> @@ -238,8 +238,10 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,
>  	/* Wait for PD/PT moves to be completed */
>  	dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL);
>  	dma_resv_for_each_fence_unlocked(&cursor, fence) {
> +		dma_fence_get(fence);
>  		r = drm_sched_job_add_dependency(&p->job->base, fence);
>  		if (r) {
> +			dma_fence_put(fence);
>  			dma_resv_iter_end(&cursor);
>  			return r;
>  		}
> -- 
> 2.34.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20221223/38317c4a/attachment.sig>


More information about the amd-gfx mailing list