summaryrefslogtreecommitdiff
path: root/mali_kbase
diff options
context:
space:
mode:
authorVarad Gautam <varadgautam@google.com>2023-07-25 20:40:14 +0000
committerVarad Gautam <varadgautam@google.com>2023-09-20 12:19:17 +0000
commit1d0b803cdc30ee442f87d9b7b1a1fd185a43ba6a (patch)
tree9d3911ddb7b14e46e694be9bc9b3c7422f5270d0 /mali_kbase
parent869556c931d81867b14a130a838a70d6561b9ba8 (diff)
downloadgpu-1d0b803cdc30ee442f87d9b7b1a1fd185a43ba6a.tar.gz
mali_kbase: Tracepoints for governor recommendation
Record the freq recommended by the governor before it's clamped via a new `gpu_gov_rec` clock tracepoint. Also record a new tracepoint `gpu_gov_rec_violate` if this freq is outside of the level lock window. Bug: 291855615 Test: Manual trace Signed-off-by: Varad Gautam <varadgautam@google.com> Change-Id: I45d0ffbebb6fa83d1a47b9d2afc8d96ce420afce
Diffstat (limited to 'mali_kbase')
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_dvfs_governor.c19
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_trace.h24
2 files changed, 41 insertions, 2 deletions
diff --git a/mali_kbase/platform/pixel/pixel_gpu_dvfs_governor.c b/mali_kbase/platform/pixel/pixel_gpu_dvfs_governor.c
index a4d4a61..28d4073 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_dvfs_governor.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_dvfs_governor.c
@@ -7,11 +7,13 @@
/* Mali core includes */
#include <mali_kbase.h>
+#include <trace/events/power.h>
/* Pixel integration includes */
#include "mali_kbase_config_platform.h"
#include "pixel_gpu_control.h"
#include "pixel_gpu_dvfs.h"
+#include "pixel_gpu_trace.h"
/**
* gpu_dvfs_governor_basic() - The evaluation function for &GPU_DVFS_GOVERNOR_BASIC.
@@ -165,11 +167,24 @@ int gpu_dvfs_governor_get_next_level(struct kbase_device *kbdev,
struct gpu_dvfs_utlization *util_stats)
{
struct pixel_context *pc = kbdev->platform_context;
- int level;
+ int level, ret;
lockdep_assert_held(&pc->dvfs.lock);
level = governors[pc->dvfs.governor.curr].evaluate(kbdev, util_stats);
- return clamp(level, pc->dvfs.level_scaling_max, pc->dvfs.level_scaling_min);
+ if (level != pc->dvfs.level) {
+ trace_clock_set_rate("gpu_gov_rec", pc->dvfs.table[level].clk[GPU_DVFS_CLK_SHADERS],
+ raw_smp_processor_id());
+ }
+
+ ret = clamp(level, pc->dvfs.level_scaling_max, pc->dvfs.level_scaling_min);
+ if (ret != level) {
+ trace_gpu_gov_rec_violate(pc->dvfs.table[level].clk[GPU_DVFS_CLK_SHADERS],
+ pc->dvfs.table[ret].clk[GPU_DVFS_CLK_SHADERS],
+ pc->dvfs.table[pc->dvfs.level_scaling_min].clk[GPU_DVFS_CLK_SHADERS],
+ pc->dvfs.table[pc->dvfs.level_scaling_max].clk[GPU_DVFS_CLK_SHADERS]);
+ }
+
+ return ret;
}
/**
diff --git a/mali_kbase/platform/pixel/pixel_gpu_trace.h b/mali_kbase/platform/pixel/pixel_gpu_trace.h
index 1165e75..6c30f1b 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_trace.h
+++ b/mali_kbase/platform/pixel/pixel_gpu_trace.h
@@ -45,6 +45,30 @@ TRACE_EVENT(gpu_power_state,
)
);
+TRACE_EVENT(gpu_gov_rec_violate,
+ TP_PROTO(unsigned int recfreq, unsigned int retfreq,
+ unsigned int minlvfreq, unsigned int maxlvfreq),
+ TP_ARGS(recfreq, retfreq, minlvfreq, maxlvfreq),
+ TP_STRUCT__entry(
+ __field(unsigned int, recfreq)
+ __field(unsigned int, retfreq)
+ __field(unsigned int, minlvfreq)
+ __field(unsigned int, maxlvfreq)
+ ),
+ TP_fast_assign(
+ __entry->recfreq = recfreq;
+ __entry->retfreq = retfreq;
+ __entry->minlvfreq = minlvfreq;
+ __entry->maxlvfreq = maxlvfreq;
+ ),
+ TP_printk("rec=%u ret=%u min=%u max=%u",
+ __entry->recfreq,
+ __entry->retfreq,
+ __entry->minlvfreq,
+ __entry->maxlvfreq
+ )
+);
+
#endif /* _TRACE_PIXEL_GPU_H */
/* This part must be outside protection */