Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 17:18:25 -0400
Eduardo Valentin  wrote:

> Steve,
> 
> On Thu, Feb 26, 2015 at 05:52:59PM -0500, Steven Rostedt wrote:
> > On Thu, 26 Feb 2015 15:46:34 -0400
> > Eduardo Valentin  wrote:
> > 
> >  
> > > I am planing to apply this series to my thermal soc tree. Do you have
> > > any concerns if I send this patch, which touches the tracing files, via
> > > my tree?
> > > 
> > 
> > Which tracing files?
> 
> I am referring to:
> include/trace/events/thermal.h | 58 +
> include/trace/events/thermal_power_allocator.h | 87
> ++
> 
> I know they are new files anyway, but just checking if those can go
> altogether via the thermal tree.

The individual files in include/trace/events belong more to the
maintainers of where the tracepoints are located. I just monitor them
to make sure they are not too whacky ;-)

Feel free to incorporate them in your tree.

If you want...

Acked-by: Steven Rostedt 

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Eduardo Valentin
Steve,

On Thu, Feb 26, 2015 at 05:52:59PM -0500, Steven Rostedt wrote:
> On Thu, 26 Feb 2015 15:46:34 -0400
> Eduardo Valentin  wrote:
> 
>  
> > I am planing to apply this series to my thermal soc tree. Do you have
> > any concerns if I send this patch, which touches the tracing files, via
> > my tree?
> > 
> 
> Which tracing files?

I am referring to:
include/trace/events/thermal.h | 58 +
include/trace/events/thermal_power_allocator.h | 87
++

I know they are new files anyway, but just checking if those can go
altogether via the thermal tree.

BR,

Eduardo Valentin

> 
> -- Steve


signature.asc
Description: Digital signature


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 15:46:34 -0400
Eduardo Valentin  wrote:

 
> I am planing to apply this series to my thermal soc tree. Do you have
> any concerns if I send this patch, which touches the tracing files, via
> my tree?
> 

Which tracing files?

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Eduardo Valentin
On Thu, Feb 26, 2015 at 02:38:45PM -0500, Steven Rostedt wrote:
> On Thu, 26 Feb 2015 19:00:31 +
> Javi Merino  wrote:
> 
> > Add trace events for the power allocator governor and the power actor
> > interface of the cpu cooling device.
> 
> For the tracing parts...
> 
> Acked-by: Steven Rostedt 

Thanks Steve.

I am planing to apply this series to my thermal soc tree. Do you have
any concerns if I send this patch, which touches the tracing files, via
my tree?

BR,


Eduardo Valentin

> 
> -- Steve
> 
> > 
> > Cc: Zhang Rui 
> > Cc: Eduardo Valentin 
> > Cc: Steven Rostedt 
> > Cc: Frederic Weisbecker 
> > Cc: Ingo Molnar 
> > Signed-off-by: Javi Merino 
> > ---


signature.asc
Description: Digital signature


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 19:00:31 +
Javi Merino  wrote:

> Add trace events for the power allocator governor and the power actor
> interface of the cpu cooling device.

For the tracing parts...

Acked-by: Steven Rostedt 

-- Steve

> 
> Cc: Zhang Rui 
> Cc: Eduardo Valentin 
> Cc: Steven Rostedt 
> Cc: Frederic Weisbecker 
> Cc: Ingo Molnar 
> Signed-off-by: Javi Merino 
> ---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Javi Merino
Add trace events for the power allocator governor and the power actor
interface of the cpu cooling device.

