Skip to contentSkip to conversation

perf: add OMAP support for the new power events

PATCH In review [email protected] 4 participants 10 messages Jan 24, 2011 – Feb 18, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: add OMAP support for the new power events

From: Jean Pihet <[email protected]>

The patch adds the new power management trace points for the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- SoC clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS

---
 arch/arm/mach-omap2/clock.c       |    8 +++++++-
 arch/arm/mach-omap2/pm34xx.c      |    7 +++++++
 arch/arm/mach-omap2/powerdomain.c |    8 +++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock.c +7 -1
index 2a2f152..72af75d 100644
@@ -22,7 +22,9 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/bitops.h>
+#include <trace/events/power.h>
 
+#include <asm/cpu.h>
 #include <plat/clock.h>
 #include "clockdomain.h"
 #include <plat/cpu.h>
@@ -261,6 +263,7 @@ void omap2_clk_disable(struct clk *clk)
 
 	pr_debug("clock: %s: disabling in hardware\n", clk->name);
 
+	trace_clock_disable(clk->name, 0, smp_processor_id());
 	clk->ops->disable(clk);
 
 	if (clk->clkdm)
@@ -312,6 +315,7 @@ int omap2_clk_enable(struct clk *clk)
 		}
 	}
 
+	trace_clock_enable(clk->name, 1, smp_processor_id());
 	ret = clk->ops->enable(clk);
 	if (ret) {
 		WARN(1, "clock: %s: could not enable: %d\n", clk->name, ret);
@@ -349,8 +353,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
 	pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
 
 	/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */
-	if (clk->set_rate)
+	if (clk->set_rate) {
+		trace_clock_set_rate(clk->name, rate, smp_processor_id());
 		ret = clk->set_rate(clk, rate);
+	}
 
 	return ret;
 }
arch/arm/mach-omap2/pm34xx.c +7 -0
index 8cbbead..7c5e0ee 100644
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/console.h>
+#include <trace/events/power.h>
 
 #include <plat/sram.h>
 #include "clockdomain.h"
@@ -518,8 +519,14 @@ static void omap3_pm_idle(void)
 	if (omap_irq_pending() || need_resched())
 		goto out;
 
+	trace_power_start(POWER_CSTATE, 1, smp_processor_id());
+	trace_cpu_idle(1, smp_processor_id());
+
 	omap_sram_idle();
 
+	trace_power_end(smp_processor_id());
+	trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+
 out:
 	local_fiq_enable();
 	local_irq_enable();
arch/arm/mach-omap2/powerdomain.c +7 -1
index eaed0df..e1feb50 100644
@@ -19,12 +19,15 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <trace/events/power.h>
+
 #include "cm2xxx_3xxx.h"
 #include "prcm44xx.h"
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 
+#include <asm/cpu.h>
 #include <plat/cpu.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
@@ -406,8 +409,11 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 	pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
 		 pwrdm->name, pwrst);
 
-	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
+		trace_power_domain_target(pwrdm->name, pwrst,
+					  smp_processor_id());
 		ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
+	}
 
 	return ret;
 }
Signature · 1 line
1.7.2.3
#1 lore raw

Jean

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of [email protected]
Sent: Monday, January 24, 2011 7:51 PM
To: Thomas Renninger; [email protected]
Cc: Jean Pihet
Subject: [PATCH] perf: add OMAP support for the new power events

From: Jean Pihet <[email protected]>

The patch adds the new power management trace points for the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- SoC clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS

[....]

Quoted 34 lines
arch/arm/mach- renamed from arch/arm/mach-omap2/powerdomain.c +0 -0

omap2/powerdomain.c
index eaed0df..e1feb50 100644

arch/arm/mach-omap2/powerdomain.c +7 -1
@@ -19,12 +19,15 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <trace/events/power.h>
+
 #include "cm2xxx_3xxx.h"
 #include "prcm44xx.h"
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 
+#include <asm/cpu.h>
 #include <plat/cpu.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
