Re: [PATCH RFC] timekeeping: Fix clock stability with nohz

From: Miroslav Lichvar
Date: Tue Dec 10 2013 - 05:21:09 EST


On Fri, Dec 06, 2013 at 05:43:45PM -0800, John Stultz wrote:
> Being that the bigadjust code, and specifically this lookahead bit, has
> always been the most opaque logic to me, I figured I'd spend some time
> looking at alternatives, and came up with one approach that tries to
> mimic your patch, but tries to be more in line with the existing logic.
>
> It seems to do fairly well in the simulator:
> n: 30, slope: 1.00 (1.00 GHz), dev: 3.2 ns, max: 3.6 ns, freq: -99.95677 ppm

Hm, this shows a 0.043ppm error in the frequency. It doesn't seem to go
away even when I use a long sampling interval or give it more time to
settle down. Is that an expected side effect of the patch?

> Basically in the big-error case, we calculate the adjustment from the
> current tick error (and the assumption is that is where the majority of
> the large error is coming from), leaving the normal +1/-1 adjustments to
> the cumulative error.

The normal +1/-1 adjustment doesn't seem to be active in the
simulation, at least in the default settings with 100ppm offset. When
I print the error variable in timekeeping_adjust() I can see its
absolute value stays above interval*2, so timekeeping_bigadjust() is
called on every update. The bigadjust correction seems too weak to
bring the error down to activate the normal +1/-1 adjustment, the
error keeps increasing and the frequency is slighly off.

What does the following line from your patch mean?

tick_error -= tk->xtime_interval;

--
Miroslav Lichvar
--
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/