Message ID | 20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] tracing, dma-buf: add a trace_dma_fence_sync_to event | expand |
This series adds new events to make it easier for tools like gpuvis or umr to graph the GPUs, kernel and applications activity. UMR patches using these events can be found here: https://gitlab.freedesktop.org/tomstdenis/umr/-/merge_requests/37 V1: https://patchwork.kernel.org/project/linux-media/patch/20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com/ Changes from V1: * uses trace_dma_fence_sync_to from dma-fence-chain.c * new amdgpu events * new drm plane commit event Pierre-Eric Pelloux-Prayer (6): tracing, dma-buf: add a trace_dma_fence_sync_to event dma-buf/fence-chain: use trace_dma_fence_sync_to amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync drm/amdgpu: add BO clear event drm/amdgpu: add a amdgpu_cs_ioctl2 event drm: add drm_mode_atomic_commit event drivers/dma-buf/dma-fence-chain.c | 4 +++ drivers/dma-buf/dma-fence.c | 1 + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 +++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 8 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 11 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 28 +++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c | 4 +-- drivers/gpu/drm/drm_atomic_uapi.c | 19 +++++++++++ drivers/gpu/drm/drm_trace.h | 28 +++++++++++++-- include/trace/events/dma_fence.h | 34 +++++++++++++++++++ 14 files changed, 144 insertions(+), 26 deletions(-)
On Tue, Feb 13, 2024 at 04:50:25PM +0100, Pierre-Eric Pelloux-Prayer wrote: > This series adds new events to make it easier for tools > like gpuvis or umr to graph the GPUs, kernel and applications > activity. > > UMR patches using these events can be found here: > https://gitlab.freedesktop.org/tomstdenis/umr/-/merge_requests/37 > > V1: > https://patchwork.kernel.org/project/linux-media/patch/20240117184329.479554-1-pierre-eric.pelloux-prayer@amd.com/ > > Changes from V1: > * uses trace_dma_fence_sync_to from dma-fence-chain.c > * new amdgpu events > * new drm plane commit event I think a patch to add this to the drm/sched dependency tracking would be really neat. With the addition of drm_sched_job_add_dependency() and friends that would wire up some basic dependency tracking for a _lot_ of drivers. It should also be done before the amdgpu specific additions, because amdgpu is also using that and we don't want to duplicate fence dependency tracking in drivers that should be in common code. Cheer, Sima > > Pierre-Eric Pelloux-Prayer (6): > tracing, dma-buf: add a trace_dma_fence_sync_to event > dma-buf/fence-chain: use trace_dma_fence_sync_to > amdgpu: use trace_dma_fence_sync_to in amdgpu_fence_sync > drm/amdgpu: add BO clear event > drm/amdgpu: add a amdgpu_cs_ioctl2 event > drm: add drm_mode_atomic_commit event > > drivers/dma-buf/dma-fence-chain.c | 4 +++ > drivers/dma-buf/dma-fence.c | 1 + > .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 16 +++++---- > drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 8 ++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 +-- > drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++ > drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 11 ++++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 3 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h | 28 +++++++++++++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c | 4 +-- > drivers/gpu/drm/drm_atomic_uapi.c | 19 +++++++++++ > drivers/gpu/drm/drm_trace.h | 28 +++++++++++++-- > include/trace/events/dma_fence.h | 34 +++++++++++++++++++ > 14 files changed, 144 insertions(+), 26 deletions(-) > > -- > 2.40.1 >
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index e0fd99e61a2d..671a499a5ccd 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -23,6 +23,7 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit); EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal); EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled); +EXPORT_TRACEPOINT_SYMBOL(dma_fence_sync_to); static DEFINE_SPINLOCK(dma_fence_stub_lock); static struct dma_fence dma_fence_stub; diff --git a/include/trace/events/dma_fence.h b/include/trace/events/dma_fence.h index 3963e79ca7b4..9b3875f7aa79 100644 --- a/include/trace/events/dma_fence.h +++ b/include/trace/events/dma_fence.h @@ -83,6 +83,40 @@ DEFINE_EVENT(dma_fence, dma_fence_wait_end, TP_ARGS(fence) ); +DECLARE_EVENT_CLASS(dma_fence_from, + + TP_PROTO(struct dma_fence *fence, const char *reason), + + TP_ARGS(fence, reason), + + TP_STRUCT__entry( + __string(driver, fence->ops->get_driver_name(fence)) + __string(timeline, fence->ops->get_timeline_name(fence)) + __field(unsigned int, context) + __field(unsigned int, seqno) + __string(reason, reason) + ), + + TP_fast_assign( + __assign_str(driver, fence->ops->get_driver_name(fence)); + __assign_str(timeline, fence->ops->get_timeline_name(fence)); + __entry->context = fence->context; + __entry->seqno = fence->seqno; + __assign_str(reason, reason); + ), + + TP_printk("driver=%s timeline=%s context=%u seqno=%u reason=%s", + __get_str(driver), __get_str(timeline), __entry->context, + __entry->seqno, __get_str(reason)) +); + +DEFINE_EVENT(dma_fence_from, dma_fence_sync_to, + + TP_PROTO(struct dma_fence *fence, const char *reason), + + TP_ARGS(fence, reason) +); + #endif /* _TRACE_DMA_FENCE_H */ /* This part must be outside protection */
This new event can be used to trace where a given dma_fence is added as a dependency of some other work. I plan to use it in amdgpu. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> --- drivers/dma-buf/dma-fence.c | 1 + include/trace/events/dma_fence.h | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)