From owner-freebsd-hackers@freebsd.org Wed Oct 11 09:31:21 2017 Return-Path: Delivered-To: freebsd-hackers@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 D6B0FE2643B for ; Wed, 11 Oct 2017 09:31:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 559301398 for ; Wed, 11 Oct 2017 09:31:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v9B9V1k5001956 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 Oct 2017 12:31:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9B9V1k5001956 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9B9V10N001955; Wed, 11 Oct 2017 12:31:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 11 Oct 2017 12:31:01 +0300 From: Konstantin Belousov To: Sebastian Huber Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] Simplify th_bintime update in tc_windup() Message-ID: <20171011093101.GX95911@kib.kiev.ua> References: <20171011064816.20809-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171011064816.20809-1-sebastian.huber@embedded-brains.de> User-Agent: Mutt/1.9.1 (2017-09-22) 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: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Oct 2017 09:31:21 -0000 On Wed, Oct 11, 2017 at 08:48:16AM +0200, Sebastian Huber wrote: > The th_bintime, th_microtime and th_nanotime members of the timehand all > cache the last system time (uptime + boottime). Only the format > differs. Do not re-calculate the bintime and simply use the value used > to calculate the microtime and nanotime. > > Group all the updates under the relevant comment. th->th_bintime is recalculated after possible adjustments made by the ntp loop to the th_boottime. But your patch makes me consider the two lines after the XXX comment. Shouldn't we use the updated th_bintime instead of the pre-adjustment bt value ? > > Is the > > "XXX shouldn't do this here. Should force non-`get' versions." > > part of the comment still valid? > --- > sys/kern/kern_tc.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c > index 088fcb41cfa..e7cfc51aff7 100644 > --- a/sys/kern/kern_tc.c > +++ b/sys/kern/kern_tc.c > @@ -1413,10 +1413,9 @@ tc_windup(struct bintime *new_boottimebin) > if (bt.sec != t) > th->th_boottime.sec += bt.sec - t; > } > - th->th_bintime = th->th_offset; > - bintime_add(&th->th_bintime, &th->th_boottime); > /* Update the UTC timestamps used by the get*() functions. */ > /* XXX shouldn't do this here. Should force non-`get' versions. */ > + th->th_bintime = bt; > bintime2timeval(&bt, &th->th_microtime); > bintime2timespec(&bt, &th->th_nanotime); > > -- > 2.12.3