Skip to content

Commit

Permalink
drm/msm/gpu: Add GPU freq_change traces
Browse files Browse the repository at this point in the history
Technically the GMU specific one is a bit redundant, but it was useful
to track down a bug.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
  • Loading branch information
Rob Clark committed Sep 9, 2020
1 parent 38c2fa7 commit 74c0a69
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/msm/adreno/a6xx_gmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "a6xx_gpu.h"
#include "a6xx_gmu.xml.h"
#include "msm_gem.h"
#include "msm_gpu_trace.h"
#include "msm_mmu.h"

static void a6xx_gmu_fault(struct a6xx_gmu *gmu)
Expand Down Expand Up @@ -124,6 +125,8 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp)
gmu->current_perf_index = perf_index;
gmu->freq = gmu->gpu_freqs[perf_index];

trace_msm_gmu_freq_change(gmu->freq, perf_index);

/*
* This can get called from devfreq while the hardware is idle. Don't
* bring up the power if it isn't already active
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/msm/msm_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq,
if (IS_ERR(opp))
return PTR_ERR(opp);

trace_msm_gpu_freq_change(dev_pm_opp_get_freq(opp));

if (gpu->funcs->gpu_set_freq)
gpu->funcs->gpu_set_freq(gpu, opp);
else
Expand Down
31 changes: 31 additions & 0 deletions drivers/gpu/drm/msm/msm_gpu_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,37 @@ TRACE_EVENT(msm_gpu_submit_retired,
__entry->start_ticks, __entry->end_ticks)
);


TRACE_EVENT(msm_gpu_freq_change,
TP_PROTO(u32 freq),
TP_ARGS(freq),
TP_STRUCT__entry(
__field(u32, freq)
),
TP_fast_assign(
/* trace freq in MHz to match intel_gpu_freq_change, to make life easier
* for userspace
*/
__entry->freq = DIV_ROUND_UP(freq, 1000000);
),
TP_printk("new_freq=%u", __entry->freq)
);


TRACE_EVENT(msm_gmu_freq_change,
TP_PROTO(u32 freq, u32 perf_index),
TP_ARGS(freq, perf_index),
TP_STRUCT__entry(
__field(u32, freq)
__field(u32, perf_index)
),
TP_fast_assign(
__entry->freq = freq;
__entry->perf_index = perf_index;
),
TP_printk("freq=%u, perf_index=%u", __entry->freq, __entry->perf_index)
);

#endif

#undef TRACE_INCLUDE_PATH
Expand Down

0 comments on commit 74c0a69

Please sign in to comment.