[PATCH 1/6] drm/amdgpu: grab an additional reference on the gang fence

Michel Dänzer michel.daenzer at mailbox.org
Tue Feb 4 11:04:37 UTC 2025


On 2025-02-03 12:58, Christian König wrote:
> We keep the gang submission fence around in adev, make sure that it
> stays alive.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index d6b473217c8b..aaa8f9f7b6b2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -6753,6 +6753,7 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
>  {
>  	struct dma_fence *old = NULL;
>  
> +	dma_fence_get(gang);
>  	do {
>  		dma_fence_put(old);
>  		old = amdgpu_device_get_gang(adev);
> @@ -6765,6 +6766,7 @@ struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
>  	} while (cmpxchg((struct dma_fence __force **)&adev->gang_submit,
>  			 old, gang) != old);
>  
> +	dma_fence_put(old);
>  	dma_fence_put(old);
>  	return NULL;
>  }

Should one of these be

	dma_fence_put(gang);

?


-- 
Earthling Michel Dänzer       \        GNOME / Xwayland / Mesa developer
https://redhat.com             \               Libre software enthusiast


More information about the amd-gfx mailing list