Cc: Zhang Rui 
Cc: Eduardo Valentin 
Cc: Steven Rostedt 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Signed-off-by: Javi Merino 
---
 drivers/thermal/cpu_cooling.c  | 31 -
 drivers/thermal/power_allocator.c  | 22 ++-
 include/trace/events/thermal.h | 58 +
 include/trace/events/thermal_power_allocator.h | 87 ++
 4 files changed, 194 insertions(+), 4 deletions(-)
 create mode 100644 include/trace/events/thermal_power_allocator.h

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index ba23150c7bde..c4974144c787 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#include 
+
 /*
  * Cooling state <-> CPUFreq frequency
  *
@@ -588,12 +590,20 @@ static int cpufreq_get_requested_power(struct 
thermal_cooling_device *cdev,
   u32 *power)
 {
unsigned long freq;
-   int cpu, ret;
+   int i = 0, cpu, ret;
u32 static_power, dynamic_power, total_load = 0;
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
+   u32 *load_cpu = NULL;
 
freq = cpufreq_quick_get(cpumask_any(_device->allowed_cpus));
 
+   if (trace_thermal_power_cpu_get_power_enabled()) {
+   u32 ncpus = cpumask_weight(_device->allowed_cpus);
+
+   load_cpu = devm_kcalloc(>device, ncpus, sizeof(*load_cpu),
+   GFP_KERNEL);
+   }
+
for_each_cpu(cpu, _device->allowed_cpus) {
u32 load;
 
@@ -603,14 +613,29 @@ static int cpufreq_get_requested_power(struct 
thermal_cooling_device *cdev,
load = 0;
 
total_load += load;
+   if (trace_thermal_power_cpu_limit_enabled() && load_cpu)
+   load_cpu[i] = load;
+
+   i++;
}
 
cpufreq_device->last_load = total_load;
 
dynamic_power = get_dynamic_power(cpufreq_device, freq);
ret = get_static_power(cpufreq_device, tz, freq, _power);
-   if (ret)
+   if (ret) {
+   if (load_cpu)
+   devm_kfree(>device, load_cpu);
return ret;
+   }
+
+   if (load_cpu) {
+   trace_thermal_power_cpu_get_power(
+   _device->allowed_cpus,
+   freq, load_cpu, i, dynamic_power, static_power);
+
+   devm_kfree(>device, load_cpu);
+   }
 
*power = static_power + dynamic_power;
return 0;
@@ -718,6 +743,8 @@ static int cpufreq_power2state(struct 
thermal_cooling_device *cdev,
return -EINVAL;
}
 
+   trace_thermal_power_cpu_limit(_device->allowed_cpus,
+ target_freq, *state, power);
return 0;
 }
 
diff --git a/drivers/thermal/power_allocator.c 
b/drivers/thermal/power_allocator.c
index bfea8d35c0a2..9b32ccb9ea82 100644
--- a/drivers/thermal/power_allocator.c
+++ b/drivers/thermal/power_allocator.c
@@ -19,6 +19,9 @@
 #include 
 #include 
 
+#define CREATE_TRACE_POINTS
+#include 
+
 #include "thermal_core.h"
 
 #define FRAC_BITS 10
@@ -138,7 +141,14 @@ static u32 pid_controller(struct thermal_zone_device *tz,
/* feed-forward the known sustainable dissipatable power */
power_range = tz->tzp->sustainable_power + frac_to_int(power_range);
 
