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-changelog

[Xen-changelog] [xen-3.2-testing] x86 time: Read platform time before lo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] x86 time: Read platform time before locally-extrapolated time during
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 May 2008 03:00:54 -0700
Delivery-date: Thu, 01 May 2008 07:48:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209633430 -3600
# Node ID 01615264bb88a0cc8c674c5cb0d30fb2862d33c0
# Parent  76815d93d8c9856c12905c5a463054ac01ec8722
x86 time: Read platform time before locally-extrapolated time during
calibration and frequency changes. This places the variable delay
(acquiring the platform_timer_lock) safely as the very first thing we
do, avoiding a variable delay /between/ computing the two timestamps.

Problem diagnosed by Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   17526:013a47065e8c4e815e3b1aba0883341c19238e82
xen-unstable date:        Thu May 01 09:45:44 2008 +0100
---
 xen/arch/x86/time.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff -r 76815d93d8c9 -r 01615264bb88 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Thu May 01 10:15:44 2008 +0100
+++ b/xen/arch/x86/time.c       Thu May 01 10:17:10 2008 +0100
@@ -738,12 +738,13 @@ int cpu_frequency_change(u64 freq)
     }
 
     local_irq_disable();
-    rdtscll(curr_tsc);
-    t->local_tsc_stamp = curr_tsc;
+    /* Platform time /first/, as we may be delayed by platform_timer_lock. */
     t->stime_master_stamp = read_platform_stime();
     /* TSC-extrapolated time may be bogus after frequency change. */
     /*t->stime_local_stamp = get_s_time();*/
     t->stime_local_stamp = t->stime_master_stamp;
+    rdtscll(curr_tsc);
+    t->local_tsc_stamp = curr_tsc;
     set_time_scale(&t->tsc_scale, freq);
     local_irq_enable();
 
@@ -813,11 +814,14 @@ static void local_time_calibration(void 
     prev_local_stime  = t->stime_local_stamp;
     prev_master_stime = t->stime_master_stamp;
 
-    /* Disable IRQs to get 'instantaneous' current timestamps. */
+    /*
+     * Disable IRQs to get 'instantaneous' current timestamps. We read platform
+     * time first, as we may be delayed when acquiring platform_timer_lock.
+     */
     local_irq_disable();
+    curr_master_stime = read_platform_stime();
+    curr_local_stime  = get_s_time();
     rdtscll(curr_tsc);
-    curr_local_stime  = get_s_time();
-    curr_master_stime = read_platform_stime();
     local_irq_enable();
 
 #if 0

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] x86 time: Read platform time before locally-extrapolated time during, Xen patchbot-3.2-testing <=