From owner-freebsd-hackers@freebsd.org Sat Jul 25 16:05:30 2015 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 04E199AA2CB for ; Sat, 25 Jul 2015 16:05:30 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) by mx1.freebsd.org (Postfix) with SMTP id DB29E2FF for ; Sat, 25 Jul 2015 16:05:29 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Sat, 25 Jul 2015 16:04:54 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t6PG5LK7014069; Sat, 25 Jul 2015 10:05:21 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1437840321.48814.10.camel@freebsd.org> Subject: Re: Timekeeping between two hardclocks From: Ian Lepore To: deco33000@yandex.com Cc: "freebsd-hackers@freebsd.org" Date: Sat, 25 Jul 2015 10:05:21 -0600 In-Reply-To: <1408761437838413@web20h.yandex.ru> References: <1226791437830729@web8g.yandex.ru> <1408761437838413@web20h.yandex.ru> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jul 2015 16:05:30 -0000 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