Skip to content

Commit 288f023

Browse files
Arjan van de VenIngo Molnar
authored andcommitted
tracing, x86, cpuidle: Move the end point of a C state in the power tracer
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>
1 parent 964a0b3 commit 288f023

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

arch/x86/kernel/process.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ void default_idle(void)
309309
else
310310
local_irq_enable();
311311
current_thread_info()->status |= TS_POLLING;
312-
trace_power_end(0);
313312
} else {
314313
local_irq_enable();
315314
/* loop is done by the caller */
@@ -377,7 +376,6 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
377376
if (!need_resched())
378377
__mwait(ax, cx);
379378
}
380-
trace_power_end(0);
381379
}
382380

383381
/* Default MONITOR/MWAIT with no hints, used for default C1 state */
@@ -394,7 +392,6 @@ static void mwait_idle(void)
394392
__sti_mwait(0, 0);
395393
else
396394
local_irq_enable();
397-
trace_power_end(0);
398395
} else
399396
local_irq_enable();
400397
}

drivers/cpuidle/cpuidle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/cpuidle.h>
1818
#include <linux/ktime.h>
1919
#include <linux/hrtimer.h>
20+
#include <trace/events/power.h>
2021

2122
#include "cpuidle.h"
2223

@@ -91,6 +92,7 @@ static void cpuidle_idle_call(void)
9192
/* give the governor an opportunity to reflect on the outcome */
9293
if (cpuidle_curr_governor->reflect)
9394
cpuidle_curr_governor->reflect(dev);
95+
trace_power_end(0);
9496
}
9597

9698
/**

0 commit comments

Comments
 (0)