Timekeeping between two hardclocks

Ian Lepore ian at freebsd.org
Sat Jul 25 16:05:30 UTC 2015


On Sat, 2015-07-25 at 17:33 +0200, deco33000 at 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




More information about the freebsd-hackers mailing list