summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/cpufreq_cooling.c
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2022-06-13 14:43:25 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-07-28 17:29:42 +0200
commit3f7ced7ac9af43fbc0b886aa9ef4397a5fa4b6e1 (patch)
treea417fbaf45b58420e6aac67a0768b38531e22679 /drivers/thermal/cpufreq_cooling.c
parentdrivers/thermal/cpufreq_cooling: Use private callback ops for each cooling de... (diff)
downloadlinux-3f7ced7ac9af43fbc0b886aa9ef4397a5fa4b6e1.tar.xz
linux-3f7ced7ac9af43fbc0b886aa9ef4397a5fa4b6e1.zip
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: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://lore.kernel.org/r/20220613124327.30766-3-lukasz.luba@arm.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/cpufreq_cooling.c')
-rw-r--r--drivers/thermal/cpufreq_cooling.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index ad8b86f5281b..492a67e267e8 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -216,16 +216,9 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
u32 total_load = 0;
struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
struct cpufreq_policy *policy = cpufreq_cdev->policy;
- u32 *load_cpu = NULL;
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) {
u32 load;
@@ -235,22 +228,13 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
load = 0;
total_load += load;
- if (load_cpu)
- load_cpu[i] = load;
-
- i++;
}
cpufreq_cdev->last_load = total_load;
*power = get_dynamic_power(cpufreq_cdev, freq);
- if (load_cpu) {
- trace_thermal_power_cpu_get_power(policy->related_cpus, freq,
- load_cpu, i, *power);
-
- kfree(load_cpu);
- }
+ trace_thermal_power_cpu_get_power_simple(policy->cpu, *power);
return 0;
}