Re: dynamic-hz

john stultz
2004-12-13T20:45:11Z

On Mon, 2004-12-13 at 11:12, Pavel Machek wrote:
> Hi!
>
> > > But that does not matter, right? Yes, one-shot timer will not fire
> > > exactly at right place, but as long as you are reading TSC and basing
> > > next shot on current time, error should not accumulate.
> >
> > As said in the rest of the message, the error (or some other error)
> > accumulates heavily today in the tick-loss compensation/adjustment
> > algorithm in arch/i386/kernel/timers/timer_tsc.c, so I'm sceptical
> > about
>
> I do not see how it should accumulate. Lets have working TSC. You want
> to emulate fixed-period timer with single-shot timer.

Its caused by the fact that we don't use the the TSC to accumulate time.
We are instead interpolating between timer ticks and the TSC, where the
timer tick is what really accumulates time, and the TSC is used for
inter-tick time keeping (with the exception of the lost tick
compensation code).

Unfortunately interrupt delay and queueing can cause situations where a
tick appears to be lost, but then immediately after a second one
appears. In this case we add two, compensating for the loss, and then
add one more.

One could try to catch these early-seeming ticks w/ similar compensation
code, but due to TSC calibration error there are sure to be holes where
more time inconsistencies could poke through.

My feeling is that we need to stop interpolating and just trust one time
source (ie: the TSC or ACPIPM or HPET or whatever). Check out my
timeofday patches for more details.

thanks
-john