aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2018-07-24 13:35:44 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-07-26 04:17:47 -0400
commit601b218568a107370086dc5c7a1b283f8d463268 (patch)
tree9d45980743e50f386198cf2c17b44904161c15a5
parent6e926363fc0071e6dc33349dedd97f28e9a2e464 (diff)
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>
-rw-r--r--Documentation/trace/events-power.rst1
-rw-r--r--drivers/cpufreq/cpufreq.c1
-rw-r--r--include/trace/events/power.h25
3 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/trace/events-power.rst b/Documentation/trace/events-power.rst
index a77daca75e30..2ef318962e29 100644
--- a/Documentation/trace/events-power.rst
+++ b/Documentation/trace/events-power.rst
@@ -27,6 +27,7 @@ cpufreq.
27 27
28 cpu_idle "state=%lu cpu_id=%lu" 28 cpu_idle "state=%lu cpu_id=%lu"
29 cpu_frequency "state=%lu cpu_id=%lu" 29 cpu_frequency "state=%lu cpu_id=%lu"
30 cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu"
30 31
31A suspend event is used to indicate the system going in and out of the 32A suspend event is used to indicate the system going in and out of the
32suspend mode: 33suspend mode:
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index b0dfd3222013..52566f1f1050 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2236,6 +2236,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
2236 2236
2237 policy->min = new_policy->min; 2237 policy->min = new_policy->min;
2238 policy->max = new_policy->max; 2238 policy->max = new_policy->max;
2239 trace_cpu_frequency_limits(policy);
2239 2240
2240 policy->cached_target_freq = UINT_MAX; 2241 policy->cached_target_freq = UINT_MAX;
2241 2242
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 908977d69783..f7aece721aed 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -5,6 +5,7 @@
5#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ) 5#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_POWER_H 6#define _TRACE_POWER_H
7 7
8#include <linux/cpufreq.h>
8#include <linux/ktime.h> 9#include <linux/ktime.h>
9#include <linux/pm_qos.h> 10#include <linux/pm_qos.h>
10#include <linux/tracepoint.h> 11#include <linux/tracepoint.h>
@@ -148,6 +149,30 @@ DEFINE_EVENT(cpu, cpu_frequency,
148 TP_ARGS(frequency, cpu_id) 149 TP_ARGS(frequency, cpu_id)
149); 150);
150 151
152TRACE_EVENT(cpu_frequency_limits,
153
154 TP_PROTO(struct cpufreq_policy *policy),
155
156 TP_ARGS(policy),
157
158 TP_STRUCT__entry(
159 __field(u32, min_freq)
160 __field(u32, max_freq)
161 __field(u32, cpu_id)
162 ),
163
164 TP_fast_assign(
165 __entry->min_freq = policy->min;
166 __entry->max_freq = policy->max;
167 __entry->cpu_id = policy->cpu;
168 ),
169
170 TP_printk("min=%lu max=%lu cpu_id=%lu",
171 (unsigned long)__entry->min_freq,
172 (unsigned long)__entry->max_freq,
173 (unsigned long)__entry->cpu_id)
174);
175
151TRACE_EVENT(device_pm_callback_start, 176TRACE_EVENT(device_pm_callback_start,
152 177
153 TP_PROTO(struct device *dev, const char *pm_ops, int event), 178 TP_PROTO(struct device *dev, const char *pm_ops, int event),