tracing, x86, cpuidle: Move the end point of a C state in the power tracer
authorArjan van de Ven <arjan@infradead.org>
Sat, 19 Sep 2009 11:35:33 +0000 (13:35 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Sep 2009 16:57:52 +0000 (18:57 +0200)
The "end of a C state" trace point currently happens before
the code runs that corrects the TSC for having stopped during idle.

The result of this is that the timestamp of the end-of-C-state event
is garbage on cpus where the TSC stops during idle.

This patch moves the end point of the C state to after the timekeeping
engine of the kernel has been corrected.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: fweisbec@gmail.com
Cc: peterz@infradead.org
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20090919133533.139c2a46@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/process.c
drivers/cpuidle/cpuidle.c

index 7b60e390688967bd64fbedcaf9673485854d05fe..847ab41603155ad493df143b24e6c9055f0f10e8 100644 (file)
@@ -309,7 +309,6 @@ void default_idle(void)
                else
                        local_irq_enable();
                current_thread_info()->status |= TS_POLLING;
-               trace_power_end(0);
        } else {
                local_irq_enable();
                /* loop is done by the caller */
@@ -377,7 +376,6 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
                if (!need_resched())
                        __mwait(ax, cx);
        }
-       trace_power_end(0);
 }
 
 /* Default MONITOR/MWAIT with no hints, used for default C1 state */
@@ -394,7 +392,6 @@ static void mwait_idle(void)
                        __sti_mwait(0, 0);
                else
                        local_irq_enable();
-               trace_power_end(0);
        } else
                local_irq_enable();
 }
index 8504a210855710f897812ed6a265a960bc1baa5f..ad41f19b8e3fa22d008a4c1e3c1ce9ec79fa025e 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/cpuidle.h>
 #include <linux/ktime.h>
 #include <linux/hrtimer.h>
+#include <trace/events/power.h>
 
 #include "cpuidle.h"
 
@@ -91,6 +92,7 @@ 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(0);
 }
 
 /**