[PATCH 1/2] drm/amdgpu: free resources on fence usage query

Alex Deucher alexdeucher at gmail.com
Thu May 13 18:00:32 UTC 2021


On Thu, May 13, 2021 at 1:45 PM David M Nieto <david.nieto at amd.com> wrote:
>
> Free the resources if the fence needs to be ignored
> during the ratio calculation
>
> Signed-off-by: David M Nieto <david.nieto at amd.com>

Series is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
Will push it momentarily.

Alex


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 01fe60fedcbe..9036c93b4a0c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -669,11 +669,15 @@ void amdgpu_ctx_fence_time(struct amdgpu_ctx *ctx, struct amdgpu_ctx_entity *cen
>                 if (!fence)
>                         continue;
>                 s_fence = to_drm_sched_fence(fence);
> -               if (!dma_fence_is_signaled(&s_fence->scheduled))
> +               if (!dma_fence_is_signaled(&s_fence->scheduled)) {
> +                       dma_fence_put(fence);
>                         continue;
> +               }
>                 t1 = s_fence->scheduled.timestamp;
> -               if (t1 >= now)
> +               if (!ktime_before(t1, now)) {
> +                       dma_fence_put(fence);
>                         continue;
> +               }
>                 if (dma_fence_is_signaled(&s_fence->finished) &&
>                         s_fence->finished.timestamp < now)
>                         *total += ktime_sub(s_fence->finished.timestamp, t1);
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list