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>
                else
                        local_irq_enable();
                current_thread_info()->status |= TS_POLLING;
-               trace_power_end(0);
        } else {
                local_irq_enable();
                /* loop is done by the caller */
                if (!need_resched())
                        __mwait(ax, cx);
        }
-       trace_power_end(0);
 }
 
 /* Default MONITOR/MWAIT with no hints, used for default C1 state */
                        __sti_mwait(0, 0);
                else
                        local_irq_enable();
-               trace_power_end(0);
        } else
                local_irq_enable();
 }
 
 #include <linux/cpuidle.h>
 #include <linux/ktime.h>
 #include <linux/hrtimer.h>
+#include <trace/events/power.h>
 
 #include "cpuidle.h"
 
        /* give the governor an opportunity to reflect on the outcome */
        if (cpuidle_curr_governor->reflect)
                cpuidle_curr_governor->reflect(dev);
+       trace_power_end(0);
 }
 
 /**