From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 30 16:43:50 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 4EE2D106566B; Tue, 30 Mar 2010 16:43:50 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7B48FC0A; Tue, 30 Mar 2010 16:43:48 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA28708; Tue, 30 Mar 2010 19:43:47 +0300 (EEST) (envelope-from avg@icyb.net.ua) Message-ID: <4BB22A42.7050003@icyb.net.ua> Date: Tue, 30 Mar 2010 19:43:46 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.24 (X11/20100319) MIME-Version: 1.0 To: John Baldwin References: <4BACC791.70502@icyb.net.ua> <20100327214634.GI32799@server.vk2pj.dyndns.org> <86fx3k7jqi.fsf@ds4.des.no> <201003291044.28544.jhb@freebsd.org> In-Reply-To: <201003291044.28544.jhb@freebsd.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= 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: Tue, 30 Mar 2010 16:43:50 -0000 on 29/03/2010 17:44 John Baldwin said the following: > On Sunday 28 March 2010 7:45:25 am Dag-Erling Smørgrav wrote: >> Peter Jeremy writes: >>> A new kthread which sleeps on channel "update_rtc". When woken, it >>> checks to see if it's within (say) 50msec of a second boundary and so, >>> it does a trylock on the (new) RTC mutex. If it grabs the mutex then >>> it performs the update. If it was too far from the second boundary or >>> it fails to grab the mutex then it sleeps until the next second >>> boundary and tries again. >>> >>> The existing resettodr() would then turn into a wakeup(update_rtc). >> Sounds good to me, but if only that thread has access to the RTC, why >> bother with a mutex? > > I would dispense with the kthread and just use a callout (or have a callout > schedule a task for taskqueue_thread). Guys, do you think that periodic saving of system clock to hardware and making resettodr asynchronous are dependent issues? Or are they orthogonal and can be implemented independently? -- Andriy Gapon