@@ -406,8 +409,11 @@ int pwrdm_set_next_pwrst(struct powerdomain
 *pwrdm, u8 pwrst)
 	pr_debug("powerdomain: setting next powerstate for %s to
 %0x\n",
 		 pwrdm->name, pwrst);
 
-	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
+		trace_power_domain_target(pwrdm->name, pwrst,
+					  smp_processor_id());
 		ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
+	}
 
Quoted 2 lines

return ret;
}

We need to track the actual power domain transitions as well at hardware level.
Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

Regards,
Santosh

author
#2 lore raw
Quoted 61 lines · Santosh Shilimkar

Jean

Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of [email protected]
Sent: Monday, January 24, 2011 7:51 PM
To: Thomas Renninger; [email protected]
Cc: Jean Pihet
Subject: [PATCH] perf: add OMAP support for the new power events

From: Jean Pihet <[email protected]>

The patch adds the new power management trace points for the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- SoC clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS

[....]

Quoted 34 lines
arch/arm/mach- renamed from arch/arm/mach-omap2/powerdomain.c +0 -0

omap2/powerdomain.c
index eaed0df..e1feb50 100644

arch/arm/mach-omap2/powerdomain.c +3 -0
@@ -19,12 +19,15 @@
  #include <linux/list.h>
  #include <linux/errno.h>
  #include <linux/string.h>
+#include <trace/events/power.h>
+
  #include "cm2xxx_3xxx.h"
  #include "prcm44xx.h"
  #include "cm44xx.h"
  #include "prm2xxx_3xxx.h"
  #include "prm44xx.h"
 
+#include <asm/cpu.h>
  #include <plat/cpu.h>
  #include "powerdomain.h"
  #include "clockdomain.h"
@@ -406,8 +409,11 @@ int pwrdm_set_next_pwrst(struct powerdomain
 *pwrdm, u8 pwrst)

      pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
               pwrdm->name, pwrst);

-     if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+     if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
+             trace_power_domain_target(pwrdm->name, pwrst,
+                                       smp_processor_id()); ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
+     }

Quoted 4 lines
Quoted 2 lines

      return ret;
 }

We need to track the actual power domain transitions as well at hardware level.

Agree

Quoted 4 lines

Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

The current API only has 'trace_power_domain_target' which tracks the desired target state.
I think we need an extra tracer 'trace_power_domain_hitstate' so that the trace parser can compare the desired ('target') and actually hit ('hitstate') states.

Thanks,
Jean

Quoted 4 lines

Regards,
Santosh

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 7 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Wednesday, January 26, 2011 3:20 PM
To: Santosh Shilimkar
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power events

[...]

Quoted 8 lines
Quoted 2 lines

We need to track the actual power domain transitions as well at hardware level.

Agree

Quoted 4 lines

Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

Quoted 8 lines

The current API only has 'trace_power_domain_target' which tracks the
desired target state.
I think we need an extra tracer 'trace_power_domain_hitstate' so that
the trace parser can compare the desired ('target') and actually hit ('hitstate') states.

We use next state and previous state. 'hitstate' doesn't sound well that's really secondary.

Do you plan to add that additional trace then ?

Regards,
Santosh

author
#4 lore raw

Hi Santosh, Tony,

Quoted 25 lines · Santosh Shilimkar
Quoted 7 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Wednesday, January 26, 2011 3:20 PM
To: Santosh Shilimkar
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power events

[...]

Quoted 8 lines
Quoted 2 lines

We need to track the actual power domain transitions as well at hardware level.

Agree

Quoted 4 lines

Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

Quoted 8 lines

The current API only has 'trace_power_domain_target' which tracks the
desired target state.
I think we need an extra tracer 'trace_power_domain_hitstate' so that
the trace parser can compare the desired ('target') and actually hit ('hitstate') states.

Quoted 4 lines

We use next state and previous state. 'hitstate' doesn't sound well that's really secondary.

Do you plan to add that additional trace then ?

Yes that is idea, although adding new events in the power trace API has been proved as quite difficult to get accepted. In any case this will be done separately (iow it is not part of this patch).

Also this patch also supports OMAP4 since the changes are in the generic PM frameworks. Thanks to the OMAP PM arch guys ;p

Is the patch OK? If so can it be queued in the l-o tree?

Quoted 4 lines

Regards,
Santosh

Regards,
Jean

#5 lore raw

Jean,

Quoted 42 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Monday, February 07, 2011 9:36 PM
To: Santosh Shilimkar; Tony Lindgren
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power events

Hi Santosh, Tony,

Quoted 6 lines · Santosh Shilimkar
Quoted 6 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Wednesday, January 26, 2011 3:20 PM
To: Santosh Shilimkar
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power

events

Quoted 11 lines
Quoted 1 line

[...]

Quoted 8 lines
Quoted 2 lines

We need to track the actual power domain transitions as well at hardware level.

Agree

Quoted 4 lines

Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

Quoted 6 lines
Quoted 6 lines

The current API only has 'trace_power_domain_target' which tracks the
desired target state.
I think we need an extra tracer 'trace_power_domain_hitstate' so that
the trace parser can compare the desired ('target') and actually

hit

Quoted 6 lines
Quoted 2 lines

('hitstate') states.

We use next state and previous state. 'hitstate' doesn't sound well that's really secondary.

Do you plan to add that additional trace then ?

Quoted 9 lines

Yes that is idea, although adding new events in the power trace API has been proved as quite difficult to get accepted. In any case this will be done separately (iow it is not part of this patch).

Also this patch also supports OMAP4 since the changes are in the generic PM frameworks. Thanks to the OMAP PM arch guys ;p

Is the patch OK? If so can it be queued in the l-o tree?

I just looked at from the current need of DEBUG counters and commented what needs to be supported.

Am ok with the patch, but that means we still need to keep using and supporting PM debug counters till we support the additional trace events.

May be Kevin/Paul can take a call on this.

Regards,
Santosh

#6 lore raw

Are there CPU sleep residency HW counters in OMAP? Was: Re: [PATCH] perf: add OMAP support for the new power events

Hi,

I use this thread as I expect people following it, is exactly the audience I am looking out for.

I am currently implementing a generic framework for CPU idle state accounting.

X86 CPUs can do quite some magic behind the OS and might enter deeper sleep states or might not enter them, even the OS requested (not) to do so.

Intel and AMD provide, depending on the CPU family, different HW counters to read out which state the HW really entered.

One can also use some counters which are not explicitly made for that. For example in X86 there is the mperf counter ticking at max frequency like TSC, but unlike the TSC it stops when entering any sleep state. This for example will also be one of the counters to account C0 vs Cx time the HW really resided in.

The stuff is intended for the cpupowerutils (new branch on the cpufrequtils tree) package. It should replace the turbostat tool which is doing this for some Intel x86 cpus only and recently got merged into the kernel:
linux-2.6/tools/power/x86/turbostat/

