提交 3f7ced7a 编写于 作者: L Lukasz Luba 提交者: Daniel Lezcano

drivers/thermal/cpufreq_cooling : Refactor thermal_power_cpu_get_power tracing

Simplify the thermal_power_cpu_get_power trace event by removing
complicated cpumask and variable length array. Now the tools parsing trace
output don't have to hassle to get this power data. The simplified format
version uses 'policy->cpu'. Remove also the 'load' information completely
since there is very little value of it in this trace event. To get the
CPUs' load (or utilization) there are other dedicated trace hooks in the
kernel. This patch also simplifies and speeds-up the main cooling code
when that trace event is enabled.

Rename the trace event to avoid confusion of tools which parse the trace
file.
Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NLukasz Luba <lukasz.luba@arm.com>
Link: https://lore.kernel.org/r/20220613124327.30766-3-lukasz.luba@arm.comSigned-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
上级 3cbf6a8a
...@@ -216,16 +216,9 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, ...@@ -216,16 +216,9 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
u32 total_load = 0; u32 total_load = 0;
struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
struct cpufreq_policy *policy = cpufreq_cdev->policy; struct cpufreq_policy *policy = cpufreq_cdev->policy;
u32 *load_cpu = NULL;
freq = cpufreq_quick_get(policy->cpu); freq = cpufreq_quick_get(policy->cpu);
if (trace_thermal_power_cpu_get_power_enabled()) {
u32 ncpus = cpumask_weight(policy->related_cpus);
load_cpu = kcalloc(ncpus, sizeof(*load_cpu), GFP_KERNEL);
}
for_each_cpu(cpu, policy->related_cpus) { for_each_cpu(cpu, policy->related_cpus) {
u32 load; u32 load;
...@@ -235,22 +228,13 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, ...@@ -235,22 +228,13 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
load = 0; load = 0;
total_load += load; total_load += load;
if (load_cpu)
load_cpu[i] = load;
i++;
} }
cpufreq_cdev->last_load = total_load; cpufreq_cdev->last_load = total_load;
*power = get_dynamic_power(cpufreq_cdev, freq); *power = get_dynamic_power(cpufreq_cdev, freq);
if (load_cpu) { trace_thermal_power_cpu_get_power_simple(policy->cpu, *power);
trace_thermal_power_cpu_get_power(policy->related_cpus, freq,
load_cpu, i, *power);
kfree(load_cpu);
}
return 0; return 0;
} }
......
...@@ -92,34 +92,22 @@ TRACE_EVENT(thermal_zone_trip, ...@@ -92,34 +92,22 @@ TRACE_EVENT(thermal_zone_trip,
); );
#ifdef CONFIG_CPU_THERMAL #ifdef CONFIG_CPU_THERMAL
TRACE_EVENT(thermal_power_cpu_get_power, TRACE_EVENT(thermal_power_cpu_get_power_simple,
TP_PROTO(const struct cpumask *cpus, unsigned long freq, u32 *load, TP_PROTO(int cpu, u32 power),
size_t load_len, u32 dynamic_power),
TP_ARGS(cpus, freq, load, load_len, dynamic_power), TP_ARGS(cpu, power),
TP_STRUCT__entry( TP_STRUCT__entry(
__bitmask(cpumask, num_possible_cpus()) __field(int, cpu)
__field(unsigned long, freq ) __field(u32, power)
__dynamic_array(u32, load, load_len)
__field(size_t, load_len )
__field(u32, dynamic_power )
), ),
TP_fast_assign( TP_fast_assign(
__assign_bitmask(cpumask, cpumask_bits(cpus), __entry->cpu = cpu;
num_possible_cpus()); __entry->power = power;
__entry->freq = freq;
memcpy(__get_dynamic_array(load), load,
load_len * sizeof(*load));
__entry->load_len = load_len;
__entry->dynamic_power = dynamic_power;
), ),
TP_printk("cpus=%s freq=%lu load={%s} dynamic_power=%d", TP_printk("cpu=%d power=%u", __entry->cpu, __entry->power)
__get_bitmask(cpumask), __entry->freq,
__print_array(__get_dynamic_array(load), __entry->load_len, 4),
__entry->dynamic_power)
); );
TRACE_EVENT(thermal_power_cpu_limit, TRACE_EVENT(thermal_power_cpu_limit,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册