[PATCH v6 0/8] ptp: IEEE 1588 hardware clock support
M. Warner Losh
imp at bsdimp.com
Fri Oct 1 21:44:50 EDT 2010
In message: <alpine.DEB.2.00.1009271035110.9258 at router.home>
Christoph Lameter <cl at linux.com> writes:
: On Thu, 23 Sep 2010, Christian Riesch wrote:
: > > > It implies clock tuning in userspace for a potential sub microsecond
: > > > accurate clock. The clock accuracy will be limited by user space
: > > > latencies and noise. You wont be able to discipline the system clock
: > > > accurately.
: > >
: > > Noise matters, latency doesn't.
: > Well put! That's why we need hardware support for PTP timestamping to reduce
: > the noise, but get along well with the clock servo that is steering the PHC in
: > user space.
: Even if I buy into the catch phrase above: User space is subject to noise
: that the in kernel code is not. If you do the tuning over long intervals
: then it hopefully averages out but it still causes jitter effects that
: affects the degree of accuracy (or sync) that you can reach. And the noise
: varies with the load on the system.
Please see the earlier posts in this thread about why this doesn't
matter as much as you might think. What matters is the measurements
(which are done in hardware and the results buffered), not the latency
in processing those messages through your servo. This is due to the
fact that the errors that even long latencies introduce are
proportional to the change in fractional frequency[*] of the clock being
steered. This change is usually on the order of a part per million.
Even with 10ms of latency would mean that you're introducing on the
order of sub-nanoseconds of phase error that will be measured in the
next cycle and steered out.
That's why latency doesn't matter. Do you have other math to show
that it does?
[*] abs(1 - (clock_freq_old / clock_freq_new)) where clock_freq_old is
the old estimate of the clock and clock_freq_new is the new frequency
estimate of the clock. Second to second, these change on the order of
a part per million or less...
More information about the linux-arm-kernel