From owner-svn-src-head@freebsd.org Sun Mar 27 17:33:06 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E76C9ADF0D6; Sun, 27 Mar 2016 17:33:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D8F213BB; Sun, 27 Mar 2016 17:33:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u2RHWrKP049331 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 27 Mar 2016 20:32:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u2RHWrKP049331 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u2RHWpF9049329; Sun, 27 Mar 2016 20:32:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 27 Mar 2016 20:32:51 +0300 From: Konstantin Belousov To: Bruce Evans Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "'rstone@freebsd.org'" Subject: Re: svn commit: r297039 - head/sys/x86/x86 Message-ID: <20160327173251.GB1741@kib.kiev.ua> References: <20160324090917.GC1741@kib.kiev.ua> <20160325010649.H898@besplex.bde.org> <20160324162447.GD1741@kib.kiev.ua> <20160325060901.N2059@besplex.bde.org> <20160325084902.GH1741@kib.kiev.ua> <20160326021219.X911@besplex.bde.org> <20160326174210.GU1741@kib.kiev.ua> <20160327051601.S2318@besplex.bde.org> <20160327130706.GA1741@kib.kiev.ua> <20160328033624.N850@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160328033624.N850@besplex.bde.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Mar 2016 17:33:07 -0000 On Mon, Mar 28, 2016 at 04:22:59AM +1100, Bruce Evans wrote: > On Sun, 27 Mar 2016, Konstantin Belousov wrote: > > We could even trust CPU report about its frequency as the last resort. > > From what I saw, the calibrated RTC frequency is very close to the Err, that should have been TSC, and not RTC. > > reported frequency, and if runtime recalibration based on ntp client > > feedback is implemented, all would be good. > > phk axed my RTC calibration code (actually i8254 and TSC calibration code > starting from the RTC). It worked perfectly except it didn't adjust for > the time to read the hardware. The problem with it is that the RTC is no > more or less accurate than the other timers. It should be, but isn't in > practice. Normally it it is controlled by different hardware (crystal?) > with different temperature characteristics and different exposure to > temperature changes by being physically separate. The i8254 is supposed > to run at precisely 1193182 Hz but usually has an inaccuracy of 10-50 Hz. > The RTC seconds update is supposed to occur at precisely 1 Hz but usually > has an unrelated inaccuracy of similar magnitude. Calibrating these clocks > relative to each other just gives the relative difference in their > inaccuracy. The difference can be measured very accurately at any time. > It varies later with temperature. I never finished code to track the > termperature changes and calibrate adjustments based on the temperature. > It is simpler to start with a hard-coded i8254 frequency of 1193182 and > adjust everything later. ntpd handles adjustment of a single timer well > enough. This works because the nominal frequency of 1193182 is so standard > that inaccuracies in it are closer to 10 ppm than the 1000 ppm that would > break ntpd. > > Bruce