Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2011-01-21 02:42:39 +0100
committerThomas Renninger <trenn@suse.de>2011-01-21 02:42:39 +0100
commitb308effffda915e6e725d13140eb960ef485ba39 (patch)
tree0846a6fae158dd4af7698bf4cf6c82055484bcac
parentde347ac23d8c73e4c1f0bca0f5441a710af672aa (diff)
- perf: Do not export power_frequency, but power_start event
(bnc#665153). - cpuidle/x86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer (bnc#665153). - perf: Clean up power events by introducing new, more generic ones (bnc#665153). - cpuidle: Rename X86 specific idle poll state from C0 to POLL (bnc#665153). - perf timechart: Adjust perf timechart to the new power events (bnc#665153). - Fix display of idle boxes (none). - Fix huge and wronge C-state drawings due to uninitialized start/end timestamps (none). - Update config files. - doc/config-options.changes: CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
-rw-r--r--config/i386/debug1
-rw-r--r--config/i386/default1
-rw-r--r--config/i386/desktop1
-rw-r--r--config/i386/ec21
-rw-r--r--config/i386/pae1
-rw-r--r--config/i386/trace1
-rw-r--r--config/i386/vmi1
-rw-r--r--config/i386/xen1
-rw-r--r--config/ppc/default1
-rw-r--r--config/ppc/ppc641
-rw-r--r--config/ppc/ps31
-rw-r--r--config/ppc64/debug1
-rw-r--r--config/ppc64/default1
-rw-r--r--config/ppc64/ppc641
-rw-r--r--config/ppc64/trace1
-rw-r--r--config/s390/s3901
-rw-r--r--config/s390/trace1
-rw-r--r--config/s390x/default1
-rw-r--r--config/s390x/trace1
-rw-r--r--config/sparc64/default2
-rw-r--r--config/sparc64/net1
-rw-r--r--config/x86_64/debug1
-rw-r--r--config/x86_64/default1
-rw-r--r--config/x86_64/desktop1
-rw-r--r--config/x86_64/ec21
-rw-r--r--config/x86_64/trace1
-rw-r--r--config/x86_64/xen1
-rw-r--r--doc/config-options.changes8
-rw-r--r--patches.arch/cpuidle_event_fix_export.patch49
-rw-r--r--patches.arch/cpuidle_fix_double_events.patch185
-rw-r--r--patches.arch/cpuidle_introduce_cpuidle_events.patch321
-rw-r--r--patches.arch/cpuidle_rename_c0_to_poll_state.patch31
-rw-r--r--patches.arch/perf_adjust_timechart_to_new_cpuidle_events.patch255
-rw-r--r--patches.arch/perf_timechart_fix_idle_boxes.patch31
-rw-r--r--patches.arch/perf_timechart_fix_zero_timestamps.patch32
-rw-r--r--series.conf10
36 files changed, 946 insertions, 4 deletions
diff --git a/config/i386/debug b/config/i386/debug
index 325881078f..15f97fe3a3 100644
--- a/config/i386/debug
+++ b/config/i386/debug
@@ -5437,6 +5437,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/default b/config/i386/default
index ee33950250..c9c9e72106 100644
--- a/config/i386/default
+++ b/config/i386/default
@@ -5399,6 +5399,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/desktop b/config/i386/desktop
index 8a31d51dd3..9c42629678 100644
--- a/config/i386/desktop
+++ b/config/i386/desktop
@@ -5268,6 +5268,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/ec2 b/config/i386/ec2
index a6596833bc..b1944a5205 100644
--- a/config/i386/ec2
+++ b/config/i386/ec2
@@ -1649,6 +1649,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
diff --git a/config/i386/pae b/config/i386/pae
index 815b9d0d34..5c126e4402 100644
--- a/config/i386/pae
+++ b/config/i386/pae
@@ -5274,6 +5274,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/trace b/config/i386/trace
index 60e1ba05a1..39fa735813 100644
--- a/config/i386/trace
+++ b/config/i386/trace
@@ -5278,6 +5278,7 @@ CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_FTRACE_NMI_ENTER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/vmi b/config/i386/vmi
index de46059259..78a1e560fa 100644
--- a/config/i386/vmi
+++ b/config/i386/vmi
@@ -5274,6 +5274,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/i386/xen b/config/i386/xen
index 0a8c713fea..ab844cbc7e 100644
--- a/config/i386/xen
+++ b/config/i386/xen
@@ -5148,6 +5148,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc/default b/config/ppc/default
index 0bd2a8c53a..9b94531d26 100644
--- a/config/ppc/default
+++ b/config/ppc/default
@@ -4309,6 +4309,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc/ppc64 b/config/ppc/ppc64
index 44affa4f42..02f9715f41 100644
--- a/config/ppc/ppc64
+++ b/config/ppc/ppc64
@@ -4280,6 +4280,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc/ps3 b/config/ppc/ps3
index 78fb57db0f..b2cfed05fc 100644
--- a/config/ppc/ps3
+++ b/config/ppc/ps3
@@ -1399,6 +1399,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
diff --git a/config/ppc64/debug b/config/ppc64/debug
index 9e4cf5afb0..a721dcd3c5 100644
--- a/config/ppc64/debug
+++ b/config/ppc64/debug
@@ -4292,6 +4292,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc64/default b/config/ppc64/default
index 303caa8d6a..2f788c020c 100644
--- a/config/ppc64/default
+++ b/config/ppc64/default
@@ -4278,6 +4278,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc64/ppc64 b/config/ppc64/ppc64
index 49b63ada04..cf2b92b5bc 100644
--- a/config/ppc64/ppc64
+++ b/config/ppc64/ppc64
@@ -4344,6 +4344,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/ppc64/trace b/config/ppc64/trace
index 693018a607..e776d61317 100644
--- a/config/ppc64/trace
+++ b/config/ppc64/trace
@@ -4347,6 +4347,7 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/s390/s390 b/config/s390/s390
index e9a36bd02b..4087df2f1e 100644
--- a/config/s390/s390
+++ b/config/s390/s390
@@ -1446,6 +1446,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/s390/trace b/config/s390/trace
index 5864ba519a..ef71228390 100644
--- a/config/s390/trace
+++ b/config/s390/trace
@@ -1448,6 +1448,7 @@ CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/s390x/default b/config/s390x/default
index 89439722ec..d8f1b4bc02 100644
--- a/config/s390x/default
+++ b/config/s390x/default
@@ -1467,6 +1467,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/s390x/trace b/config/s390x/trace
index c9e4fdd7a8..49537283ec 100644
--- a/config/s390x/trace
+++ b/config/s390x/trace
@@ -1469,6 +1469,7 @@ CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/sparc64/default b/config/sparc64/default
index 6909413a7d..4ac593ca0d 100644
--- a/config/sparc64/default
+++ b/config/sparc64/default
@@ -1,7 +1,6 @@
#
# Automatically generated make config: don't edit
# Linux/sparc64 2.6.37 Kernel Configuration
-# Sat Jan 8 17:11:38 2011
#
CONFIG_64BIT=y
CONFIG_SPARC=y
@@ -4598,6 +4597,7 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/sparc64/net b/config/sparc64/net
index 081a7acb5a..6822f4dfa1 100644
--- a/config/sparc64/net
+++ b/config/sparc64/net
@@ -1,7 +1,6 @@
#
# Automatically generated make config: don't edit
# Linux/sparc64 2.6.37 Kernel Configuration
-# Sat Jan 8 15:11:23 2011
#
CONFIG_64BIT=y
CONFIG_SPARC=y
diff --git a/config/x86_64/debug b/config/x86_64/debug
index a2401493ef..fe20b08abd 100644
--- a/config/x86_64/debug
+++ b/config/x86_64/debug
@@ -5179,6 +5179,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/x86_64/default b/config/x86_64/default
index adc176c170..d3a57d04e5 100644
--- a/config/x86_64/default
+++ b/config/x86_64/default
@@ -5181,6 +5181,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/x86_64/desktop b/config/x86_64/desktop
index da74a47710..594669d9f4 100644
--- a/config/x86_64/desktop
+++ b/config/x86_64/desktop
@@ -5175,6 +5175,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/x86_64/ec2 b/config/x86_64/ec2
index a27933bb29..2db7c7c277 100644
--- a/config/x86_64/ec2
+++ b/config/x86_64/ec2
@@ -1614,6 +1614,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
diff --git a/config/x86_64/trace b/config/x86_64/trace
index 24ed365b78..a7678803be 100644
--- a/config/x86_64/trace
+++ b/config/x86_64/trace
@@ -5185,6 +5185,7 @@ CONFIG_TRACER_MAX_TRACE=y
CONFIG_RING_BUFFER=y
CONFIG_FTRACE_NMI_ENTER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/config/x86_64/xen b/config/x86_64/xen
index e686b5ee83..3acc0f5f4c 100644
--- a/config/x86_64/xen
+++ b/config/x86_64/xen
@@ -5072,6 +5072,7 @@ CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_RING_BUFFER_ALLOW_SWAP=y
CONFIG_TRACING=y
diff --git a/doc/config-options.changes b/doc/config-options.changes
index 635d70c239..d3d08619e9 100644
--- a/doc/config-options.changes
+++ b/doc/config-options.changes
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Fri Jan 21 02:35:17 CET 2011 - trenn@suse.de
+
+- CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+ power:power_start/end tracing events got replace by power:cpu_idle
+ Let's still throw the old ones as well for a while to stay
+ compatible with current userspace tools.
+
+-------------------------------------------------------------------
Mon Jan 10 15:31:41 CET 2011 - jeffm@suse.de
- Enabled AGP modules to build as part of the static i386 kernel:
diff --git a/patches.arch/cpuidle_event_fix_export.patch b/patches.arch/cpuidle_event_fix_export.patch
new file mode 100644
index 0000000000..24e6905d47
--- /dev/null
+++ b/patches.arch/cpuidle_event_fix_export.patch
@@ -0,0 +1,49 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: perf: Do not export power_frequency, but power_start event
+References: bnc#665153
+Patch-Mainline: yes
+Git-commit: 61a0d49c33c7fd57c14895e5b0760bd02b65ac1f
+
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+power_frequency moved to drivers/cpufreq/cpufreq.c which has
+to be compiled in, no need to export it.
+
+intel_idle can a be module though...
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Acked-by: Jean Pihet <jean.pihet@newoldbits.com>
+Cc: Jean Pihet <j-pihet@ti.com>
+Cc: Arjan van de Ven <arjan@linux.intel.com>
+Cc: rjw@sisk.pl
+LKML-Reference: <1294073445-14812-2-git-send-email-trenn@suse.de>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+LKML-Reference: <1290072314-31155-2-git-send-email-trenn@suse.de>
+
+diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
+index c131d58..15783d5 100644
+--- a/drivers/idle/intel_idle.c
++++ b/drivers/idle/intel_idle.c
+@@ -220,9 +220,7 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state)
+ kt_before = ktime_get_real();
+
+ stop_critical_timings();
+-#ifndef MODULE
+ trace_power_start(POWER_CSTATE, (eax >> 4) + 1, cpu);
+-#endif
+ if (!need_resched()) {
+
+ __monitor((void *)&current_thread_info()->flags, 0, 0);
+diff --git a/kernel/trace/power-traces.c b/kernel/trace/power-traces.c
+index a22582a..0e0497d 100644
+--- a/kernel/trace/power-traces.c
++++ b/kernel/trace/power-traces.c
+@@ -13,5 +13,5 @@
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/power.h>
+
+-EXPORT_TRACEPOINT_SYMBOL_GPL(power_frequency);
++EXPORT_TRACEPOINT_SYMBOL_GPL(power_start);
+
diff --git a/patches.arch/cpuidle_fix_double_events.patch b/patches.arch/cpuidle_fix_double_events.patch
new file mode 100644
index 0000000000..fe967551be
--- /dev/null
+++ b/patches.arch/cpuidle_fix_double_events.patch
@@ -0,0 +1,185 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: cpuidle/x86/perf: fix power:cpu_idle double end events and throw cpu_idle events from the cpuidle layer
+References: bnc#665153
+Patch-Mainline: yes
+Git-commit: f77cfe4ea21760268c0277fa3e4b02dfd2a2c2f4
+
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+Currently intel_idle and acpi_idle driver show double cpu_idle "exit idle"
+events -> this patch fixes it and makes cpu_idle events throwing less complex.
+
+It also introduces cpu_idle events for all architectures which use
+the cpuidle subsystem, namely:
+ - arch/arm/mach-at91/cpuidle.c
+ - arch/arm/mach-davinci/cpuidle.c
+ - arch/arm/mach-kirkwood/cpuidle.c
+ - arch/arm/mach-omap2/cpuidle34xx.c
+ - arch/drivers/acpi/processor_idle.c (for all cases, not only mwait)
+ - arch/x86/kernel/process.c (did throw events before, but was a mess)
+ - drivers/idle/intel_idle.c (did throw events before)
+
+Convention should be:
+Fire cpu_idle events inside the current pm_idle function (not somewhere
+down the the callee tree) to keep things easy.
+
+Current possible pm_idle functions in X86:
+c1e_idle, poll_idle, cpuidle_idle_call, mwait_idle, default_idle
+-> this is really easy is now.
+
+This affects userspace:
+The type field of the cpu_idle power event can now direclty get
+mapped to:
+/sys/devices/system/cpu/cpuX/cpuidle/stateX/{name,desc,usage,time,...}
+instead of throwing very CPU/mwait specific values.
+This change is not visible for the intel_idle driver.
+For the acpi_idle driver it should only be visible if the vendor
+misses out C-states in his BIOS.
+Another (perf timechart) patch reads out cpuidle info of cpu_idle
+events from:
+/sys/.../cpuidle/stateX/*, then the cpuidle events are mapped
+to the correct C-/cpuidle state again, even if e.g. vendors miss
+out C-states in their BIOS and for example only export C1 and C3.
+-> everything is fine.
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+CC: Robert Schoene <robert.schoene@tu-dresden.de>
+CC: Jean Pihet <j-pihet@ti.com>
+CC: Arjan van de Ven <arjan@linux.intel.com>
+CC: Ingo Molnar <mingo@elte.hu>
+CC: Frederic Weisbecker <fweisbec@gmail.com>
+CC: linux-pm@lists.linux-foundation.org
+CC: linux-acpi@vger.kernel.org
+CC: linux-kernel@vger.kernel.org
+CC: linux-perf-users@vger.kernel.org
+CC: linux-omap@vger.kernel.org
+Signed-off-by: Len Brown <len.brown@intel.com>
+
+---
+ arch/x86/kernel/process.c | 6 ++++--
+ arch/x86/kernel/process_32.c | 4 ----
+ arch/x86/kernel/process_64.c | 6 ------
+ drivers/cpuidle/cpuidle.c | 10 ++++++++--
+ drivers/idle/intel_idle.c | 2 --
+ 5 files changed, 12 insertions(+), 16 deletions(-)
+
+Index: linux-2.6.37-master/arch/x86/kernel/process.c
+===================================================================
+--- linux-2.6.37-master.orig/arch/x86/kernel/process.c
++++ linux-2.6.37-master/arch/x86/kernel/process.c
+@@ -389,6 +389,8 @@ void default_idle(void)
+ else
+ local_irq_enable();
+ current_thread_info()->status |= TS_POLLING;
++ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ } else {
+ local_irq_enable();
+ /* loop is done by the caller */
+@@ -446,8 +448,6 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
+ */
+ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
+ {
+- trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
+- trace_cpu_idle((ax>>4)+1, smp_processor_id());
+ if (!need_resched()) {
+ if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
+ clflush((void *)&current_thread_info()->flags);
+@@ -474,6 +474,8 @@ static void mwait_idle(void)
+ __sti_mwait(0, 0);
+ else
+ local_irq_enable();
++ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ } else
+ local_irq_enable();
+ }
+Index: linux-2.6.37-master/arch/x86/kernel/process_32.c
+===================================================================
+--- linux-2.6.37-master.orig/arch/x86/kernel/process_32.c
++++ linux-2.6.37-master/arch/x86/kernel/process_32.c
+@@ -57,8 +57,6 @@
+ #include <asm/syscalls.h>
+ #include <asm/debugreg.h>
+
+-#include <trace/events/power.h>
+-
+ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
+
+ /*
+@@ -113,8 +111,6 @@ void cpu_idle(void)
+ stop_critical_timings();
+ pm_idle();
+ start_critical_timings();
+- trace_power_end(smp_processor_id());
+- trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ }
+ tick_nohz_restart_sched_tick();
+ preempt_enable_no_resched();
+Index: linux-2.6.37-master/arch/x86/kernel/process_64.c
+===================================================================
+--- linux-2.6.37-master.orig/arch/x86/kernel/process_64.c
++++ linux-2.6.37-master/arch/x86/kernel/process_64.c
+@@ -51,8 +51,6 @@
+ #include <asm/syscalls.h>
+ #include <asm/debugreg.h>
+
+-#include <trace/events/power.h>
+-
+ asmlinkage extern void ret_from_fork(void);
+
+ DEFINE_PER_CPU(unsigned long, old_rsp);
+@@ -141,10 +139,6 @@ void cpu_idle(void)
+ pm_idle();
+ start_critical_timings();
+
+- trace_power_end(smp_processor_id());
+- trace_cpu_idle(PWR_EVENT_EXIT,
+- smp_processor_id());
+-
+ /* In many cases the interrupt that ended idle
+ has already called exit_idle. But some idle
+ loops can be woken up without interrupt. */
+Index: linux-2.6.37-master/drivers/cpuidle/cpuidle.c
+===================================================================
+--- linux-2.6.37-master.orig/drivers/cpuidle/cpuidle.c
++++ linux-2.6.37-master/drivers/cpuidle/cpuidle.c
+@@ -96,7 +96,15 @@ static void cpuidle_idle_call(void)
+
+ /* enter the state and update stats */
+ dev->last_state = target_state;
++
++ trace_power_start(POWER_CSTATE, next_state, dev->cpu);
++ trace_cpu_idle(next_state, dev->cpu);
++
+ dev->last_residency = target_state->enter(dev, target_state);
++
++ trace_power_end(dev->cpu);
++ trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
++
+ if (dev->last_state)
+ target_state = dev->last_state;
+
+@@ -106,8 +114,6 @@ static void cpuidle_idle_call(void)
+ /* give the governor an opportunity to reflect on the outcome */
+ if (cpuidle_curr_governor->reflect)
+ cpuidle_curr_governor->reflect(dev);
+- trace_power_end(smp_processor_id());
+- trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ }
+
+ /**
+Index: linux-2.6.37-master/drivers/idle/intel_idle.c
+===================================================================
+--- linux-2.6.37-master.orig/drivers/idle/intel_idle.c
++++ linux-2.6.37-master/drivers/idle/intel_idle.c
+@@ -220,8 +220,6 @@ static int intel_idle(struct cpuidle_dev
+ kt_before = ktime_get_real();
+
+ stop_critical_timings();
+- trace_power_start(POWER_CSTATE, (eax >> 4) + 1, cpu);
+- trace_cpu_idle((eax >> 4) + 1, cpu);
+ if (!need_resched()) {
+
+ __monitor((void *)&current_thread_info()->flags, 0, 0);
diff --git a/patches.arch/cpuidle_introduce_cpuidle_events.patch b/patches.arch/cpuidle_introduce_cpuidle_events.patch
new file mode 100644
index 0000000000..db38954f71
--- /dev/null
+++ b/patches.arch/cpuidle_introduce_cpuidle_events.patch
@@ -0,0 +1,321 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: perf: Clean up power events by introducing new, more generic ones
+References: bnc#665153
+Patch-Mainline: yes
+Git-commit: 25e41933b58777f2d020c3b0186b430ea004ec28
+
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+Add these new power trace events:
+
+ power:cpu_idle
+ power:cpu_frequency
+ power:machine_suspend
+
+The old C-state/idle accounting events:
+ power:power_start
+ power:power_end
+
+Have now a replacement (but we are still keeping the old
+tracepoints for compatibility):
+
+ power:cpu_idle
+
+and
+ power:power_frequency
+
+is replaced with:
+ power:cpu_frequency
+
+power:machine_suspend is newly introduced.
+
+Jean Pihet has a patch integrated into the generic layer
+(kernel/power/suspend.c) which will make use of it.
+
+the type= field got removed from both, it was never
+used and the type is differed by the event type itself.
+
+perf timechart userspace tool gets adjusted in a separate patch.
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Acked-by: Arjan van de Ven <arjan@linux.intel.com>
+Acked-by: Jean Pihet <jean.pihet@newoldbits.com>
+Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: rjw@sisk.pl
+LKML-Reference: <1294073445-14812-3-git-send-email-trenn@suse.de>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+LKML-Reference: <1290072314-31155-2-git-send-email-trenn@suse.de>
+
+diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
+index 96ed1aa..c852041 100644
+--- a/arch/x86/kernel/process.c
++++ b/arch/x86/kernel/process.c
+@@ -373,6 +373,7 @@ void default_idle(void)
+ {
+ if (hlt_use_halt()) {
+ trace_power_start(POWER_CSTATE, 1, smp_processor_id());
++ trace_cpu_idle(1, smp_processor_id());
+ current_thread_info()->status &= ~TS_POLLING;
+ /*
+ * TS_POLLING-cleared state must be visible before we
+@@ -443,6 +444,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
+ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
+ {
+ trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
++ trace_cpu_idle((ax>>4)+1, smp_processor_id());
+ if (!need_resched()) {
+ if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
+ clflush((void *)&current_thread_info()->flags);
+@@ -459,6 +461,7 @@ static void mwait_idle(void)
+ {
+ if (!need_resched()) {
+ trace_power_start(POWER_CSTATE, 1, smp_processor_id());
++ trace_cpu_idle(1, smp_processor_id());
+ if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
+ clflush((void *)&current_thread_info()->flags);
+
+@@ -480,10 +483,12 @@ static void mwait_idle(void)
+ static void poll_idle(void)
+ {
+ trace_power_start(POWER_CSTATE, 0, smp_processor_id());
++ trace_cpu_idle(0, smp_processor_id());
+ local_irq_enable();
+ while (!need_resched())
+ cpu_relax();
+- trace_power_end(0);
++ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ }
+
+ /*
+diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
+index 96586c3..4b9befa 100644
+--- a/arch/x86/kernel/process_32.c
++++ b/arch/x86/kernel/process_32.c
+@@ -113,8 +113,8 @@ void cpu_idle(void)
+ stop_critical_timings();
+ pm_idle();
+ start_critical_timings();
+-
+ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ }
+ tick_nohz_restart_sched_tick();
+ preempt_enable_no_resched();
+diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
+index b3d7a3a..4c818a7 100644
+--- a/arch/x86/kernel/process_64.c
++++ b/arch/x86/kernel/process_64.c
+@@ -142,6 +142,8 @@ void cpu_idle(void)
+ start_critical_timings();
+
+ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT,
++ smp_processor_id());
+
+ /* In many cases the interrupt that ended idle
+ has already called exit_idle. But some idle
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
+index c63a438..1109f68 100644
+--- a/drivers/cpufreq/cpufreq.c
++++ b/drivers/cpufreq/cpufreq.c
+@@ -355,6 +355,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
+ dprintk("FREQ: %lu - CPU: %lu", (unsigned long)freqs->new,
+ (unsigned long)freqs->cpu);
+ trace_power_frequency(POWER_PSTATE, freqs->new, freqs->cpu);
++ trace_cpu_frequency(freqs->new, freqs->cpu);
+ srcu_notifier_call_chain(&cpufreq_transition_notifier_list,
+ CPUFREQ_POSTCHANGE, freqs);
+ if (likely(policy) && likely(policy->cpu == freqs->cpu))
+diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
+index a507108..08d5f05 100644
+--- a/drivers/cpuidle/cpuidle.c
++++ b/drivers/cpuidle/cpuidle.c
+@@ -107,6 +107,7 @@ static void cpuidle_idle_call(void)
+ if (cpuidle_curr_governor->reflect)
+ cpuidle_curr_governor->reflect(dev);
+ trace_power_end(smp_processor_id());
++ trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+ }
+
+ /**
+diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
+index 15783d5..56ac09d 100644
+--- a/drivers/idle/intel_idle.c
++++ b/drivers/idle/intel_idle.c
+@@ -221,6 +221,7 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state)
+
+ stop_critical_timings();
+ trace_power_start(POWER_CSTATE, (eax >> 4) + 1, cpu);
++ trace_cpu_idle((eax >> 4) + 1, cpu);
+ if (!need_resched()) {
+
+ __monitor((void *)&current_thread_info()->flags, 0, 0);
+diff --git a/include/trace/events/power.h b/include/trace/events/power.h
+index 286784d..1bcc2a8 100644
+--- a/include/trace/events/power.h
++++ b/include/trace/events/power.h
+@@ -7,16 +7,67 @@
+ #include <linux/ktime.h>
+ #include <linux/tracepoint.h>
+
+-#ifndef _TRACE_POWER_ENUM_
+-#define _TRACE_POWER_ENUM_
+-enum {
+- POWER_NONE = 0,
+- POWER_CSTATE = 1, /* C-State */
+- POWER_PSTATE = 2, /* Fequency change or DVFS */
+- POWER_SSTATE = 3, /* Suspend */
+-};
++DECLARE_EVENT_CLASS(cpu,
++
++ TP_PROTO(unsigned int state, unsigned int cpu_id),
++
++ TP_ARGS(state, cpu_id),
++
++ TP_STRUCT__entry(
++ __field( u32, state )
++ __field( u32, cpu_id )
++ ),
++
++ TP_fast_assign(
++ __entry->state = state;
++ __entry->cpu_id = cpu_id;
++ ),
++
++ TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
++ (unsigned long)__entry->cpu_id)
++);
++
++DEFINE_EVENT(cpu, cpu_idle,
++
++ TP_PROTO(unsigned int state, unsigned int cpu_id),
++
++ TP_ARGS(state, cpu_id)
++);
++
++/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
++#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
++#define _PWR_EVENT_AVOID_DOUBLE_DEFINING
++
++#define PWR_EVENT_EXIT -1
+ #endif
+
++DEFINE_EVENT(cpu, cpu_frequency,
++
++ TP_PROTO(unsigned int frequency, unsigned int cpu_id),
++
++ TP_ARGS(frequency, cpu_id)
++);
++
++TRACE_EVENT(machine_suspend,
++
++ TP_PROTO(unsigned int state),
++
++ TP_ARGS(state),
++
++ TP_STRUCT__entry(
++ __field( u32, state )
++ ),
++
++ TP_fast_assign(
++ __entry->state = state;
++ ),
++
++ TP_printk("state=%lu", (unsigned long)__entry->state)
++);
++
++/* This code will be removed after deprecation time exceeded (2.6.41) */
++#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
++
+ /*
+ * The power events are used for cpuidle & suspend (power_start, power_end)
+ * and for cpufreq (power_frequency)
+@@ -75,6 +126,36 @@ TRACE_EVENT(power_end,
+
+ );
+
++/* Deprecated dummy functions must be protected against multi-declartion */
++#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
++#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
++
++enum {
++ POWER_NONE = 0,
++ POWER_CSTATE = 1,
++ POWER_PSTATE = 2,
++};
++#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
++
++#else /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
++
++#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
++#define _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED
++enum {
++ POWER_NONE = 0,
++ POWER_CSTATE = 1,
++ POWER_PSTATE = 2,
++};
++
++/* These dummy declaration have to be ripped out when the deprecated
++ events get removed */
++static inline void trace_power_start(u64 type, u64 state, u64 cpuid) {};
++static inline void trace_power_end(u64 cpuid) {};
++static inline void trace_power_frequency(u64 type, u64 state, u64 cpuid) {};
++#endif /* _PWR_EVENT_AVOID_DOUBLE_DEFINING_DEPRECATED */
++
++#endif /* CONFIG_EVENT_POWER_TRACING_DEPRECATED */
++
+ /*
+ * The clock events are used for clock enable/disable and for
+ * clock rate change
+@@ -153,7 +234,6 @@ DEFINE_EVENT(power_domain, power_domain_target,
+
+ TP_ARGS(name, state, cpu_id)
+ );
+-
+ #endif /* _TRACE_POWER_H */
+
+ /* This part must be outside protection */
+diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
+index ea37e2f..14674dc 100644
+--- a/kernel/trace/Kconfig
++++ b/kernel/trace/Kconfig
+@@ -69,6 +69,21 @@ config EVENT_TRACING
+ select CONTEXT_SWITCH_TRACER
+ bool
+
++config EVENT_POWER_TRACING_DEPRECATED
++ depends on EVENT_TRACING
++ bool "Deprecated power event trace API, to be removed"
++ default y
++ help
++ Provides old power event types:
++ C-state/idle accounting events:
++ power:power_start
++ power:power_end
++ and old cpufreq accounting event:
++ power:power_frequency
++ This is for userspace compatibility
++ and will vanish after 5 kernel iterations,
++ namely 2.6.41.
++
+ config CONTEXT_SWITCH_TRACER
+ bool
+
+diff --git a/kernel/trace/power-traces.c b/kernel/trace/power-traces.c
+index 0e0497d..f55fcf6 100644
+--- a/kernel/trace/power-traces.c
++++ b/kernel/trace/power-traces.c
+@@ -13,5 +13,8 @@
+ #define CREATE_TRACE_POINTS
+ #include <trace/events/power.h>
+
++#ifdef EVENT_POWER_TRACING_DEPRECATED
+ EXPORT_TRACEPOINT_SYMBOL_GPL(power_start);
++#endif
++EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle);
+
diff --git a/patches.arch/cpuidle_rename_c0_to_poll_state.patch b/patches.arch/cpuidle_rename_c0_to_poll_state.patch
new file mode 100644
index 0000000000..f8a95c4ff4
--- /dev/null
+++ b/patches.arch/cpuidle_rename_c0_to_poll_state.patch
@@ -0,0 +1,31 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: cpuidle: Rename X86 specific idle poll state[0] from C0 to POLL
+References: bnc#665153
+Patch-Mainline: yes
+Git-commit: 720f1c3010db6a411358b962a2007969117840bc
+
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+C0 means and is well know as "not idle".
+All documentation out there uses this term as "running"/"not idle"
+state. Also Linux userspace tools (e.g. cpufreq-aperf and turbostat)
+show C0 residency which there is correct, but means something totally
+else than cpuidle "POLL" state.
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+Signed-off-by: Len Brown <len.brown@intel.com>
+
+diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
+index 97df791..37e4460 100644
+--- a/drivers/cpuidle/cpuidle.c
++++ b/drivers/cpuidle/cpuidle.c
+@@ -181,7 +181,7 @@ static void poll_idle_init(struct cpuidle_device *dev)
+
+ cpuidle_set_statedata(state, NULL);
+
+- snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
++ snprintf(state->name, CPUIDLE_NAME_LEN, "POLL");
+ snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE");
+ state->exit_latency = 0;
+ state->target_residency = 0;
diff --git a/patches.arch/perf_adjust_timechart_to_new_cpuidle_events.patch b/patches.arch/perf_adjust_timechart_to_new_cpuidle_events.patch
new file mode 100644
index 0000000000..4a238ae844
--- /dev/null
+++ b/patches.arch/perf_adjust_timechart_to_new_cpuidle_events.patch
@@ -0,0 +1,255 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: perf timechart: Adjust perf timechart to the new power events
+References: bnc#665153
+Patch-Mainline: yes
+Git-commit: 20c457b8587bee4644d998331d9e13be82e05b4c
+
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+builtin-timechart must only pass -e power:xy events if they are supported by
+the running kernel, otherwise try to fetch the old power:power{start,end}
+events.
+
+For this I added the tiny helper function:
+
+ int is_valid_tracepoint(const char *event_string)
+
+to parse-events.[hc], which could be more generic as an interface and support
+hardware/software/... events, not only tracepoints, but someone else could
+extend that if needed...
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+Acked-by: Arjan van de Ven <arjan@linux.intel.com>
+Acked-by: Jean Pihet <j-pihet@ti.com>
+LKML-Reference: <1294073445-14812-4-git-send-email-trenn@suse.de>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+
+---
+ tools/perf/builtin-timechart.c | 99 +++++++++++++++++++++++++++++++++--------
+ tools/perf/util/parse-events.c | 41 ++++++++++++++++
+ tools/perf/util/parse-events.h | 1
+ 3 files changed, 122 insertions(+), 19 deletions(-)
+
+Index: linux-2.6.37-master/tools/perf/builtin-timechart.c
+===================================================================
+--- linux-2.6.37-master.orig/tools/perf/builtin-timechart.c
++++ linux-2.6.37-master/tools/perf/builtin-timechart.c
+@@ -32,6 +32,10 @@
+ #include "util/session.h"
+ #include "util/svghelper.h"
+
++#define SUPPORT_OLD_POWER_EVENTS 1
++#define PWR_EVENT_EXIT -1
++
++
+ static char const *input_name = "perf.data";
+ static char const *output_name = "output.svg";
+
+@@ -298,12 +302,21 @@ struct trace_entry {
+ int lock_depth;
+ };
+
+-struct power_entry {
++#ifdef SUPPORT_OLD_POWER_EVENTS
++static int use_old_power_events;
++struct power_entry_old {
+ struct trace_entry te;
+ u64 type;
+ u64 value;
+ u64 cpu_id;
+ };
++#endif
++
++struct power_processor_entry {
++ struct trace_entry te;
++ u32 state;
++ u32 cpu_id;
++};
+
+ #define TASK_COMM_LEN 16
+ struct wakeup_entry {
+@@ -489,29 +502,48 @@ static int process_sample_event(event_t
+ te = (void *)data.raw_data;
+ if (session->sample_type & PERF_SAMPLE_RAW && data.raw_size > 0) {
+ char *event_str;
+- struct power_entry *pe;
+-
+- pe = (void *)te;
+-
++#ifdef SUPPORT_OLD_POWER_EVENTS
++ struct power_entry_old *peo;
++ peo = (void *)te;
++#endif
+ event_str = perf_header__find_event(te->type);
+
+ if (!event_str)
+ return 0;
+
+- if (strcmp(event_str, "power:power_start") == 0)
+- c_state_start(pe->cpu_id, data.time, pe->value);
+-
+- if (strcmp(event_str, "power:power_end") == 0)
+- c_state_end(pe->cpu_id, data.time);
+-
+- if (strcmp(event_str, "power:power_frequency") == 0)
+- p_state_change(pe->cpu_id, data.time, pe->value);
+-
+- if (strcmp(event_str, "sched:sched_wakeup") == 0)
++ if (strcmp(event_str, "power:cpu_idle") == 0) {
++ struct power_processor_entry *ppe = (void *)te;
++ if (ppe->state == (u32)PWR_EVENT_EXIT)
++ c_state_end(ppe->cpu_id, data.time);
++ else
++ c_state_start(ppe->cpu_id, data.time,
++ ppe->state);
++ }
++ else if (strcmp(event_str, "power:cpu_frequency") == 0) {
++ struct power_processor_entry *ppe = (void *)te;
++ p_state_change(ppe->cpu_id, data.time, ppe->state);
++ }
++ else if (strcmp(event_str, "sched:sched_wakeup") == 0)
+ sched_wakeup(data.cpu, data.time, data.pid, te);
+
+- if (strcmp(event_str, "sched:sched_switch") == 0)
++ else if (strcmp(event_str, "sched:sched_switch") == 0)
+ sched_switch(data.cpu, data.time, te);
++
++#ifdef SUPPORT_OLD_POWER_EVENTS
++ if (use_old_power_events) {
++ if (strcmp(event_str, "power:power_start") == 0)
++ c_state_start(peo->cpu_id, data.time,
++ peo->value);
++
++ else if (strcmp(event_str, "power:power_end") == 0)
++ c_state_end(data.cpu, data.time);
++
++ else if (strcmp(event_str,
++ "power:power_frequency") == 0)
++ p_state_change(peo->cpu_id, data.time,
++ peo->value);
++ }
++#endif
+ }
+ return 0;
+ }
+@@ -968,7 +1000,8 @@ static const char * const timechart_usag
+ NULL
+ };
+
+-static const char *record_args[] = {
++#ifdef SUPPORT_OLD_POWER_EVENTS
++static const char * const record_old_args[] = {
+ "record",
+ "-a",
+ "-R",
+@@ -981,15 +1014,43 @@ static const char *record_args[] = {
+ "-e", "sched:sched_switch",
+ };
+
++#endif
++
++static const char * const record_new_args[] = {
++ "record",
++ "-a",
++ "-R",
++ "-f",
++ "-c", "1",
++ "-e", "power:cpu_frequency",
++ "-e", "power:cpu_idle",
++ "-e", "sched:sched_wakeup",
++ "-e", "sched:sched_switch",
++};
++
+ static int __cmd_record(int argc, const char **argv)
+ {
+ unsigned int rec_argc, i, j;
+ const char **rec_argv;
++ const char * const *record_args = record_new_args;
++ unsigned int record_elems = ARRAY_SIZE(record_new_args);
+
+- rec_argc = ARRAY_SIZE(record_args) + argc - 1;
++#ifdef SUPPORT_OLD_POWER_EVENTS
++ if (!is_valid_tracepoint("power:cpu_idle") &&
++ is_valid_tracepoint("power:power_start")) {
++ use_old_power_events = 1;
++ record_args = record_old_args;
++ record_elems = ARRAY_SIZE(record_old_args);
++ }
++#endif
++
++ rec_argc = record_elems + argc - 1;
+ rec_argv = calloc(rec_argc + 1, sizeof(char *));
+
+- for (i = 0; i < ARRAY_SIZE(record_args); i++)
++ if (rec_argv == NULL)
++ return -ENOMEM;
++
++ for (i = 0; i < record_elems; i++)
+ rec_argv[i] = strdup(record_args[i]);
+
+ for (j = 1; j < (unsigned int)argc; j++, i++)
+Index: linux-2.6.37-master/tools/perf/util/parse-events.c
+===================================================================
+--- linux-2.6.37-master.orig/tools/perf/util/parse-events.c
++++ linux-2.6.37-master/tools/perf/util/parse-events.c
+@@ -906,6 +906,47 @@ static void print_tracepoint_events(void
+ }
+
+ /*
++ * Check whether event is in <debugfs_mount_point>/tracing/events
++ */
++
++int is_valid_tracepoint(const char *event_string)
++{
++ DIR *sys_dir, *evt_dir;
++ struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
++ char evt_path[MAXPATHLEN];
++ char dir_path[MAXPATHLEN];
++
++ if (debugfs_valid_mountpoint(debugfs_path))
++ return 0;
++
++ sys_dir = opendir(debugfs_path);
++ if (!sys_dir)
++ return 0;
++
++ for_each_subsystem(sys_dir, sys_dirent, sys_next) {
++
++ snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,
++ sys_dirent.d_name);
++ evt_dir = opendir(dir_path);
++ if (!evt_dir)
++ continue;
++
++ for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
++ snprintf(evt_path, MAXPATHLEN, "%s:%s",
++ sys_dirent.d_name, evt_dirent.d_name);
++ if (!strcmp(evt_path, event_string)) {
++ closedir(evt_dir);
++ closedir(sys_dir);
++ return 1;
++ }
++ }
++ closedir(evt_dir);
++ }
++ closedir(sys_dir);
++ return 0;
++}
++
++/*
+ * Print the help text for the event symbols:
+ */
+ void print_events(void)
+Index: linux-2.6.37-master/tools/perf/util/parse-events.h
+===================================================================
+--- linux-2.6.37-master.orig/tools/perf/util/parse-events.h
++++ linux-2.6.37-master/tools/perf/util/parse-events.h
+@@ -29,6 +29,7 @@ extern int parse_filter(const struct opt
+ #define EVENTS_HELP_MAX (128*1024)
+
+ extern void print_events(void);
++extern int is_valid_tracepoint(const char *event_string);
+
+ extern char debugfs_path[];
+ extern int valid_debugfs_mount(const char *debugfs);
diff --git a/patches.arch/perf_timechart_fix_idle_boxes.patch b/patches.arch/perf_timechart_fix_idle_boxes.patch
new file mode 100644
index 0000000000..fc3e26cdaa
--- /dev/null
+++ b/patches.arch/perf_timechart_fix_idle_boxes.patch
@@ -0,0 +1,31 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: Fix display of idle boxes
+Patch-Mainline: not yet
+References: none
+
+This fix is needed for eye of gnome and firefox svn viewers.
+Inkscape can also handle the broken case.
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+---
+ tools/perf/util/svghelper.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+Index: linux-2.6.37-master/tools/perf/util/svghelper.c
+===================================================================
+--- linux-2.6.37-master.orig/tools/perf/util/svghelper.c
++++ linux-2.6.37-master/tools/perf/util/svghelper.c
+@@ -455,9 +455,9 @@ void svg_legenda(void)
+ return;
+
+ svg_legenda_box(0, "Running", "sample");
+- svg_legenda_box(100, "Idle","rect.c1");
+- svg_legenda_box(200, "Deeper Idle", "rect.c3");
+- svg_legenda_box(350, "Deepest Idle", "rect.c6");
++ svg_legenda_box(100, "Idle","c1");
++ svg_legenda_box(200, "Deeper Idle", "c3");
++ svg_legenda_box(350, "Deepest Idle", "c6");
+ svg_legenda_box(550, "Sleeping", "process2");
+ svg_legenda_box(650, "Waiting for cpu", "waiting");
+ svg_legenda_box(800, "Blocked on IO", "blocked");
diff --git a/patches.arch/perf_timechart_fix_zero_timestamps.patch b/patches.arch/perf_timechart_fix_zero_timestamps.patch
new file mode 100644
index 0000000000..75bb39c33b
--- /dev/null
+++ b/patches.arch/perf_timechart_fix_zero_timestamps.patch
@@ -0,0 +1,32 @@
+From: Thomas Renninger <trenn@suse.de>
+Subject: Fix huge and wronge C-state drawings due to uninitialized start/end timestamps
+Patch-Mainline: not yet
+References: none
+
+Signed-off-by: Thomas Renninger <trenn@suse.de>
+
+---
+ tools/perf/builtin-timechart.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+Index: linux-2.6.37-master/tools/perf/builtin-timechart.c
+===================================================================
+--- linux-2.6.37-master.orig/tools/perf/builtin-timechart.c
++++ linux-2.6.37-master/tools/perf/builtin-timechart.c
+@@ -654,8 +654,15 @@ static void draw_c_p_states(void)
+ * two pass drawing so that the P state bars are on top of the C state blocks
+ */
+ while (pwr) {
+- if (pwr->type == CSTATE)
++ if (pwr->type == CSTATE) {
++ /* If the first event is an _end event, start timestamp is zero
++ -> ignore these */
++ if (pwr->start_time == 0 || pwr->end_time == 0) {
++ pwr = pwr->next;
++ continue;
++ }
+ svg_cstate(pwr->cpu, pwr->start_time, pwr->end_time, pwr->state);
++ }
+ pwr = pwr->next;
+ }
+
diff --git a/series.conf b/series.conf
index f99a0b7ae5..dff3297abd 100644
--- a/series.conf
+++ b/series.conf
@@ -282,6 +282,14 @@
# patches.suse/cpuidle-documentation
patches.fixes/cpufreq_ondemand_performance_optimise_default_settings.patch
+## cpuidle perf events cleanups and related
+ patches.arch/cpuidle_rename_c0_to_poll_state.patch
+ patches.arch/cpuidle_event_fix_export.patch
+ patches.arch/cpuidle_introduce_cpuidle_events.patch
+ patches.arch/perf_adjust_timechart_to_new_cpuidle_events.patch
+ patches.arch/cpuidle_fix_double_events.patch
+ patches.arch/perf_timechart_fix_idle_boxes.patch
+ patches.arch/perf_timechart_fix_zero_timestamps.patch
########################################################
# AGP, graphics related stuff
@@ -676,8 +684,6 @@
patches.fixes/ia64-configure-HAVE_UNSTABLE_SCHED_CLOCK-for-SGI_SN.patch
- patches.fixes/perf_timechart_power_end_segfault.patch
-
########################################################
# KVM patches
########################################################