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-unstable] x86: Roughly synchronise calls to local_t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Roughly synchronise calls to local_time_calibration().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Jul 2008 08:10:18 -0700
Delivery-date: Mon, 28 Jul 2008 08:10:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 1217241208 -3600
# Node ID b47e503f3282f34304142f4ebc2983ab4cf9e416
# Parent  13690b68fd462c6fe4751c2cc12d50cef71c339b
x86: Roughly synchronise calls to local_time_calibration().

This results in reduced skew; both max and average skew are reduced by
between a factor of 2 and 3.  Note that timers still fire at slightly
different times because the next "round epoch" is still relative to
local stime which still has some inter-processor skew.

Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
---
 xen/arch/x86/time.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -r 13690b68fd46 -r b47e503f3282 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Mon Jul 28 11:29:23 2008 +0100
+++ b/xen/arch/x86/time.c       Mon Jul 28 11:33:28 2008 +0100
@@ -35,7 +35,8 @@ static char opt_clocksource[10];
 static char opt_clocksource[10];
 string_param("clocksource", opt_clocksource);
 
-#define EPOCH MILLISECS(1000)
+#define EPOCH (1ULL << 30) /* one second, rounded up to a power of two */
+#define NEXT_EPOCH(now) (((now) + (EPOCH+(EPOCH/2))) & ~(EPOCH-1))
 
 unsigned long cpu_khz;  /* CPU clock frequency in kHz. */
 DEFINE_SPINLOCK(rtc_lock);
@@ -1021,7 +1022,7 @@ static void local_time_calibration(void 
     update_vcpu_system_time(current);
 
  out:
-    set_timer(&t->calibration_timer, NOW() + EPOCH);
+    set_timer(&t->calibration_timer, NEXT_EPOCH(curr_local_stime));
 
     if ( smp_processor_id() == 0 )
         platform_time_calibration();
@@ -1050,7 +1051,7 @@ void init_percpu_time(void)
  out:
     init_timer(&t->calibration_timer, local_time_calibration,
                NULL, smp_processor_id());
-    set_timer(&t->calibration_timer, NOW() + EPOCH);
+    set_timer(&t->calibration_timer, NEXT_EPOCH(NOW()));
 }
 
 /* Late init function (after all CPUs are booted). */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Roughly synchronise calls to local_time_calibration()., Xen patchbot-unstable <=