Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: trace frequency limits change

systrace used for tracing for Android systems has carried a patch for
many years in the Android tree that traces when the cpufreq limits
change. With the help of this information, systrace can know when the
policy limits change and can visually display the data. Lets add
upstream support for the same.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Ruchi Kandoi and committed by
Rafael J. Wysocki
601b2185 6e926363

+27
+1
Documentation/trace/events-power.rst
··· 27 27 28 28 cpu_idle "state=%lu cpu_id=%lu" 29 29 cpu_frequency "state=%lu cpu_id=%lu" 30 + cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu" 30 31 31 32 A suspend event is used to indicate the system going in and out of the 32 33 suspend mode:
+1
drivers/cpufreq/cpufreq.c
··· 2236 2236 2237 2237 policy->min = new_policy->min; 2238 2238 policy->max = new_policy->max; 2239 + trace_cpu_frequency_limits(policy); 2239 2240 2240 2241 policy->cached_target_freq = UINT_MAX; 2241 2242
+25
include/trace/events/power.h
··· 5 5 #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ) 6 6 #define _TRACE_POWER_H 7 7 8 + #include <linux/cpufreq.h> 8 9 #include <linux/ktime.h> 9 10 #include <linux/pm_qos.h> 10 11 #include <linux/tracepoint.h> ··· 147 146 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 148 147 149 148 TP_ARGS(frequency, cpu_id) 149 + ); 150 + 151 + TRACE_EVENT(cpu_frequency_limits, 152 + 153 + TP_PROTO(struct cpufreq_policy *policy), 154 + 155 + TP_ARGS(policy), 156 + 157 + TP_STRUCT__entry( 158 + __field(u32, min_freq) 159 + __field(u32, max_freq) 160 + __field(u32, cpu_id) 161 + ), 162 + 163 + TP_fast_assign( 164 + __entry->min_freq = policy->min; 165 + __entry->max_freq = policy->max; 166 + __entry->cpu_id = policy->cpu; 167 + ), 168 + 169 + TP_printk("min=%lu max=%lu cpu_id=%lu", 170 + (unsigned long)__entry->min_freq, 171 + (unsigned long)__entry->max_freq, 172 + (unsigned long)__entry->cpu_id) 150 173 ); 151 174 152 175 TRACE_EVENT(device_pm_callback_start,