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" <dan.magenheimer@xxxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [xen-devel] System time monotonicity
From: "Ian Pratt" <Ian.Pratt@xxxxxxxxxxxxx>
Date: Wed, 9 Apr 2008 13:42:41 +0100
Cc: Ian Pratt <Ian.Pratt@xxxxxxxxxxxxx>
Delivery-date: Wed, 09 Apr 2008 05:43:25 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20080408195504234.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>
References: <D470B4E54465E3469E2ABBC5AFAC390F024D9192@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20080408195504234.00000004064@djm-pc>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-topic: [xen-devel] System time monotonicity
> > The issue comes with cpus running on different frequency, like
> > by multiple crystals or on-demand frequency change which affects TSC
> > too. HVM guest can be configured to avoid migrating among cpus with
> > different TSC freq, like limiting its cpu affinity to cpus on same
> > system bus.
> These are the cases I am worried about.  The linux kernel seems to
> a number of cases that mark TSC as unstable, but Xen does not, nor (I
> think) does Xen expose this information anywhere.  So it seems SMP
> guests need to be pinned to physical CPUs that are measured to have
> sync'ed TSC's to guarantee that the (virtual) platform timer is
> monotonic.

Xen itself copes fine with CPUs running from entirely independent clock
sources. It calibrates the TSCs frequency against a global clock (e.g.
the hpet).

> > Or you have to configure HVM guest to not trust TSC...
> Yes, that's what I'm thinking... like Linux, Xen could/should build
> virtual platform timers on a physical clocksource other than tsc if
> of the potential vcpu->pcpu mappings are not on sync'd-TSC-pcpus.

Although Xen is fine, guests can get confused if they're relying on the
TSC. Fortunately, Windows doesn't rely on the TSC, and most folk run
Linux PV which also works fine.

If you want to make Linux work HVM on such a system you need to either
convince it to not to use the TSC, or arrange for TSC reads to trap to
Xen and then compute the result based on Xen's time base. If you're
doing the latter, better hope that TSC reads aren't called frequently...


Xen-devel mailing list