Re: Problem with kernel-pll in 2.0.3x (at least)

Philip Gladstone (philip@raptor.com)
Fri, 01 May 1998 09:56:39 -0400


I'd be *very* cautious about changing this stuff.

However, with regard to the current discussion, there is a
problem. It appears as though 'time' as seen by the kernel is
derived from the underlying CPU clock and is *not* derived from
the rate of timer interrupts. Thus the key thing is to have
a good estimate of the CPU clock.

In any case, the 1,000,000 / HZ is not a revelant calculation
even on a 386, as the hardware clock actually runs at 1.19 Mhz.

It does appear that there is a feature in the alpha clock
code (in timer_interrupt) which could cause clock instability.
This arises from the way that it calculates the number of underlying
clock ticks to run. The current code looks like:

now = rpcc();
delta = now - state.last_time;
state.last_time = now;
delta = delta * state.scaled_ticks_per_cycle;
if ((delta & mask) != half)
delta += half;
nticks = delta >> FIX_SHIFT;

I'd prefer something like:

now = rpcc();
delta = now - state.last_time;
delta = delta * state.scaled_ticks_per_cycle;
nticks = delta >> FIX_SHIFT;
state.last_time += (nticks << FIX_SHIFT) /
state.scaled_ticks_per_cycle;

If someone who has an alpha could try this change (in
arch/alpha/kernel/time.c: timer_interrupt)
it would be nice to know if it helps. The clock rate is goverened by the
state.scale_ticks_per_cycle. This has plenty of resolution. There could
be a problem
if the cycle_freq is not set correctly by the boot loader -- in this
case it tries
to estimate the frequency, and this may cause problems.

Philip

J.S.Peatfield@damtp.cam.ac.uk wrote:
>
> In fact since 1,000,000 / 1024 is not a whole number, the clock is
> BOUND to drift by the residual * HZppm. In the case of the 1024 HZ
> on the alpha that puts it at ~576ppm to start with (that would be ~50
> seconds per day so this must be wrong)!
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu

-- 
Philip Gladstone                           +1 781 530 2461
Raptor Systems / Axent Technologies 
Waltham, MA         		    http://www.raptor.com/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu