mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bailey, Scott" <scott.bailey@eds.com>
To: "'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Cc: "'torvalds@transmeta.com'" <torvalds@transmeta.com>,
	"'marcelo@conectiva.com.br'" <marcelo@conectiva.com.br>,
	"Bailey, Scott" <scott.bailey@eds.com>
Subject: [PATCH] arch/alpha/kernel/time.c - override bogus clock freq gues ses
Date: Thu, 5 Jun 2003 17:32:30 -0400	[thread overview]
Message-ID: <7FD257BF8564D4119DA800508BDF07AA0B0AAA21@usahm012.exmi01.exch.eds.com> (raw)

This is targeted at 2.4.20, but should apply cleanly to any of the 2.5
kernels too.

The clock frequency found in the Alpha HWRPB may be significantly off from
the actual frequency. The existing test is not stringent enough to weed out
errors that will swamp ntp; this patch reduces the allowable error from 1%
(10,000 PPM) to 250 PPM.

Kudos to Hal Murray <hmurray@suespammers.org> for insightful guidance;
tested on
my 3-way Alphaserver 4100 5/466 with very happy results. :-)

--- kernel-source-2.4.20/arch/alpha/kernel/time.c	2002-02-27
05:12:19.000000000 -0500
+++ rsb-patch/arch/alpha/kernel/time.c	2003-06-05 12:51:10.000000000 -0400
@@ -24,6 +24,8 @@
  * 2000-08-13	Jan-Benedict Glaw <jbglaw@lug-owl.de>
  * 	Fixed time_init to be aware of epoches != 1900. This prevents
  * 	booting up in 2048 for me;) Code is stolen from rtc.c.
+ * 2003-06-03	R. Scott Bailey <scott.bailey@eds.com>
+ *	Tighten sanity in time_init from 1% (10,000 PPM) to 250 PPM
  */
 #include <linux/config.h>
 #include <linux/errno.h>
@@ -288,7 +290,7 @@
 time_init(void)
 {
 	unsigned int year, mon, day, hour, min, sec, cc1, cc2, epoch;
-	unsigned long cycle_freq, one_percent;
+	unsigned long cycle_freq, tolerance;
 	long diff;
 
 	/* Calibrate CPU clock -- attempt #1.  */
@@ -306,13 +308,13 @@
 
 	cycle_freq = hwrpb->cycle_freq;
 	if (est_cycle_freq) {
-		/* If the given value is within 1% of what we calculated, 
+		/* If the given value is within 250 PPM of what we
calculated,
 		   accept it.  Otherwise, use what we found.  */
-		one_percent = cycle_freq / 100;
+		tolerance = cycle_freq / 4000;
 		diff = cycle_freq - est_cycle_freq;
 		if (diff < 0)
 			diff = -diff;
-		if (diff > one_percent) {
+		if (diff > tolerance) {
 			cycle_freq = est_cycle_freq;
 			printk("HWRPB cycle frequency bogus.  "
 			       "Estimated %lu Hz\n", cycle_freq);

                 reply	other threads:[~2003-06-05 21:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7FD257BF8564D4119DA800508BDF07AA0B0AAA21@usahm012.exmi01.exch.eds.com \
    --to=scott.bailey@eds.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®