From owner-freebsd-stable@FreeBSD.ORG Tue Apr 5 19:32:40 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3201216A4CE for ; Tue, 5 Apr 2005 19:32:40 +0000 (GMT) Received: from mail16.syd.optusnet.com.au (mail16.syd.optusnet.com.au [211.29.132.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id 251FE43D54 for ; Tue, 5 Apr 2005 19:32:39 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j35JWSGH017216 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Wed, 6 Apr 2005 05:32:29 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j35JWS7l086988; Wed, 6 Apr 2005 05:32:28 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j35JWQO7086987; Wed, 6 Apr 2005 05:32:26 +1000 (EST) (envelope-from pjeremy) Date: Wed, 6 Apr 2005 05:32:26 +1000 From: Peter Jeremy To: Andriy Gapon Message-ID: <20050405193226.GB84293@cirb503493.alcatel.com.au> References: <1112365401.00269464.1112352602@10.7.7.3> <1112372627.00269546.1112361001@10.7.7.3> <1112372655.00269555.1112362202@10.7.7.3> <424D7911.8060805@icyb.net.ua> <6.2.0.14.2.20050401183743.04813c10@gid.co.uk> <42527E03.5090805@icyb.net.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42527E03.5090805@icyb.net.ua> User-Agent: Mutt/1.4.2i cc: David Magda cc: stable@freebsd.org Subject: Re: Kernel NTP flipping between FLL and PLL modes X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2005 19:32:40 -0000 On Tue, 2005-Apr-05 15:01:07 +0300, Andriy Gapon wrote: >on 01.04.2005 20:40 Bob Bishop said the following: >> >> Unlikely I think. As I said, I've got several machines on the same LAN: >> the 5.3's misbehave; the others don't. > >#define CLOCK_ALLAN 1500. >... >double allan_xpt = CLOCK_ALLAN; >... >if (ULOGTOD(sys_poll) > allan_xpt / 2) { >... > >if I understand the above "random" lines of code in >contrib/ntp/ntpd/ntp_loopfilter.c correctly, then PLL<->FLL switch >occurs when polling interval goes 512<->1024, which is perfectly >possible under certain conditions with default ntp settings: minpoll=64, >maxpoll=1024 if ntp.conf(5) can be trusted. Note that this code doesn't exist in 5.3. It was introduced sometime between 5.3 and 5.4. In any case, looking at the associated comments, this only affects the FLL/PLL loop gain. The FLL/PLL switch is set is in sys/kern/kern_ntptime.c:hardupdate() using: time_status &= ~STA_MODE; if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { L_LINT(ftemp, (time_monitor << 4) / mtemp); L_RSHIFT(ftemp, SHIFT_FLL + 4); L_ADD(time_freq, ftemp); time_status |= STA_MODE; } and this code hasn't changed. MINSEC is 256 (which matches the comments) MAXSEC is either 1200 or 2048 (depending on which header file is active), though the comments imply it is 1024. mtime is the time since the last adjustment (call to hardupdate()). STA_FLL is set in ntpd/ntp_loopfilter.c: if (sys_poll > NTP_MAXDPOLL) ntv.status |= STA_FLL; though the associated comment states "for legacy only". (And I'm never seeing STA_FLL transitions in syslog). This sets STA_FLL if the polling interval is > 2^10 (1024). By default, sys_poll is limited to NTP_MAXDPOLL so this should never occur. (You can over-ride it with "maxpoll N" on peer/server config lines). -- Peter Jeremy