RE: [PATCH 4/4] drm/amdgpu: add eviction fence tracepoints for userq profiling
AMD General Regards, Prike > -Original Message- > From: Pierre-Eric Pelloux-Prayer > Sent: Wednesday, May 13, 2026 5:18 PM > To: Liang, Prike ; [email protected] > Cc: Deucher, Alexander ; Koenig, Christian > > Subject: Re: [PATCH 4/4] drm/amdgpu: add eviction fence tracepoints for userq > profiling > > > > Le 11/05/2026 à 15:54, Prike Liang a écrit : > > Add ftrace events for the userq eviction fence lifecycle. > > > > Signed-off-by: Prike Liang > > --- > > .../drm/amd/amdgpu/amdgpu_eviction_fence.c| 8 +++- > > drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 42 +++ > > 2 files changed, 49 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 > > #include > > #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 d421a44ef933..5191f4e957d5 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h > > @@ -709,6 +709,48 @@ TRACE_EVENT(amdgpu_userq_fence_signal, > > TP_printk("context=%llu, seqno=%llu, rptr=%llu", > > __entry->context, __entry->seqno, __entry->rptr) > > ); > > +TRACE_EVENT(amdgpu_userq_eviction_fence_emit, > > + 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("context=%llu, seqno=%llu", > > + __entry->context, __entry->seqno) > > I'll leave it to others to decide if these events are useful, but if you keep > them please > use "fence=%llu:%llu" for consistency. I think this will help understanding and profiling the userq objects bookkeeping usage and userq eviction latency. > Pierre-Eric > > > +); > > +TRACE_EVENT(amdgpu_userq_eviction_fence_enable_signaling, > > + 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; > > + ), > >
Re: [PATCH 4/4] drm/amdgpu: add eviction fence tracepoints for userq profiling
Le 11/05/2026 à 15:54, Prike Liang a écrit :
Add ftrace events for the userq eviction fence lifecycle.
Signed-off-by: Prike Liang
---
.../drm/amd/amdgpu/amdgpu_eviction_fence.c| 8 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 42 +++
2 files changed, 49 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
#include
#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 d421a44ef933..5191f4e957d5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h
@@ -709,6 +709,48 @@ TRACE_EVENT(amdgpu_userq_fence_signal,
TP_printk("context=%llu, seqno=%llu, rptr=%llu",
__entry->context, __entry->seqno, __entry->rptr)
);
+TRACE_EVENT(amdgpu_userq_eviction_fence_emit,
+ 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("context=%llu, seqno=%llu",
+ __entry->context, __entry->seqno)
I'll leave it to others to decide if these events are useful, but if you keep them please use
"fence=%llu:%llu" for consistency.
Pierre-Eric
+);
+TRACE_EVENT(amdgpu_userq_eviction_fence_enable_signaling,
+ 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("context=%llu, seqno=%llu",
+ __entry->context, __entry->seqno)
+);
+TRACE_EVENT(amdgpu_userq_eviction_fence_signal,
+ 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("context=%llu, seqno=%llu",
+ __entry->context, __entry->seqno)
+);
#undef AMDGPU_JOB_GET_TIMELINE_NAME
#endif
