Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2019 17:00:40 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc:        FreeBSD <freebsd-hackers@freebsd.org>, bde@freebsd.org
Subject:   Re: Why is tc_get_timecount() called two times in tc_init()?
Message-ID:  <20191002140040.GA44691@kib.kiev.ua>
In-Reply-To: <0e27fb3e-0f60-68e1-dbba-f17c3d91c332@embedded-brains.de>
References:  <0e27fb3e-0f60-68e1-dbba-f17c3d91c332@embedded-brains.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 01, 2019 at 01:11:18PM +0200, Sebastian Huber wrote:
> Hello,
> 
> since this commit
> 
> https://github.com/freebsd/freebsd/commit/307f787e5a7f
> 
It is not very useful to pass github hashes around.

I think that the addition of the second tc_get_timecount() was done
earlier, in r95530, and there it has semi-useful comment
+  /* Warm up new timecounter. */
+  (void)newtc->tc_get_timecount(newtc);
+  (void)newtc->tc_get_timecount(newtc);

The commit message is not helpful at all.

I do not see a timecounter which would need two get_timecount() calls
to start working properly now, but I can imagine that at time it was.

I added Bruce to Cc: to may be get more context and explanation.

> tc_get_timecount() is called two times in tc_init().
> 
> /*
>   * Initialize a new timecounter and possibly use it.
>   */
> void
> tc_init(struct timecounter *tc)
> {
> [...]
> 	if (tc->tc_quality == timecounter->tc_quality &&
> 	    tc->tc_frequency < timecounter->tc_frequency)
> 		return;
> 	(void)tc->tc_get_timecount(tc);
> 	(void)tc->tc_get_timecount(tc);
> 	timecounter = tc;
> }
> 
> What is the reason for this procedure?
> 
> -- 
> Sebastian Huber, embedded brains GmbH
> 
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber@embedded-brains.de
> PGP     : Public key available on request.
> 
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> 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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191002140040.GA44691>