From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1K3zF3-0005GQ-2K for user-mode-linux-devel@lists.sourceforge.net; Wed, 04 Jun 2008 13:05:53 -0700 Received: from gw.goop.org ([64.81.55.164] helo=mail.goop.org) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1K3zF1-0006cW-Mp for user-mode-linux-devel@lists.sourceforge.net; Wed, 04 Jun 2008 13:05:52 -0700 Message-ID: <4846F577.10603@goop.org> Date: Wed, 04 Jun 2008 21:05:11 +0100 From: Jeremy Fitzhardinge MIME-Version: 1.0 References: <20080603190235.GA9511@c2.user-mode-linux.org> <20080603123211.e129c222.akpm@linux-foundation.org> <200806031543.56864.dhazelton@enter.net> <878wxmfg99.fsf@hades.wkstn.nix> <20080603130709.fcf6a751.akpm@linux-foundation.org> <20080603210048.GA12182@c2.user-mode-linux.org> <4846A75E.40305@goop.org> <20080604193715.GA11943@c2.user-mode-linux.org> In-Reply-To: <20080604193715.GA11943@c2.user-mode-linux.org> Subject: Re: [uml-devel] [PATCH 1/6] UML - Deal with host time going backwards List-Id: The user-mode Linux development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: user-mode-linux-devel-bounces@lists.sourceforge.net Errors-To: user-mode-linux-devel-bounces@lists.sourceforge.net To: Jeff Dike Cc: Nix , Andrew Morton , linux-kernel@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, dhazelton@enter.net Jeff Dike wrote: > On Wed, Jun 04, 2008 at 03:31:58PM +0100, Jeremy Fitzhardinge wrote: > >> Shouldn't UML use a monotonic host clock for guest timekeeping? >> > > Indeed, Eric pointed out the posix timers, which I had forgotten > about. On the face of it, a monotonic timer should do the trick, but > it's not obvious how to get it to behave like a monotonic > gettimeofday... You can either read the monotonic clock directly, or use it as a time source for a monotonic timer. clock_gettime(CLOCK_MONOTONIC, &ts) will return the time in ns, and you can just feed that directly into the guest as a clocksource. J ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760547AbYFDUGG (ORCPT ); Wed, 4 Jun 2008 16:06:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755540AbYFDUFx (ORCPT ); Wed, 4 Jun 2008 16:05:53 -0400 Received: from gw.goop.org ([64.81.55.164]:49733 "EHLO mail.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754159AbYFDUFv (ORCPT ); Wed, 4 Jun 2008 16:05:51 -0400 Message-ID: <4846F577.10603@goop.org> Date: Wed, 04 Jun 2008 21:05:11 +0100 From: Jeremy Fitzhardinge User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Jeff Dike CC: Andrew Morton , Nix , dhazelton@enter.net, linux-kernel@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net Subject: Re: [PATCH 1/6] UML - Deal with host time going backwards References: <20080603190235.GA9511@c2.user-mode-linux.org> <20080603123211.e129c222.akpm@linux-foundation.org> <200806031543.56864.dhazelton@enter.net> <878wxmfg99.fsf@hades.wkstn.nix> <20080603130709.fcf6a751.akpm@linux-foundation.org> <20080603210048.GA12182@c2.user-mode-linux.org> <4846A75E.40305@goop.org> <20080604193715.GA11943@c2.user-mode-linux.org> In-Reply-To: <20080604193715.GA11943@c2.user-mode-linux.org> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jeff Dike wrote: > On Wed, Jun 04, 2008 at 03:31:58PM +0100, Jeremy Fitzhardinge wrote: > >> Shouldn't UML use a monotonic host clock for guest timekeeping? >> > > Indeed, Eric pointed out the posix timers, which I had forgotten > about. On the face of it, a monotonic timer should do the trick, but > it's not obvious how to get it to behave like a monotonic > gettimeofday... You can either read the monotonic clock directly, or use it as a time source for a monotonic timer. clock_gettime(CLOCK_MONOTONIC, &ts) will return the time in ns, and you can just feed that directly into the guest as a clocksource. J