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] write_tsc in a PV domain?

To: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] write_tsc in a PV domain?
From: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Aug 2009 09:48:17 +0100
Cc: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, "Xen-Devel \(E-mail\)" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Thu, 27 Aug 2009 01:47:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4A95B789.6020604@xxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <e519f01b-b609-42a2-8636-45eee4fad8a7@default> <4A95B789.6020604@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> as part of its ABI.  It is not a general tsc.  You can't meaningfully
> execute "rdtsc" without also being (indirectly) aware of what pcpu its
> running on and applying the appropriate corrections to turn it into
> system monotonic time.  Executing rdtsc willy-nilly gets you useless
> results; fortunately no PV Xen kernel does that.

Actually for user space this isn't at all true. You can use rdtsc
directly and sample the data for things like profiling then correct for
things like spikes and skews from processor switches by filtering.

> No, write_tsc is meaningless, and anyone trying to execute it is not
> even wrong.

Writing to the tsc is perfectly reasonable providing the tsc is an
advertised feature. Being able to use the tsc becomes much more relevant
with newer processors which have sane tsc implementations in the
architecture however.

Unfortunately if you hide the tsc and hide the tsc flag in the cpu info
lots of stuff doesn't run due to crap coding 8(

Xen-devel mailing list