|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] Periodically sytnchronize Xen's wallclock time with NTP-
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5541ea99106a32d2b11809bf4d3366dc6eddb93d
# Parent af6a564ea81c9cfde03d728d691bbe27086bdd7a
Periodically sytnchronize Xen's wallclock time with NTP-synchronized time in
domain0.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r af6a564ea81c -r 5541ea99106a
linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Sun Feb 26 09:55:21 2006
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c Sun Feb 26 15:38:59 2006
@@ -487,14 +487,45 @@
EXPORT_SYMBOL(do_settimeofday);
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+static void sync_xen_wallclock(unsigned long dummy);
+static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0);
+static void sync_xen_wallclock(unsigned long dummy)
+{
+ time_t sec;
+ s64 nsec;
+ dom0_op_t op;
+
+ if (!ntp_synced() || independent_wallclock ||
+ !(xen_start_info->flags & SIF_INITDOMAIN))
+ return;
+
+ write_seqlock_irq(&xtime_lock);
+
+ sec = xtime.tv_sec;
+ nsec = xtime.tv_nsec + ((jiffies - wall_jiffies) * (u64)NS_PER_TICK);
+ __normalize_time(&sec, &nsec);
+
+ op.cmd = DOM0_SETTIME;
+ op.u.settime.secs = sec;
+ op.u.settime.nsecs = nsec;
+ op.u.settime.system_time = processed_system_time;
+ HYPERVISOR_dom0_op(&op);
+
+ update_wallclock();
+
+ write_sequnlock_irq(&xtime_lock);
+
+ /* Once per minute. */
+ mod_timer(&sync_xen_wallclock_timer, jiffies + 60*HZ);
+}
+
static int set_rtc_mmss(unsigned long nowtime)
{
int retval;
WARN_ON(irqs_disabled());
- if (!(xen_start_info->flags & SIF_INITDOMAIN))
+ if (independent_wallclock || !(xen_start_info->flags & SIF_INITDOMAIN))
return 0;
/* gets recalled with irq locally disabled */
@@ -507,12 +538,6 @@
return retval;
}
-#else
-static int set_rtc_mmss(unsigned long nowtime)
-{
- return 0;
-}
-#endif
/* monotonic_clock(): returns # of nanoseconds passed since time_init()
* Note: This function is required to return accurate
@@ -768,6 +793,7 @@
void notify_arch_cmos_timer(void)
{
mod_timer(&sync_cmos_timer, jiffies + 1);
+ mod_timer(&sync_xen_wallclock_timer, jiffies + 1);
}
static long clock_cmos_diff, sleep_start;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
|
|
|
|