sched/walt: Improve the scheduler

Improve core_ctl tracing such that the necessary flags for
debugging eval_need are present in the trace, and so that
all returns go through the same tracepoint, unlocking, and
return functionality.

Change-Id: I61d5ab86ba7650bea77e4416b0ffa9a07869bbf3
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
This commit is contained in:
Stephen Dickey 2021-08-24 11:44:46 -07:00 committed by Rishabh Bhatnagar
parent 318d73bd4d
commit b7b0355db1
2 changed files with 30 additions and 15 deletions

View File

@ -290,7 +290,7 @@ static ssize_t show_active_cpus(const struct cluster_data *state, char *buf)
return scnprintf(buf, PAGE_SIZE, "%u\n", state->active_cpus);
}
static unsigned int nr_paused_cpus(const struct cluster_data *cluster)
static unsigned int cluster_paused_cpus(const struct cluster_data *cluster)
{
cpumask_t cluster_paused_cpus;
@ -339,8 +339,8 @@ static ssize_t show_global_state(const struct cluster_data *state, char *buf)
count += scnprintf(buf + count, PAGE_SIZE - count,
"\tNeed CPUs: %u\n", cluster->need_cpus);
count += scnprintf(buf + count, PAGE_SIZE - count,
"\tNr paused CPUs: %u\n",
nr_paused_cpus(cluster));
"\tCluster paused CPUs: %u\n",
cluster_paused_cpus(cluster));
count += scnprintf(buf + count, PAGE_SIZE - count,
"\tBoost: %u\n", (unsigned int) cluster->boost);
}
@ -616,7 +616,7 @@ static int prev_cluster_nr_need_assist(int index)
* Next cluster should not assist, while there are paused cpus
* in this cluster.
*/
if (nr_paused_cpus(prev_cluster))
if (cluster_paused_cpus(prev_cluster))
return 0;
for_each_cpu(cpu, &prev_cluster->cpu_mask)
@ -777,7 +777,7 @@ static bool adjustment_possible(const struct cluster_data *cluster,
unsigned int need)
{
return (need < cluster->active_cpus || (need > cluster->active_cpus &&
nr_paused_cpus(cluster)));
cluster_paused_cpus(cluster)));
}
static bool need_all_cpus(const struct cluster_data *cluster)
@ -837,8 +837,8 @@ static bool eval_need(struct cluster_data *cluster)
*/
if (new_need == last_need && new_need == cluster->active_cpus) {
cluster->need_ts = now;
spin_unlock_irqrestore(&state_lock, flags);
return false;
ret = 0;
goto unlock;
}
elapsed = now - cluster->need_ts;
@ -849,8 +849,11 @@ static bool eval_need(struct cluster_data *cluster)
cluster->need_ts = now;
cluster->need_cpus = new_need;
}
unlock:
trace_core_ctl_eval_need(cluster->first_cpu, last_need, new_need,
ret && need_flag);
cluster->active_cpus, ret, need_flag,
ret && need_flag, cluster->need_ts);
spin_unlock_irqrestore(&state_lock, flags);
return ret && need_flag;

View File

@ -444,23 +444,35 @@ TRACE_EVENT(sched_load_to_gov,
TRACE_EVENT(core_ctl_eval_need,
TP_PROTO(unsigned int cpu, unsigned int old_need,
unsigned int new_need, unsigned int updated),
TP_ARGS(cpu, old_need, new_need, updated),
TP_PROTO(unsigned int cpu, unsigned int last_need,
unsigned int new_need, unsigned int active_cpus,
unsigned int ret, unsigned int need_flag,
unsigned int updated, s64 need_ts),
TP_ARGS(cpu, last_need, new_need, active_cpus, ret, need_flag, updated, need_ts),
TP_STRUCT__entry(
__field(u32, cpu)
__field(u32, old_need)
__field(u32, last_need)
__field(u32, new_need)
__field(u32, active_cpus)
__field(u32, ret)
__field(u32, need_flag)
__field(u32, updated)
__field(s64, need_ts)
),
TP_fast_assign(
__entry->cpu = cpu;
__entry->old_need = old_need;
__entry->last_need = last_need;
__entry->new_need = new_need;
__entry->active_cpus = active_cpus;
__entry->ret = ret;
__entry->need_flag = need_flag;
__entry->updated = updated;
__entry->need_ts = need_ts;
),
TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu,
__entry->old_need, __entry->new_need, __entry->updated)
TP_printk("cpu=%u last_need=%u new_need=%u active_cpus=%u ret=%u need_flag=%u updated=%u need_ts=%llu",
__entry->cpu, __entry->last_need, __entry->new_need,
__entry->active_cpus, __entry->ret, __entry->need_flag,
__entry->updated, __entry->need_ts)
);
TRACE_EVENT(core_ctl_set_busy,