Re: [RFC][PATCH] new timeofday core subsystem (v.A0)

George Anzinger
2004-09-15T20:02:44Z

john stultz wrote:
~

>
>
>>Real time features such as posix-timer's also depend on the ability to
>>deliver a signal at an exact point in time. Soft timers can only give a
>>very rough approximation in these cases.
>>
>>So I think this feature is essential.
>
>
> I think the functionality is essential, but that it doesn't belong in the time of day code.
>
> Basically we have two things we're trying to do:
>
> 1. Keep accurate time
> 2. Generate hardware interrupts accurately
>
> While frequently the same hardware can do both, not all hardware is
> usable for both functions. Thus I believe we should cleanly split these
> two subsystems. My proposal only provided the keep accurate time part,
> however one could using that functionality, to then manipulate hardware
> interrupts to ensure accuracy in the timer subsystem.
>
The thing I think is missing in all this is that, in some platforms, the
hardware to provide the interrupts is more accurate. We have, IMHO, three cases
here:
a) The interrupts are accurate but the clock info (e.g. TSC) is not.
b) The clock in accurate but the timer is not, and
c) The clock and interrupt come from the same accurate hardware source.

The X86 is in class a) in that the PIT is accurate and the TSC is not. The
muddy part here is the pm-timer which is accurate but takes a _long_ time to access.

PPCs are in class c) as are some MIPS, ARM, and PARISC. I am not sure about the
rest and can not lay my hands on one of class b).

For the class a) machines, I think the best approach is to use a clock that has
reasonable short term accuracy and to use the timer to, from time to time,
correct it. This should be on the order of an internal NTP sort of correction.

For the class a) and b) machines, I think it would be wise to not seperated the
timer and the clock so much as to make it "hard" to use one to correct the other.
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml