Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt

From: George Anzinger
Date: Tue Jul 12 2005 - 11:01:27 EST


Con Kolivas wrote:
On Tue, 12 Jul 2005 22:39, Con Kolivas wrote:

On Tue, 12 Jul 2005 22:10, Vojtech Pavlik wrote:

The PIT crystal runs at 14.3181818 MHz (CGA dotclock, found on ISA, ...)
and is divided by 12 to get PIT tick rate

14.3181818 MHz / 12 = 1193182 Hz

Yes, but the current code uses 1193180. Wonder why that is...


The reality is that the crystal is usually off by 50-100 ppm from the
standard value, depending on temperature.

HZ ticks/jiffie 1 second error (ppm)
---------------------------------------------------
100 11932 1.000015238 15.2
200 5966 1.000015238 15.2
250 4773 1.000057143 57.1
300 3977 0.999931429 -68.6
333 3583 0.999964114 -35.9
500 2386 0.999847619 -152.4
1000 1193 0.999847619 -152.4

If we are following the standard and trying to set up a timer, the 1 second time MUST be >= 1 second. Thus the values for 300 and above in this table don't fly. If we are trying to keep system time, well we do just fine at that by using the actual value of the jiffie (NOT 1/HZ) when we update time (one of the reasons for going to nanoseconds in xtime). The observable thing the user sees is best seen by setting up an itimer to repeat every second. Then you will see the drift AND it will be against the system clock which itself is quite accurate (the 50-100ppm you mention), even without ntp. And the error really is in the range of 848ppm for HZ=1000 BECAUSE we need to follow the standard. You can easily see this with the current 2.6 kernel. We even have a bug report on it:

http://bugzilla.kernel.org/show_bug.cgi?id=3289
~
--
George Anzinger george@xxxxxxxxxx
HRT (High-res-timers): http://sourceforge.net/projects/high-res-timers/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/