aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-28 11:33:28 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-28 11:33:28 +0100
commit42bcbe769e71ec55daf48277c91119cbd3d53096 (patch)
treef124d8fea3663dbac5da0dcffc8a636650075320
parent5589b0008c2bb9992ed6b76ebf7123bd73d75b56 (diff)
downloadxen-42bcbe769e71ec55daf48277c91119cbd3d53096.tar.gz
xen-42bcbe769e71ec55daf48277c91119cbd3d53096.tar.bz2
xen-42bcbe769e71ec55daf48277c91119cbd3d53096.zip
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@oracle.com>
-rw-r--r--xen/arch/x86/time.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 72f1c4a6c1..570a630884 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -35,7 +35,8 @@
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 *unused)
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). */