This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [xen-devel] System time monotonicity

To: "dan.magenheimer@xxxxxxxxxx" <dan.magenheimer@xxxxxxxxxx>, Ian Pratt <Ian.Pratt@xxxxxxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [xen-devel] System time monotonicity
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Fri, 11 Apr 2008 07:48:36 +0100
Cc: Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>
Delivery-date: Thu, 10 Apr 2008 23:49:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080410152728281.00000004064@djm-pc>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-topic: [xen-devel] System time monotonicity
User-agent: Microsoft-Entourage/
On 10/4/08 22:27, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx> wrote:

> If you are not confident that this will be OK on existing and
> (within-reason) future Xen platforms, perhaps the hvm virtual
> platform timers should (at least optionally) be built on physical
> platform timers (Dave Winchell cc'ed), which would ensure time
> never goes backwards.

If we wanted to be more certain we could maintain a last_system_time fields
per VCPU and, whenever using system time to compute current value for a
virtual timer for an HVM VCPU, we could actually use max(system time,
last_system_time). This would mean we were 100% sure that time didn't go
backwards, by turning small backwards deltas into very short periods of
stalled time.

As it is: no, since system time 'free runs' on each CPU over one-second
periods, there can be drift between CPUs if they are driven by different
oscillators. Also there are tolerances in our software calibration code to
consider. Which is why Linux guests implement the max(curr time, last time)
in their gettimeofday() code. It would be quite reasonable to the same,
inside Xen, for HVM guests. We can at least be pretty certain that any
drifts across CPUs/VCPUs will be on the order of less than 100us.

 -- Keir

Xen-devel mailing list