Messages in this thread | | | Date | Tue, 14 Feb 2006 15:33:16 +0100 (CET) | From | Roman Zippel <> | Subject | Re: time patches by Roman Zippel |
| |
Hi,
On Tue, 14 Feb 2006, Ulrich Windl wrote:
> > > 15_time_offset and 18_time_freq change some well-known constants (like MAXPHASE) > > > by three orders of magnitude. > > --- linux-2.6-mm.orig/include/linux/timex.h 2005-12-21 12:12:00.000000000 +0100 > +++ linux-2.6-mm/include/linux/timex.h 2005-12-21 12:12:08.000000000 +0100 > @@ -95,11 +95,11 @@ > #define SHIFT_USEC 16 /* frequency offset scale (shift) */ > #define FINENSEC (1L << SHIFT_SCALE) /* ~1 ns in phase units */ > > -#define MAXPHASE 512000L /* max phase error (us) */ > +#define MAXPHASE 500000000L /* max phase error (ns) */ > #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ > #define MINSEC 16L /* min interval between updates (s) */ > #define MAXSEC 1200L /* max interval between updates (s) */ > -#define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ > +#define NTP_PHASE_LIMIT ((MAXPHASE / 1000) << 5) /* beyond max. dispersion */
The reference timex.h has the same change for MAXPHASE and NTP_PHASE_LIMIT is Linux specific. Where is the problem?
> > > the new adjtime() (16_time_adjust, 12_time_adj) changes the semantics: Since about > > > Linux 0.99, adjtime() had the adjtime_is_accurate property, i.e. on the long term > > > it behaved like an addition. > > > > I disagree, could you please explain how you come to this conclusion? > > + tick_nsec_curr += time_adjust * 1000 / HZ; > > Assuming 1024Hz interrupt frequency: > (1µs * 1000) / 1024 == 0ns; 0 * 1024 == 0µs, not 1µs > (2µs * 1000) / 1024 == 1ns; 1 * 1024 == 1.024µs, not 2µs
Ok, I didn't put much effort into optimizing it for uncommon HZ values. Why is it so important? It's currently unused on any Linux machine synchronized via NTP.
> > The patches don't change the behaviour beyond that they increase > > resolution and precision. Only the final patch changes the ntp code to > > match the behaviour of ntp reference code without including all its mess. > > It's quite hard to tell: The code is very different what I've ever seen.
Actually it's not that hard, under http://www.xs4all.nl/~zippel/ntp/ you can also find the user space test code I used to verify it. kernel.tar.Z is the old reference code, which the current Linux code is based on, under patches-kernel you can find a number of patches to convert it to the new model and which match the new kernel implementation. I updated the kern.dat and added a nano.sh script with matching test parameters for nanokernel, so you can compare the output of both test programms.
bye, Roman | |