I still have to make sure to compile out X86 specific stuff (accessing MSRs, cpuid..) for other archs and with a next, cleaned up patch series the accounting statistics from /sys/devices/system/cpu/cpu*/cpuidle/* should work on other archs as well.

Anyway, if there are facilities to read out sleep state residency from HW for omap based cpus and you like to have a tool showing them, it would be great if someone likes to help with the implementation.

The framework will be there already, I would just need some help with a omap_monitor.c file filling up some callback functions and there could be one tool with the same format for all archs showing sleep states...

Thanks,

Thomas

Quoted 64 lines · Santosh Shilimkar

Jean,

Quoted 42 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Monday, February 07, 2011 9:36 PM
To: Santosh Shilimkar; Tony Lindgren
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power events

Hi Santosh, Tony,

Quoted 6 lines · Santosh Shilimkar
Quoted 6 lines

-----Original Message-----
From: Jean Pihet [mailto:[email protected]]
Sent: Wednesday, January 26, 2011 3:20 PM
To: Santosh Shilimkar
Cc: Thomas Renninger; [email protected]; Jean Pihet-XID
Subject: Re: [PATCH] perf: add OMAP support for the new power

events

Quoted 11 lines
Quoted 1 line

[...]

Quoted 8 lines
Quoted 2 lines

We need to track the actual power domain transitions as well at hardware level.

Agree

Quoted 4 lines

Can you please look at "pwrdm_pre_transition()" and "pwrdm_post_transition()"
This code keep track of it using the next power state and prev-power state.

Quoted 6 lines
Quoted 6 lines

The current API only has 'trace_power_domain_target' which tracks the
desired target state.
I think we need an extra tracer 'trace_power_domain_hitstate' so that
the trace parser can compare the desired ('target') and actually

hit

Quoted 6 lines
Quoted 2 lines

('hitstate') states.

We use next state and previous state. 'hitstate' doesn't sound well that's really secondary.

Do you plan to add that additional trace then ?

Quoted 9 lines

Yes that is idea, although adding new events in the power trace API has been proved as quite difficult to get accepted. In any case this will be done separately (iow it is not part of this patch).

Also this patch also supports OMAP4 since the changes are in the generic PM frameworks. Thanks to the OMAP PM arch guys ;p

Is the patch OK? If so can it be queued in the l-o tree?

I just looked at from the current need of DEBUG counters and commented what needs to be supported.

Am ok with the patch, but that means we still need to keep using and supporting PM debug counters till we support the additional trace events.

May be Kevin/Paul can take a call on this.

Regards,
Santosh

#7 lore raw

RE: Are there CPU sleep residency HW counters in OMAP? Was: Re: [PATCH] perf: add OMAP support for the new power events

(+ Kevin, Paul)

Quoted 20 lines

-----Original Message-----
From: Thomas Renninger [mailto:[email protected]]
Sent: Friday, February 11, 2011 8:09 PM
To: Santosh Shilimkar
Cc: Tony Lindgren; [email protected]; Jean Pihet-XID
Subject: Are there CPU sleep residency HW counters in OMAP? Was: Re:
[PATCH] perf: add OMAP support for the new power events

Hi,

I use this thread as I expect people following it, is exactly the audience I am looking out for.

I am currently implementing a generic framework for CPU idle state accounting.

X86 CPUs can do quite some magic behind the OS and might enter deeper sleep states or might not enter them, even the OS requested (not) to do so.

Quoted 9 lines

Intel and AMD provide, depending on the CPU family, different HW counters to read out which state the HW really entered.

One can also use some counters which are not explicitly made for that. For example in X86 there is the mperf counter ticking at max frequency like TSC, but unlike the TSC it stops when entering any sleep state. This for example will also be one of the counters to account C0 vs Cx time the HW really resided in.

I assume HW means CPU here. The current OMAP's doesn't have hardware counter registers to measure CPU residency time in deeper sleep states. Intrusive instrumentation using always running counter is possible buts no good. Hence Jean is trying to have common trace framework do some of these.

Quoted 18 lines

The stuff is intended for the cpupowerutils (new branch on the cpufrequtils tree) package. It should replace the turbostat tool which is doing this for some Intel x86 cpus only and recently got merged into the kernel:
linux-2.6/tools/power/x86/turbostat/

I still have to make sure to compile out X86 specific stuff (accessing MSRs, cpuid..) for other archs and with a next, cleaned up
patch series the accounting statistics from /sys/devices/system/cpu/cpu*/cpuidle/* should work on other archs as well.

Anyway, if there are facilities to read out sleep state residency from
HW for omap based cpus and you like to have a tool showing them, it would be great if someone likes to help with the implementation.

Quoted 7 lines

The framework will be there already, I would just need some help with
a omap_monitor.c file filling up some callback functions and there could
be one tool with the same format for all archs showing sleep states...

Various IPs in OMAP are grouped in different Powerdomains. The Powerdomain states targeted and reached can be read from the hardware registers and that's what we use more often. Currently some debug counters can show these stats.

For e.g
OMAP CPU supports below power domains.
1. CPU PD ON/INACTIVE
2. CPU PD RETENTION (2 levels)
3. CPU PD OFF.

C-states can attempt one of these states based available sleep time and up down latencies. Whether attempted target CPU PD states was reached or not can be read using hardware registers. But then we still can't read the exact CPU residency time in a particular sleep state.

Hope this gives some idea about what's supported by OMAP hardware for cpuidle residency measurements.

I let Kevin/Pual comment more in case I have missed some information.

Regards,
Santosh

#8 lore raw
In reply to [email protected]
Quoted 13 lines · [email protected] writes:

From: Jean Pihet <[email protected]>

The patch adds the new power management trace points for the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- SoC clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Quoted 3 lines

Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS

Looks good to me. Please post one more time with linux-arm-kernel in Cc. After that, unless there are objections, I'll queue for 2.6.39.

Kevin

Quoted 108 lines
---
 arch/arm/mach-omap2/clock.c       |    8 +++++++-
 arch/arm/mach-omap2/pm34xx.c      |    7 +++++++
 arch/arm/mach-omap2/powerdomain.c |    8 +++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock.c +7 -1
index 2a2f152..72af75d 100644
@@ -22,7 +22,9 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/bitops.h>
+#include <trace/events/power.h>
 
+#include <asm/cpu.h>
 #include <plat/clock.h>
 #include "clockdomain.h"
 #include <plat/cpu.h>
@@ -261,6 +263,7 @@ void omap2_clk_disable(struct clk *clk)
 
 	pr_debug("clock: %s: disabling in hardware\n", clk->name);
 
+	trace_clock_disable(clk->name, 0, smp_processor_id());
 	clk->ops->disable(clk);
 
 	if (clk->clkdm)
@@ -312,6 +315,7 @@ int omap2_clk_enable(struct clk *clk)
 		}
 	}
 
+	trace_clock_enable(clk->name, 1, smp_processor_id());
 	ret = clk->ops->enable(clk);
 	if (ret) {
 		WARN(1, "clock: %s: could not enable: %d\n", clk->name, ret);
@@ -349,8 +353,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
 	pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
 
 	/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */
