Message ID | 1441904972-5809-5-git-send-email-javi.merino@arm.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Thu, 10 Sep 2015 18:09:31 +0100 Javi Merino <javi.merino@arm.com> wrote: > Tracing is useful for debugging and performance tuning. Add similar > traces to what's present in the cpu cooling device. > > Cc: Zhang Rui <rui.zhang@intel.com> > Cc: Eduardo Valentin <edubezval@gmail.com> > Cc: Steven Rostedt <rostedt@goodmis.org> > Cc: Ingo Molnar <mingo@redhat.com> > Signed-off-by: Javi Merino <javi.merino@arm.com> > --- > drivers/thermal/devfreq_cooling.c | 6 +++++ > include/trace/events/thermal.h | 53 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+) > > diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c > index a032c5d5c374..a27206815066 100644 > --- a/drivers/thermal/devfreq_cooling.c > +++ b/drivers/thermal/devfreq_cooling.c > @@ -25,6 +25,8 @@ > #include <linux/pm_opp.h> > #include <linux/thermal.h> > > +#include <trace/events/thermal.h> > + > static DEFINE_MUTEX(devfreq_lock); > static DEFINE_IDR(devfreq_idr); > > @@ -293,6 +295,9 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd > /* Get static power */ > static_power = get_static_power(dfc, freq); > > + trace_thermal_power_devfreq_get_power(cdev, status, freq, dyn_power, > + static_power); > + > *power = dyn_power + static_power; > > return 0; > @@ -348,6 +353,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, > break; > > *state = i; > + trace_thermal_power_devfreq_limit(cdev, freq, *state, power); I'm curious, does changing the above to: trace_thermal_power_devfreq_limit(cdev, freq, i, power); make the compiled code better? A tracepoint does some whacky things, and gcc may not optimize this. The rest looks fine to me. -- Steve > return 0; > } \ -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Steve, On Thu, Sep 10, 2015 at 06:19:28PM +0100, Steven Rostedt wrote: > On Thu, 10 Sep 2015 18:09:31 +0100 > Javi Merino <javi.merino@arm.com> wrote: > > > Tracing is useful for debugging and performance tuning. Add similar > > traces to what's present in the cpu cooling device. > > > > Cc: Zhang Rui <rui.zhang@intel.com> > > Cc: Eduardo Valentin <edubezval@gmail.com> > > Cc: Steven Rostedt <rostedt@goodmis.org> > > Cc: Ingo Molnar <mingo@redhat.com> > > Signed-off-by: Javi Merino <javi.merino@arm.com> > > --- > > drivers/thermal/devfreq_cooling.c | 6 +++++ > > include/trace/events/thermal.h | 53 +++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 59 insertions(+) > > > > diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c > > index a032c5d5c374..a27206815066 100644 > > --- a/drivers/thermal/devfreq_cooling.c > > +++ b/drivers/thermal/devfreq_cooling.c > > @@ -25,6 +25,8 @@ > > #include <linux/pm_opp.h> > > #include <linux/thermal.h> > > > > +#include <trace/events/thermal.h> > > + > > static DEFINE_MUTEX(devfreq_lock); > > static DEFINE_IDR(devfreq_idr); > > > > @@ -293,6 +295,9 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd > > /* Get static power */ > > static_power = get_static_power(dfc, freq); > > > > + trace_thermal_power_devfreq_get_power(cdev, status, freq, dyn_power, > > + static_power); > > + > > *power = dyn_power + static_power; > > > > return 0; > > @@ -348,6 +353,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, > > break; > > > > *state = i; > > + trace_thermal_power_devfreq_limit(cdev, freq, *state, power); > > I'm curious, does changing the above to: > > trace_thermal_power_devfreq_limit(cdev, freq, i, power); > > make the compiled code better? > > A tracepoint does some whacky things, and gcc may not optimize this. I've compared the generated assembly on arm, arm64 and x86_64 and both options generate exactly the same code. Cheers, Javi -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, 18 Sep 2015 14:55:51 +0100 Javi Merino <javi.merino@arm.com> wrote: > > A tracepoint does some whacky things, and gcc may not optimize this. > > I've compared the generated assembly on arm, arm64 and x86_64 and both > options generate exactly the same code. Thanks for checking. I was just curious, and I'm wary about trusting gcc to optimize correctly ;-) -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Steve, On Thu, Sep 10, 2015 at 06:19:28PM +0100, Steven Rostedt wrote: > On Thu, 10 Sep 2015 18:09:31 +0100 > Javi Merino <javi.merino@arm.com> wrote: > > > Tracing is useful for debugging and performance tuning. Add similar > > traces to what's present in the cpu cooling device. > > > > Cc: Zhang Rui <rui.zhang@intel.com> > > Cc: Eduardo Valentin <edubezval@gmail.com> > > Cc: Steven Rostedt <rostedt@goodmis.org> > > Cc: Ingo Molnar <mingo@redhat.com> > > Signed-off-by: Javi Merino <javi.merino@arm.com> > > --- > > drivers/thermal/devfreq_cooling.c | 6 +++++ > > include/trace/events/thermal.h | 53 +++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 59 insertions(+) > > > > diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c > > index a032c5d5c374..a27206815066 100644 > > --- a/drivers/thermal/devfreq_cooling.c > > +++ b/drivers/thermal/devfreq_cooling.c > > @@ -25,6 +25,8 @@ > > #include <linux/pm_opp.h> > > #include <linux/thermal.h> > > > > +#include <trace/events/thermal.h> > > + > > static DEFINE_MUTEX(devfreq_lock); > > static DEFINE_IDR(devfreq_idr); > > > > @@ -293,6 +295,9 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd > > /* Get static power */ > > static_power = get_static_power(dfc, freq); > > > > + trace_thermal_power_devfreq_get_power(cdev, status, freq, dyn_power, > > + static_power); > > + > > *power = dyn_power + static_power; > > > > return 0; > > @@ -348,6 +353,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, > > break; > > > > *state = i; > > + trace_thermal_power_devfreq_limit(cdev, freq, *state, power); > > I'm curious, does changing the above to: > > trace_thermal_power_devfreq_limit(cdev, freq, i, power); > > make the compiled code better? > > A tracepoint does some whacky things, and gcc may not optimize this. > > The rest looks fine to me. Can I treat that last statement as an Acked-by? -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 14 Oct 2015 12:53:30 +0100 Javi Merino <javi.merino@arm.com> wrote: > > The rest looks fine to me. > > Can I treat that last statement as an Acked-by? Sure, why not ;-) -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c index a032c5d5c374..a27206815066 100644 --- a/drivers/thermal/devfreq_cooling.c +++ b/drivers/thermal/devfreq_cooling.c @@ -25,6 +25,8 @@ #include <linux/pm_opp.h> #include <linux/thermal.h> +#include <trace/events/thermal.h> + static DEFINE_MUTEX(devfreq_lock); static DEFINE_IDR(devfreq_idr); @@ -293,6 +295,9 @@ static int devfreq_cooling_get_requested_power(struct thermal_cooling_device *cd /* Get static power */ static_power = get_static_power(dfc, freq); + trace_thermal_power_devfreq_get_power(cdev, status, freq, dyn_power, + static_power); + *power = dyn_power + static_power; return 0; @@ -348,6 +353,7 @@ static int devfreq_cooling_power2state(struct thermal_cooling_device *cdev, break; *state = i; + trace_thermal_power_devfreq_limit(cdev, freq, *state, power); return 0; } diff --git a/include/trace/events/thermal.h b/include/trace/events/thermal.h index 8b1f80682b80..5738bb3e2343 100644 --- a/include/trace/events/thermal.h +++ b/include/trace/events/thermal.h @@ -4,6 +4,7 @@ #if !defined(_TRACE_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ) #define _TRACE_THERMAL_H +#include <linux/devfreq.h> #include <linux/thermal.h> #include <linux/tracepoint.h> @@ -135,6 +136,58 @@ TRACE_EVENT(thermal_power_cpu_limit, __entry->power) ); +TRACE_EVENT(thermal_power_devfreq_get_power, + TP_PROTO(struct thermal_cooling_device *cdev, + struct devfreq_dev_status *status, unsigned long freq, + u32 dynamic_power, u32 static_power), + + TP_ARGS(cdev, status, freq, dynamic_power, static_power), + + TP_STRUCT__entry( + __string(type, cdev->type ) + __field(unsigned long, freq ) + __field(u32, load ) + __field(u32, dynamic_power ) + __field(u32, static_power ) + ), + + TP_fast_assign( + __assign_str(type, cdev->type); + __entry->freq = freq; + __entry->load = (100 * status->busy_time) / status->total_time; + __entry->dynamic_power = dynamic_power; + __entry->static_power = static_power; + ), + + TP_printk("type=%s freq=%lu load=%u dynamic_power=%u static_power=%u", + __get_str(type), __entry->freq, + __entry->load, __entry->dynamic_power, __entry->static_power) +); + +TRACE_EVENT(thermal_power_devfreq_limit, + TP_PROTO(struct thermal_cooling_device *cdev, unsigned long freq, + unsigned long cdev_state, u32 power), + + TP_ARGS(cdev, freq, cdev_state, power), + + TP_STRUCT__entry( + __string(type, cdev->type) + __field(unsigned int, freq ) + __field(unsigned long, cdev_state) + __field(u32, power ) + ), + + TP_fast_assign( + __assign_str(type, cdev->type); + __entry->freq = freq; + __entry->cdev_state = cdev_state; + __entry->power = power; + ), + + TP_printk("type=%s freq=%u cdev_state=%lu power=%u", + __get_str(type), __entry->freq, __entry->cdev_state, + __entry->power) +); #endif /* _TRACE_THERMAL_H */ /* This part must be outside protection */
Tracing is useful for debugging and performance tuning. Add similar traces to what's present in the cpu cooling device. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@redhat.com> Signed-off-by: Javi Merino <javi.merino@arm.com> --- drivers/thermal/devfreq_cooling.c | 6 +++++ include/trace/events/thermal.h | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)