From: David M Nieto Date: Thu, 13 May 2021 17:45:38 +0000 (-0700) Subject: drm/amdgpu: free resources on fence usage query X-Git-Tag: accepted/tizen/unified/20230118.172025~6402^2~28^2~403 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7f0849682b75b6d50f07c70090443eebd90218c;p=platform%2Fkernel%2Flinux-rpi.git drm/amdgpu: free resources on fence usage query Free the resources if the fence needs to be ignored during the ratio calculation Reviewed-by: Alex Deucher Signed-off-by: David M Nieto Signed-off-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/20210513174539.27409-1-david.nieto@amd.com --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 01fe60f..9036c93 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);