Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jul 2015 10:05:21 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        deco33000@yandex.com
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Timekeeping between two hardclocks
Message-ID:  <1437840321.48814.10.camel@freebsd.org>
In-Reply-To: <1408761437838413@web20h.yandex.ru>
References:  <1226791437830729@web8g.yandex.ru> <1408761437838413@web20h.yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2015-07-25 at 17:33 +0200, deco33000@yandex.com wrote:
> huumm..
> 
> Did I get it wrong ? we cannot guess where we are in time, we just cache the hardware clock and do some calculations on it up to the next hardware read.
> That way, we don't need to ask the hardware all the time.
> 
> I was wrong, thinking that we could derivate the current timestamp (the exact one, at the request moment) without ever needing hardware. That would have been genius.
> 
> But we just cache it. Simple.
> 
> Is my understanding right now ?

Unfortunately I don't have the time right now (and for at least a few
more days) to write up the detailed answers your questions need.

One piece of advice I might offer quickly, though:  over the past 2-3
years there have been some big changes in kernel timekeeping -- the
addition of the Feed-Forward clock code and the transition to a
"tickless" kernel with the advent of the "event timer" code -- and these
things make it harder to under the basic logic that was largely
unchanged for many years in kernel timekeeping and is still really at
the heart of it all.

You may find it useful to look at the kern_tc code in the 8-stable
branch before those things were added.  Then it might become more clear
how the eventtimer changes work to skip the uneccessary timer ticks
between counter rollovers.

-- Ian





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