LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* -rt tsc frequency check
@ 2006-12-06  1:06 Daniel Walker
  0 siblings, 0 replies; only message in thread
From: Daniel Walker @ 2006-12-06  1:06 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, johnstul

I'm not sure about this code. It's checking the PM timer, and
doesn't seem to touch the TSC, then it marks the TSC unstable
based on the stability of the PM timer. 

The reason that this caught my attention is that it
marks my (AFAIK stable) tsc as unstable when it first 
runs.

Is there something in here that I'm missing?

---
 arch/i386/kernel/tsc.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

Index: linux-2.6.19/arch/i386/kernel/tsc.c
===================================================================
--- linux-2.6.19.orig/arch/i386/kernel/tsc.c
+++ linux-2.6.19/arch/i386/kernel/tsc.c
@@ -402,40 +402,30 @@ static struct dmi_system_id __initdata b
 
 #define TSC_FREQ_CHECK_INTERVAL (10*MSEC_PER_SEC) /* 10sec in MS */
 static struct timer_list verify_tsc_freq_timer;
-static unsigned long pm_multiplier;
 
 /* XXX - Probably should add locking */
 static void verify_tsc_freq(unsigned long unused)
 {
 	static u64 last_tsc;
-	static unsigned long last_jiffies, last_pm;
+	static unsigned long last_jiffies;
 
 	u64 now_tsc, interval_tsc;
-	unsigned long now_jiffies, interval_jiffies, pm, pm_delta;
+	unsigned long now_jiffies, interval_jiffies ;
 
 	if (check_tsc_unstable())
 		return;
 
 	rdtscll(now_tsc);
 	now_jiffies = jiffies;
-	pm = acpi_pm_read_early();
 
 	if (!last_jiffies)
 		goto out;
 
 	interval_jiffies = now_jiffies - last_jiffies;
 
-	if (pm == last_pm) {
-		interval_tsc = now_tsc - last_tsc;
-		interval_tsc *= HZ;
-		do_div(interval_tsc, cpu_khz*1000);
-	} else {
-		if (pm < last_pm)
-			pm += ACPI_PM_OVRRUN;
-		pm_delta = pm - last_pm;
-		interval_tsc = (((u64) pm_delta) * pm_multiplier) >> 22;
-		do_div(interval_tsc, TICK_NSEC);
-	}
+	interval_tsc = now_tsc - last_tsc;
+	interval_tsc *= HZ;
+	do_div(interval_tsc, cpu_khz*1000);
 
 	if (interval_tsc < (interval_jiffies * 3 / 4)) {
 		printk("TSC appears to be running slowly. "
@@ -446,7 +436,6 @@ static void verify_tsc_freq(unsigned lon
 out:
 	last_tsc = now_tsc;
 	last_jiffies = now_jiffies;
-	last_pm = pm;
 	/* set us up to go off on the next interval: */
 	mod_timer(&verify_tsc_freq_timer,
 		jiffies + msecs_to_jiffies(TSC_FREQ_CHECK_INTERVAL));
@@ -500,8 +489,6 @@ static int __init init_tsc_clocksource(v
 		if (!pmtmr_ioport || !clocksource_tsc.rating)
 			clocksource_tsc.is_continuous = 0;
 
-		pm_multiplier = clocksource_hz2mult(PMTMR_TICKS_PER_SEC, 22);
-
 		init_timer(&verify_tsc_freq_timer);
 		verify_tsc_freq_timer.function = verify_tsc_freq;
 		verify_tsc_freq_timer.expires =
--

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-06  1:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-06  1:06 -rt tsc frequency check Daniel Walker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).