public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: mingo@elte.hu
Cc: Arjan van de Ven <arjan@infradead.org>,
	linux-kernel@vger.kernel.org, fweisbec@gmail.com,
	peterz@infradead.org, Paul Mackerras <paulus@samba.org>
Subject: [PATCH] trace: Move the end point of a C state in the power tracer
Date: Sat, 19 Sep 2009 13:35:33 +0200	[thread overview]
Message-ID: <20090919133533.139c2a46@infradead.org> (raw)
In-Reply-To: <20090919133410.7b23e270@infradead.org>

>From c1ffb79a8e87501ccaf269517566f438220f1c49 Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Sat, 19 Sep 2009 13:09:16 +0200
Subject: [PATCH] trace: 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>
---
 arch/x86/kernel/process.c |    3 ---
 drivers/cpuidle/cpuidle.c |    2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 98e9cac..230d054 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -299,7 +299,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 */
@@ -367,7 +366,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 */
@@ -384,7 +382,6 @@ static void mwait_idle(void)
 			__sti_mwait(0, 0);
 		else
 			local_irq_enable();
-		trace_power_end(0);
 	} else
 		local_irq_enable();
 }
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8504a21..ad41f19 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -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);
 }
 
 /**
-- 
1.6.0.6

 


-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

  parent reply	other threads:[~2009-09-19 11:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-19 11:34 [git pull] incremental updates to timechart Arjan van de Ven
2009-09-19 11:34 ` [PATCH] perf: Add "perf timechart record" Arjan van de Ven
2009-09-19 17:00   ` [tip:perfcounters/core] perf timechart: " tip-bot for Arjan van de Ven
2009-09-19 11:35 ` [PATCH] perf: Be consistent about minimum text size in the svghelper Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] perf utils: " tip-bot for Arjan van de Ven
2009-09-19 11:35 ` Arjan van de Ven [this message]
2009-09-19 17:01   ` [tip:perfcounters/core] tracing, x86, cpuidle: Move the end point of a C state in the power tracer tip-bot for Arjan van de Ven
2009-09-19 11:36 ` [PATCH] perf: Add timechart help text and add timechart to "perf help" Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] " tip-bot for Arjan van de Ven
2009-09-19 11:36 ` [PATCH] perf: Use a define for the maximum length of a trace event Arjan van de Ven
2009-09-19 17:01   ` [tip:perfcounters/core] perf utils: " tip-bot for Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090919133533.139c2a46@infradead.org \
    --to=arjan@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox