[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: [PATCH] Simplify th_bintime update in tc_windup()
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2017-10-11 11:03:24
Message-ID: 20171011110324.GY95911 () kib ! kiev ! ua
[Download RAW message or body]

On Wed, Oct 11, 2017 at 11:49:01AM +0200, Sebastian Huber wrote:
> On 11/10/17 11:31, Konstantin Belousov wrote:
> 
> > 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.
> 
> The loop is:
> 
>  ššš bt = th->th_offset;
>  ššš bintime_add(&bt, &th->th_boottime);
> 
> <--- here the bt is our new system time
> 
>  ššš i = bt.sec - tho->th_microtime.tv_sec;
>  ššš if (i > LARGE_STEP)
>  ššš ššš i = 2;
>  ššš for (; i > 0; i--) {
>  ššš ššš t = bt.sec;
>  ššš ššš ntp_update_second(&th->th_adjustment, &bt.sec);
>  ššš ššš if (bt.sec != t)
Can you fix your mail client ?  The mail body is filled with the \x9a
symbols which makes the text unreadable and requiring decyphering.

> 
> <-- here the bt.sec changed
> 
>  ššš ššš ššš th->th_boottime.sec += bt.sec - t;
> 
> <-- here we update the boottime seconds, so now bt == uptime + boottime
>  ššš }
> 
> So, I think the patch is correct.
Thank you for the explanation.  I committed this as r324528.

> 
> >
> > 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 ?
> >
> 
> All values should reflect the same time.
s/should// due to synchronity of the updates to bt and th_bootime, as
you noted above.

_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic