WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Time drift between values returned by TSC and gettimeofday

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Time drift between values returned by TSC and gettimeofday
From: Priya <pbhat@xxxxxxxxxxxx>
Date: Tue, 23 Feb 2010 13:48:13 -0500
Delivery-date: Tue, 23 Feb 2010 10:48:52 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=nRqVFJNkv5qjCC7uChrvltc6jLnCeHWIT3H33G0LSek=; b=ugjTU1svTsYZtOcpK49fe9OfkdcdSbLlr83vMYw0G1kqfLLpGTL0sLBDWtJ3wvP6EU Z3xEzl7WmK0CMlg7F/JiBUCSYo+pPx0qLi+lAU7HU0GxP4Wu67m6d9h0l9lKl5GPJwO4 NLnIJKZEQJ1s5frh4rzPGA6ex5oMtWsQG4OCE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=F+ywu+v/LFrHjB6r4HCiKev8sQ4DCl5e9/y0K1xTP8Ux9DYJl/lAHTqmTt1TbzInw/ JEN7ET3/0iTcub6EkwnBgJ+04M5Q3hdAFlAWU3Qzmt0t6y9NlkOFPbP4M5a23LIAvDKT IJcACEjX3nVSg4AW2HUW/z8GWwMn0BEIFYSC4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hey guys,

I have made an interesting (and unexpected) observation in relation to the drift between the (system) time returned by gettimeofday() system call and time obtained from time stamp counter (defined as TSC reading divided by CPU frequency). I was wondering if anyone could help me explain this:

Let me first explain my system: I have 3 Hardware based vitual machines (HVMs) running on Linux  2.6.24-26-generic (tickless) kernel. The timer mode is 1 (default, virtual time is always wallclock time). I ran an experiment in which I compared the difference between  the values retured by rdtsc() and gettimeofday on the three domains against realtime (from a third independent source). There is no NTP sync on either the control domain or any of the user domains. The scheduler weights and cap values for all domains (domain-0 and user domains) are default 256 and 0 respectively.

I observe that:
  1. Over time the drift between TSC-time and gettimeofday time increases (at a constant rate). This is expected because considering that TSC and gettimeofday are supposed to derive their values from different physical counters there will be some drift.
  2. But what is suprising is that the rate is different on all three domains. Now this is something that is puzzling me.
If I understand the virtualization architecture correctly, read shadows are created for each user domain which are updated by domain-0. Read access to TSC will return a value from these shadow tables.

And since I am using the timer mode = 1 , I expect that system time will also be same on all domains. Which means that time difference between TSC time and system time should increase by the same amount on all domains which is not what I observe.

Can some body give me a pointer to what I am missing here. Has anyone else observed this behavior?

Thanks!
--pr

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Time drift between values returned by TSC and gettimeofday, Priya <=