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

Re: [Xen-devel] xen PIT timer

To: Ryan Harper <ryanh@xxxxxxxxxx>
Subject: Re: [Xen-devel] xen PIT timer
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Sat, 24 Sep 2005 08:48:59 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Sat, 24 Sep 2005 07:55:20 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20050923194907.GA330@xxxxxxxxxx>
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: <20050923194907.GA330@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 23 Sep 2005, at 20:49, Ryan Harper wrote:

Why does Xen chose to use mode 0, on PIT CH2 for calculating how much
time has passed rather than how Linux using PIT_CH0 in mode 2?  Are
there some trade offs?

The way we track time in Xen is completely different to Linux. Linux tracks time off periodic interrupts from PIT_CH0: initially assuming each tick is 10ms but allowing that to be trimmed by adjtimex if ntpd is running.

Xen only uses PIT_CH0 as a fallback timer on uniprocessor systems with no local APIC: aprt from that it is basically unused. Xen doesn't rely on fixed periodic interrupts -- instead programming the local APIC timer to the next event of interest. We track time by assuming the PIT crystal is a precise 1.119380Mhz source: we can therefore measure the passage of time by reading how far PIT_CH2 has decremented and perform a multiplication. To more quickly estimate the passage of time, each CPU calibrates its local APIC oscillator to PIT_CH2 -- we can then estimate time-of-day with a RDTSC instruction + multiplication.

The main problem with using PIT as platform timer is that the counters are only 16 bits. We therefore periodically (every few 10s of ms) read the PIT_CH2 delta out into a wider 64-bit variable.

 -- Keir


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>