lkml.org 
[lkml]   [2006]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject-rt tsc frequency check
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 =
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-12-06 02:11    [W:0.028 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site