-	if (clk->set_rate)
+	if (clk->set_rate) {
+		trace_clock_set_rate(clk->name, rate, smp_processor_id());
 		ret = clk->set_rate(clk, rate);
+	}
 
 	return ret;
 }
arch/arm/mach-omap2/pm34xx.c +7 -0
index 8cbbead..7c5e0ee 100644
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/console.h>
+#include <trace/events/power.h>
 
 #include <plat/sram.h>
 #include "clockdomain.h"
@@ -518,8 +519,14 @@ static void omap3_pm_idle(void)
 	if (omap_irq_pending() || need_resched())
 		goto out;
 
+	trace_power_start(POWER_CSTATE, 1, smp_processor_id());
+	trace_cpu_idle(1, smp_processor_id());
+
 	omap_sram_idle();
 
+	trace_power_end(smp_processor_id());
+	trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+
 out:
 	local_fiq_enable();
 	local_irq_enable();
arch/arm/mach-omap2/powerdomain.c +7 -1
index eaed0df..e1feb50 100644
@@ -19,12 +19,15 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <trace/events/power.h>
+
 #include "cm2xxx_3xxx.h"
 #include "prcm44xx.h"
 #include "cm44xx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 
+#include <asm/cpu.h>
 #include <plat/cpu.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
@@ -406,8 +409,11 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
 	pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
 		 pwrdm->name, pwrst);
 
-	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+	if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
+		trace_power_domain_target(pwrdm->name, pwrst,
+					  smp_processor_id());
 		ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
+	}
 
 	return ret;
 }
author
#9 lore raw
Quoted 15 lines · Kevin Hilman
Quoted 13 lines · [email protected] writes:

From: Jean Pihet <[email protected]>

The patch adds the new power management trace points for the OMAP architecture.

The trace points are for:
- default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler;
- cpufreq (DVFS),
- SoC clocks changes (enable, disable, set_rate),
- change of power domains next power states.

Quoted 6 lines
Quoted 3 lines

Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS

Looks good to me.  Please post one more time with linux-arm-kernel in Cc. After that, unless there are objections, I'll queue for 2.6.39.

Ok thanks for reviewing the patch.
I sent the updated patch. The change is an extra trace point in the case a power domain did not hit the desired target state. This allows the parsing/GUI tools to trace the desired and actually hit states.

Regards,
Jean

Quoted 109 lines

Kevin

Quoted 106 lines

---
 arch/arm/mach-omap2/clock.c       |    8 +++++++- arch/arm/mach-omap2/pm34xx.c      |    7 +++++++ arch/arm/mach-omap2/powerdomain.c |    8 +++++++-

 3 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock.c +7 -1
index 2a2f152..72af75d 100644
@@ -22,7 +22,9 @@
  #include <linux/clk.h>
  #include <linux/io.h>
  #include <linux/bitops.h>
+#include <trace/events/power.h>
 
+#include <asm/cpu.h>
  #include <plat/clock.h>
  #include "clockdomain.h"
  #include <plat/cpu.h>
@@ -261,6 +263,7 @@ void omap2_clk_disable(struct clk *clk)
 
       pr_debug("clock: %s: disabling in hardware\n", clk->name);
 
+     trace_clock_disable(clk->name, 0, smp_processor_id());
       clk->ops->disable(clk);
 
       if (clk->clkdm)
@@ -312,6 +315,7 @@ int omap2_clk_enable(struct clk *clk)
               }
       }
 
+     trace_clock_enable(clk->name, 1, smp_processor_id());
       ret = clk->ops->enable(clk);
       if (ret) {
               WARN(1, "clock: %s: could not enable: %d\n", clk->name, ret);
@@ -349,8 +353,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
       pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
 
       /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */
-     if (clk->set_rate)
+     if (clk->set_rate) {
+             trace_clock_set_rate(clk->name, rate, smp_processor_id());
               ret = clk->set_rate(clk, rate);
+     }
 
       return ret;
  }
arch/arm/mach-omap2/pm34xx.c +7 -0
index 8cbbead..7c5e0ee 100644
@@ -29,6 +29,7 @@
  #include <linux/delay.h>
  #include <linux/slab.h>
  #include <linux/console.h>
+#include <trace/events/power.h>
 
  #include <plat/sram.h>
  #include "clockdomain.h"
@@ -518,8 +519,14 @@ static void omap3_pm_idle(void)
       if (omap_irq_pending() || need_resched())
               goto out;
 
+     trace_power_start(POWER_CSTATE, 1, smp_processor_id());
+     trace_cpu_idle(1, smp_processor_id());
+
       omap_sram_idle();
 
+     trace_power_end(smp_processor_id());
+     trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+

 out:
      local_fiq_enable();
      local_irq_enable();

arch/arm/mach-omap2/powerdomain.c +7 -1
index eaed0df..e1feb50 100644
@@ -19,12 +19,15 @@
  #include <linux/list.h>
  #include <linux/errno.h>
  #include <linux/string.h>
+#include <trace/events/power.h>
+
  #include "cm2xxx_3xxx.h"
  #include "prcm44xx.h"
  #include "cm44xx.h"
  #include "prm2xxx_3xxx.h"
  #include "prm44xx.h"
 
+#include <asm/cpu.h>
  #include <plat/cpu.h>
  #include "powerdomain.h"
  #include "clockdomain.h"
@@ -406,8 +409,11 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
       pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
                pwrdm->name, pwrst);
 
-     if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst)
+     if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
+             trace_power_domain_target(pwrdm->name, pwrst,
+                                       smp_processor_id());
               ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
+     }
 
Quoted 3 lines

arch/arm/mach-omap2/powerdomain.c int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) · line 419

Quoted 2 lines
arch/arm/mach-omap2/powerdomain.c +0 -0
       return ret;
  }

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html