sched: walt: add trace in update_cpu_capacity

When cpu capacities are updated, due to either thermal or frequency
limits, print trace output to understand why the change happened.

Change-Id: I5c09ddbcbfae5b26a23d6d2ca07b38c89159f878
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2021-11-03 13:18:19 -07:00 committed by Rishabh Bhatnagar
parent 3eeb00d318
commit f9d4ca7937
2 changed files with 42 additions and 2 deletions

View File

@ -1371,7 +1371,42 @@ TRACE_EVENT(halt_cpus,
TP_printk("req_cpus=0x%x halt_cpus=0x%x time=%u us halt=%d success=%d",
__entry->cpus, __entry->halted_cpus,
__entry->time, __entry->halt, __entry->success)
);
TRACE_EVENT(update_cpu_capacity,
TP_PROTO(int cpu, unsigned long rt_pressure, unsigned long capacity),
TP_ARGS(cpu, rt_pressure, capacity),
TP_STRUCT__entry(
__field(int, cpu)
__field(unsigned long, rt_pressure)
__field(unsigned long, capacity)
__field(unsigned long, arch_capacity)
__field(unsigned long, thermal_cap)
__field(unsigned long, max_possible_freq)
__field(unsigned long, max_freq)
),
TP_fast_assign(
struct walt_sched_cluster *cluster = cpu_cluster(cpu);
__entry->cpu = cpu;
__entry->rt_pressure = rt_pressure;
__entry->capacity = capacity;
__entry->arch_capacity = arch_scale_cpu_capacity(cpu);
__entry->thermal_cap = arch_scale_cpu_capacity(cpu) -
arch_scale_thermal_pressure(cpu);
__entry->max_freq = cluster->max_freq;
__entry->max_possible_freq = cluster->max_possible_freq;
),
TP_printk("cpu=%d arch_capacity=%lu thermal_cap=%lu rt_pressure=%lu max_freq=%lu max_possible_freq=%lu capacity=%lu",
__entry->cpu, __entry->arch_capacity,
__entry->thermal_cap, __entry->rt_pressure,
__entry->max_freq, __entry->max_possible_freq,
__entry->capacity)
);
#endif /* _TRACE_WALT_H */

View File

@ -3823,9 +3823,9 @@ static void android_rvh_update_cpu_capacity(void *unused, int cpu, unsigned long
{
unsigned long fmax_capacity = arch_scale_cpu_capacity(cpu);
unsigned long thermal_pressure = arch_scale_thermal_pressure(cpu);
unsigned long thermal_cap;
struct walt_sched_cluster *cluster;
unsigned long thermal_cap, old;
unsigned long rt_pressure = fmax_capacity - *capacity;
struct walt_sched_cluster *cluster;
struct rq *rq = cpu_rq(cpu);
if (unlikely(walt_disabled))
@ -3845,7 +3845,12 @@ static void android_rvh_update_cpu_capacity(void *unused, int cpu, unsigned long
fmax_capacity = mult_frac(fmax_capacity, cluster->max_freq,
cluster->max_possible_freq);
old = rq->cpu_capacity_orig;
rq->cpu_capacity_orig = min(fmax_capacity, thermal_cap);
if (old != rq->cpu_capacity_orig)
trace_update_cpu_capacity(cpu, rt_pressure, *capacity);
*capacity = max(rq->cpu_capacity_orig - rt_pressure, 1UL);
}