Subject: Re: Proposed change to tickadj calculation
To: Frederick Bruckman <fb@enteract.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 06/04/2000 12:10:38
In message <Pine.NEB.4.21.0006040725180.26252-100000@fiona.home>,
Frederick Bruckman writes:

>Let me ask again if anyone would object to the following...
[...]
>
>Dropping tickadj to 1/8 of its previous value results in a substantial
>decrease of the average offset from the selected peers, in my tests on
>a 486dx4-100, 486dx2-66, and an AMD K5-380. On machines which are
>already marginal for running NTP, the call to adjtime() may rarely
>complete before the next one -- this will be obvious, as the daemon
>will either step frequently or fail to sync at all. This is why
>TICKADJ should be adjustable. 


I don't quite see the point of this. If you want to run ntp, you
shouldn't ever be calling adjtime() at all!  You should be using
ntp_adjtime(), with or without or a PPS line discipline.  And that
means ntpd will be calling ntp_adjtime(), not the old 4.3bsd
adjtime().  And ntp_adjtime() doesn't use tickadj.

In an ideal world, perhaps adjtime() would Go Away, but that means
getting rid of timed as well, and I'm not sure we're ready to do that.

If you build a kernel with "options NTP", how much of this is still
relevant? From perusing sys/kern/kern_clock.c and kern_ntptime.c, I
think the answer is "none at all" (and doing nm on the .o files for a
1.4Y kernel supports that: the only uses I can see are a sysctl in
kern_clock.c and in sys_adjtime() in kern_time.c), but I could be
wrong.


>Ports with 1000 Hz clocks but high
>interrupt latency might also benefit from a higher value of TICKADJ.

Nope. ntp can adjust for a fairly constant interrupt _latency_.  what
you need to do is minimize jitter, the or variation in latency in
catching a timestamp once the clock interrupt goes off. 

There, at least on some ports, one good answer is to collect a
timestamp on each entry to the kernel, or to each interrupt-service
routine which might need a timestamp for NTP purposes.


There are several things we could do to make NetBSD's NTP support even
better; but I don't see how monkeying with adjtime() is one of
them. Contact me via email if you want more details.