drm/msm/a6xx: Add traces for preemption

Add trace points corresponding to preemption being triggered and being
completed for latency measurement purposes.

Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8450-HDK
Signed-off-by: Antonino Maniscalco <antomani103@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/618026/
Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
Antonino Maniscalco 2024-10-03 18:12:58 +02:00 committed by Rob Clark
parent 50117cad0c
commit 35d36dc169
2 changed files with 34 additions and 0 deletions

View file

@ -7,6 +7,7 @@
#include "a6xx_gpu.h"
#include "a6xx_gmu.xml.h"
#include "msm_mmu.h"
#include "msm_gpu_trace.h"
/*
* Try to transition the preemption state from old to new. Return
@ -174,6 +175,8 @@ void a6xx_preempt_irq(struct msm_gpu *gpu)
set_preempt_state(a6xx_gpu, PREEMPT_NONE);
trace_msm_gpu_preemption_irq(a6xx_gpu->cur_ring->id);
/*
* Retrigger preemption to avoid a deadlock that might occur when preemption
* is skipped due to it being already in flight when requested.
@ -294,6 +297,9 @@ void a6xx_preempt_trigger(struct msm_gpu *gpu)
*/
ring->restore_wptr = false;
trace_msm_gpu_preemption_trigger(a6xx_gpu->cur_ring->id,
ring ? ring->id : -1);
spin_unlock_irqrestore(&ring->preempt_lock, flags);
gpu_write64(gpu,

View file

@ -177,6 +177,34 @@ TRACE_EVENT(msm_gpu_resume,
TP_printk("%u", __entry->dummy)
);
TRACE_EVENT(msm_gpu_preemption_trigger,
TP_PROTO(int ring_id_from, int ring_id_to),
TP_ARGS(ring_id_from, ring_id_to),
TP_STRUCT__entry(
__field(int, ring_id_from)
__field(int, ring_id_to)
),
TP_fast_assign(
__entry->ring_id_from = ring_id_from;
__entry->ring_id_to = ring_id_to;
),
TP_printk("preempting %u -> %u",
__entry->ring_id_from,
__entry->ring_id_to)
);
TRACE_EVENT(msm_gpu_preemption_irq,
TP_PROTO(u32 ring_id),
TP_ARGS(ring_id),
TP_STRUCT__entry(
__field(u32, ring_id)
),
TP_fast_assign(
__entry->ring_id = ring_id;
),
TP_printk("preempted to %u", __entry->ring_id)
);
#endif
#undef TRACE_INCLUDE_PATH