From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 27 00:38:38 2010 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FDC8106566B for ; Sat, 27 Mar 2010 00:38:38 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D450E8FC16 for ; Sat, 27 Mar 2010 00:38:37 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id CE3DC1FFC51; Sat, 27 Mar 2010 00:38:36 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 9AA01844DA; Sat, 27 Mar 2010 01:38:36 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Peter Jeremy References: <4BACC791.70502@icyb.net.ua> <86zl1v84vy.fsf@ds4.des.no> <4BACD88E.2040803@icyb.net.ua> <86vdcj82qx.fsf@ds4.des.no> <20100326213022.GD32799@server.vk2pj.dyndns.org> Date: Sat, 27 Mar 2010 01:38:36 +0100 In-Reply-To: <20100326213022.GD32799@server.vk2pj.dyndns.org> (Peter Jeremy's message of "Sat, 27 Mar 2010 08:30:23 +1100") Message-ID: <86pr2qlhtf.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@FreeBSD.org, Andriy Gapon Subject: Re: periodically save current time to time-of-day hardware X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Mar 2010 00:38:38 -0000 Peter Jeremy writes: > It's not especially important how regularly the RTC is updated, just > that it _is_ updated. This suggests that an alternative approach > would be for adjtime() / ntp_adjtime() to directly call resettodr() if > it's more than P minutes since resettodr() was last called. It just occurred to me that resettodr() is very slow (it usually involves writing to NVRAM over an I2C bus), so it might not be a good idea to call it from adjtime(). > As a general comment, whilst resettodr() needs to be serialised, there > is no need for it to block. If thread B wants to call resettodr() > whilst thread A is doing so, thread B can just skip the call because > calling resettodr() twice in quick succession has no benefit. It does if thread B set the system clock before calling resettodr() (think ntpd -gq). Actually, it might be a good idea to call resettodr() any time the clock is stepped. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no