-   return clamp(power_range, (s64)0, (s64)max_allocatable_power);
+   power_range = clamp(power_range, (s64)0, (s64)max_allocatable_power);
+
+   trace_thermal_power_allocator_pid(tz, frac_to_int(err),
+ frac_to_int(params->err_integral),
+ frac_to_int(p), frac_to_int(i),
+ frac_to_int(d), power_range);
+
+   return power_range;
 }
 
 /**
@@ -216,7 +226,7 @@ static int allocate_power(struct thermal_zone_device *tz,
struct power_allocator_params *params = tz->governor_data;
u32 *req_power, *max_power, *granted_power;
u32 total_req_power, max_allocatable_power;
-   u32 power_range;
+   u32 total_granted_power, power_range;
int i, num_actors, total_weight, ret = 0;
int trip_max_desired_temperature = params->trip_max_desired_temperature;
 
@@ -290,6 +300,7 @@ static int allocate_power(struct thermal_zone_device *tz,
divvy_up_power(req_power, max_power, num_actors, total_req_power,
   power_range, granted_power);
 
+   total_granted_power = 0;
i = 0;
list_for_each_entry(instance, >thermal_instances, tz_node) {
if (instance->trip != trip_max_desired_temperature)
@@ -300,10 +311,17 @@ static int allocate_power(struct thermal_zone_device *tz,
 

Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 17:18:25 -0400
Eduardo Valentin edubez...@gmail.com wrote:

 Steve,
 
 On Thu, Feb 26, 2015 at 05:52:59PM -0500, Steven Rostedt wrote:
  On Thu, 26 Feb 2015 15:46:34 -0400
  Eduardo Valentin edubez...@gmail.com wrote:
  
   
   I am planing to apply this series to my thermal soc tree. Do you have
   any concerns if I send this patch, which touches the tracing files, via
   my tree?
   
  
  Which tracing files?
 
 I am referring to:
 include/trace/events/thermal.h | 58 +
 include/trace/events/thermal_power_allocator.h | 87
 ++
 
 I know they are new files anyway, but just checking if those can go
 altogether via the thermal tree.

The individual files in include/trace/events belong more to the
maintainers of where the tracepoints are located. I just monitor them
to make sure they are not too whacky ;-)

Feel free to incorporate them in your tree.

If you want...

Acked-by: Steven Rostedt rost...@goodmis.org

-- Steve
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Javi Merino
Add trace events for the power allocator governor and the power actor
interface of the cpu cooling device.

Cc: Zhang Rui rui.zh...@intel.com
Cc: Eduardo Valentin edubez...@gmail.com
Cc: Steven Rostedt rost...@goodmis.org
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@redhat.com
Signed-off-by: Javi Merino javi.mer...@arm.com
---
 drivers/thermal/cpu_cooling.c  | 31 -
 drivers/thermal/power_allocator.c  | 22 ++-
 include/trace/events/thermal.h | 58 +
 include/trace/events/thermal_power_allocator.h | 87 ++
 4 files changed, 194 insertions(+), 4 deletions(-)
 create mode 100644 include/trace/events/thermal_power_allocator.h

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index ba23150c7bde..c4974144c787 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -31,6 +31,8 @@
 #include linux/cpu.h
 #include linux/cpu_cooling.h
 
+#include trace/events/thermal.h
+
 /*
  * Cooling state - CPUFreq frequency
  *
@@ -588,12 +590,20 @@ static int cpufreq_get_requested_power(struct 
thermal_cooling_device *cdev,
   u32 *power)
 {
unsigned long freq;
-   int cpu, ret;
+   int i = 0, cpu, ret;
u32 static_power, dynamic_power, total_load = 0;
struct cpufreq_cooling_device *cpufreq_device = cdev-devdata;
+   u32 *load_cpu = NULL;
 
freq = cpufreq_quick_get(cpumask_any(cpufreq_device-allowed_cpus));
 
+   if (trace_thermal_power_cpu_get_power_enabled()) {
+   u32 ncpus = cpumask_weight(cpufreq_device-allowed_cpus);
+
+   load_cpu = devm_kcalloc(cdev-device, ncpus, sizeof(*load_cpu),
+   GFP_KERNEL);
+   }
+
for_each_cpu(cpu, cpufreq_device-allowed_cpus) {
u32 load;
 
@@ -603,14 +613,29 @@ static int cpufreq_get_requested_power(struct 
thermal_cooling_device *cdev,
load = 0;
 
total_load += load;
+   if (trace_thermal_power_cpu_limit_enabled()  load_cpu)
+   load_cpu[i] = load;
+
+   i++;
}
 
cpufreq_device-last_load = total_load;
 
dynamic_power = get_dynamic_power(cpufreq_device, freq);
ret = get_static_power(cpufreq_device, tz, freq, static_power);
-   if (ret)
+   if (ret) {
+   if (load_cpu)
+   devm_kfree(cdev-device, load_cpu);
return ret;
+   }
+
+   if (load_cpu) {
+   trace_thermal_power_cpu_get_power(
+   cpufreq_device-allowed_cpus,
+   freq, load_cpu, i, dynamic_power, static_power);
+
+   devm_kfree(cdev-device, load_cpu);
+   }
 
*power = static_power + dynamic_power;
return 0;
@@ -718,6 +743,8 @@ static int cpufreq_power2state(struct 
thermal_cooling_device *cdev,
return -EINVAL;
}
 
+   trace_thermal_power_cpu_limit(cpufreq_device-allowed_cpus,
+ target_freq, *state, power);
return 0;
 }
 
diff --git a/drivers/thermal/power_allocator.c 
b/drivers/thermal/power_allocator.c
index bfea8d35c0a2..9b32ccb9ea82 100644
--- a/drivers/thermal/power_allocator.c
+++ b/drivers/thermal/power_allocator.c
@@ -19,6 +19,9 @@
 #include linux/slab.h
 #include linux/thermal.h
 
+#define CREATE_TRACE_POINTS
+#include trace/events/thermal_power_allocator.h
+
 #include thermal_core.h
 
 #define FRAC_BITS 10
@@ -138,7 +141,14 @@ static u32 pid_controller(struct thermal_zone_device *tz,
/* feed-forward the known sustainable dissipatable power */
power_range = tz-tzp-sustainable_power + frac_to_int(power_range);
 
