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