Add ftrace events for the userq eviction fence lifecycle.
Signed-off-by: Prike Liang <[email protected]>
---
.../drm/amd/amdgpu/amdgpu_eviction_fence.c | 8 ++++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 23 +++++++++++++++++++
2 files changed, 30 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 5ae477c49a53..9358f9b35914 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
@@ -24,6 +24,7 @@
#include <linux/sched.h>
#include <drm/drm_exec.h>
#include "amdgpu.h"
+#include "amdgpu_trace.h"
static const char *
amdgpu_eviction_fence_get_driver_name(struct dma_fence *fence)
@@ -44,6 +45,8 @@ static bool amdgpu_eviction_fence_enable_signaling(struct
dma_fence *f)
{
struct amdgpu_eviction_fence *ev_fence = to_ev_fence(f);
+ trace_amdgpu_userq_eviction_fence_enable_signaling(f->context,
+ f->seqno);
schedule_work(&ev_fence->evf_mgr->suspend_work);
return true;
}
@@ -84,6 +87,8 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work)
* next fence.
*/
dma_fence_signal(ev_fence);
+ trace_amdgpu_userq_eviction_fence_signal(ev_fence->context,
+ ev_fence->seqno);
dma_fence_end_signalling(cookie);
dma_fence_put(ev_fence);
@@ -138,7 +143,8 @@ int amdgpu_evf_mgr_rearm(struct amdgpu_eviction_fence_mgr
*evf_mgr,
/* Remember it for newly added BOs */
dma_fence_put(evf_mgr->ev_fence);
evf_mgr->ev_fence = &ev_fence->base;
-
+ trace_amdgpu_userq_eviction_fence_emit(ev_fence->base.context,
+ ev_fence->base.seqno);
/* And add it to all existing BOs */
drm_exec_for_each_locked_object(exec, index, obj) {
struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
index 5a01f63d1f32..4ff8a4d7bb8b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
@@ -636,6 +636,29 @@ DEFINE_EVENT(amdgpu_userq_queue_result,
amdgpu_userq_destroy_end,
TP_PROTO(struct amdgpu_usermode_queue *queue, int result),
TP_ARGS(queue, result));
+DECLARE_EVENT_CLASS(amdgpu_userq_eviction_fence,
+ TP_PROTO(u64 context, u64 seqno),
+ TP_ARGS(context, seqno),
+ TP_STRUCT__entry(
+ __field(u64, context)
+ __field(u64, seqno)
+ ),
+ TP_fast_assign(
+ __entry->context = context;
+ __entry->seqno = seqno;
+ ),
+ TP_printk("eviction fence=%llu:%llu",
+ __entry->context, __entry->seqno)
+);
+DEFINE_EVENT(amdgpu_userq_eviction_fence, amdgpu_userq_eviction_fence_emit,
+ TP_PROTO(u64 context, u64 seqno),
+ TP_ARGS(context, seqno));
+DEFINE_EVENT(amdgpu_userq_eviction_fence,
amdgpu_userq_eviction_fence_enable_signaling,
+ TP_PROTO(u64 context, u64 seqno),
+ TP_ARGS(context, seqno));
+DEFINE_EVENT(amdgpu_userq_eviction_fence, amdgpu_userq_eviction_fence_signal,
+ TP_PROTO(u64 context, u64 seqno),
+ TP_ARGS(context, seqno));
#undef AMDGPU_JOB_GET_TIMELINE_NAME
#endif
--
2.34.1