-   return clamp(power_range, (s64)0, (s64)max_allocatable_power);
+   power_range = clamp(power_range, (s64)0, (s64)max_allocatable_power);
+
+   trace_thermal_power_allocator_pid(tz, frac_to_int(err),
+ frac_to_int(params-err_integral),
+ frac_to_int(p), frac_to_int(i),
+ frac_to_int(d), power_range);
+
+   return power_range;
 }
 
 /**
@@ -216,7 +226,7 @@ static int allocate_power(struct thermal_zone_device *tz,
struct power_allocator_params *params = tz-governor_data;
u32 *req_power, *max_power, *granted_power;
u32 total_req_power, max_allocatable_power;
-   u32 power_range;
+   u32 total_granted_power, power_range;
int i, num_actors, total_weight, ret = 0;
int trip_max_desired_temperature = params-trip_max_desired_temperature;
 
@@ -290,6 +300,7 @@ static int allocate_power(struct thermal_zone_device *tz,
divvy_up_power(req_power, max_power, num_actors, total_req_power,
   power_range, granted_power);
 
+   total_granted_power = 

Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 19:00:31 +
Javi Merino javi.mer...@arm.com wrote:

 Add trace events for the power allocator governor and the power actor
 interface of the cpu cooling device.

For the tracing parts...

Acked-by: Steven Rostedt rost...@goodmis.org

-- Steve

 
 Cc: Zhang Rui rui.zh...@intel.com
 Cc: Eduardo Valentin edubez...@gmail.com
 Cc: Steven Rostedt rost...@goodmis.org
 Cc: Frederic Weisbecker fweis...@gmail.com
 Cc: Ingo Molnar mi...@redhat.com
 Signed-off-by: Javi Merino javi.mer...@arm.com
 ---
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Eduardo Valentin
On Thu, Feb 26, 2015 at 02:38:45PM -0500, Steven Rostedt wrote:
 On Thu, 26 Feb 2015 19:00:31 +
 Javi Merino javi.mer...@arm.com wrote:
 
  Add trace events for the power allocator governor and the power actor
  interface of the cpu cooling device.
 
 For the tracing parts...
 
 Acked-by: Steven Rostedt rost...@goodmis.org

Thanks Steve.

I am planing to apply this series to my thermal soc tree. Do you have
any concerns if I send this patch, which touches the tracing files, via
my tree?

BR,


Eduardo Valentin

 
 -- Steve
 
  
  Cc: Zhang Rui rui.zh...@intel.com
  Cc: Eduardo Valentin edubez...@gmail.com
  Cc: Steven Rostedt rost...@goodmis.org
  Cc: Frederic Weisbecker fweis...@gmail.com
  Cc: Ingo Molnar mi...@redhat.com
  Signed-off-by: Javi Merino javi.mer...@arm.com
  ---


signature.asc
Description: Digital signature


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 15:46:34 -0400
Eduardo Valentin edubez...@gmail.com wrote:

 
 I am planing to apply this series to my thermal soc tree. Do you have
 any concerns if I send this patch, which touches the tracing files, via
 my tree?
 

Which tracing files?

-- Steve
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 5/7] thermal: add trace events to the power allocator governor

2015-02-26 Thread Eduardo Valentin
Steve,

On Thu, Feb 26, 2015 at 05:52:59PM -0500, Steven Rostedt wrote:
 On Thu, 26 Feb 2015 15:46:34 -0400
 Eduardo Valentin edubez...@gmail.com wrote:
 
  
  I am planing to apply this series to my thermal soc tree. Do you have
  any concerns if I send this patch, which touches the tracing files, via
  my tree?
  
 
 Which tracing files?

I am referring to:
include/trace/events/thermal.h | 58 +
include/trace/events/thermal_power_allocator.h | 87
++

I know they are new files anyway, but just checking if those can go
altogether via the thermal tree.

BR,

Eduardo Valentin

 
 -- Steve


signature.asc
Description: Digital signature