This debug dump will help on debugging the evf attached gem obj fence
related issue.

Signed-off-by: Prike Liang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c | 13 +++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c         |  6 +++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
index 0075469550b0..7030d721196b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
@@ -86,6 +86,19 @@ amdgpu_eviction_fence_replace_fence(struct 
amdgpu_eviction_fence_mgr *evf_mgr,
                if (ret) {
                        DRM_ERROR("Failed to attch new eviction fence\n");
                        goto free_err;
+               } else {
+                       struct dma_resv_iter cursor;
+                       struct dma_fence *fence;
+                       static const char *usage[] = { "kernel", "write", 
"read", "bookkeep" };
+
+                       dma_resv_for_each_fence(&cursor, obj->resv, 
DMA_RESV_USAGE_READ, fence) {
+                               DRM_DEBUG("after attach evf the resv dump 
usage:%s\n"
+                                          "after attach evf name:%s timeline 
name:%s seq:%lld %ssingned\n",
+                                       usage[dma_resv_iter_usage(&cursor)],
+                                       fence->ops->get_driver_name(fence),
+                                       fence->ops->get_timeline_name(fence), 
fence->seqno,
+                                       dma_fence_is_signaled(fence) ? "" : 
"un");
+                       }
                }
        }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index d09db052e282..1e73ce30d4d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1675,7 +1675,11 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, 
struct seq_file *m)
        amdgpu_bo_print_flag(m, bo, VRAM_CONTIGUOUS);
        amdgpu_bo_print_flag(m, bo, VM_ALWAYS_VALID);
        amdgpu_bo_print_flag(m, bo, EXPLICIT_SYNC);
-
+       /* Add the gem obj resv fence dump*/
+       if (dma_resv_trylock(bo->tbo.base.resv)) {
+               dma_resv_describe(bo->tbo.base.resv, m);
+               dma_resv_unlock(bo->tbo.base.resv);
+       }
        seq_puts(m, "\n");
 
        return size;
-- 
2.34.1

Reply via email to