time_init() patch for Alpha.

From: Larry Woodman (woodman@missioncriticallinux.com)
Date: Fri Apr 28 2000 - 15:36:32 EST


The time_init() routine for Alpha should always trust the process
cycle counter values over whats in the hwrpb->cycle_freq. Without
this the clock can be several minutes fast or slow per day.

This patch to arch/alpha/kernel/time.c seems to prevent the
clock from running slower or faster than it should.

Larry Woodman
http://www.missioncriticallinux.com


--- arch/alpha/kernel/time.c.orig Fri Apr 28 16:18:32 2000
+++ arch/alpha/kernel/time.c Fri Apr 28 16:25:05 2000
@@ -230,12 +230,15 @@
         cycle_freq = hwrpb->cycle_freq;
         one_percent = cycle_freq / 100;
         diff = cycle_freq - est_cycle_freq;
+
+ /* Always trust the cycle counter measurement unless a kernel arg was passed in. */
+ cycle_freq = est_cycle_freq;
+
         if (diff < 0)
                 diff = -diff;
         if (diff > one_percent) {
- cycle_freq = est_cycle_freq;
- printk("HWRPB cycle frequency bogus. Estimated %lu Hz\n",
- cycle_freq);
+ printk("HWRPB cycle frequency off by more than 1%: Reported %lu, Calculated %lu Hz\n",
+ hwrpb->cycle_freq, cycle_freq);
         }
         else {
                 est_cycle_freq = 0;



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:20 EST