diff options
| author | David M Nieto <[email protected]> | 2021-05-13 17:45:38 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-05-13 18:02:24 +0000 |
| commit | a7f0849682b75b6d50f07c70090443eebd90218c (patch) | |
| tree | adf7c0e6ae8ae4bf298bf8c18acd5fa5d4efb5ca /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
| parent | drm: simpledrm: Fix use after free issues (diff) | |
| download | kernel-a7f0849682b75b6d50f07c70090443eebd90218c.tar.gz kernel-a7f0849682b75b6d50f07c70090443eebd90218c.zip | |
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 <[email protected]>
Signed-off-by: David M Nieto <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 |
1 files 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); |
