[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Periodically sytnchronize Xen's wallclock time with NTP-synchronized time in domain0.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 3cfd8150da41166875bffc360ef67f3e63d95da3
# Parent  0989c353801c626be44b63f743832332fe8ed539
Periodically sytnchronize Xen's wallclock time with NTP-synchronized time in 
domain0.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 0989c353801c -r 3cfd8150da41 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Fri Feb 24 16:51:56 2006
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Sun Feb 26 15:48:51 2006
@@ -471,6 +471,39 @@
 
 EXPORT_SYMBOL(do_settimeofday);
 
+static void sync_xen_wallclock(unsigned long dummy);
+static struct timer_list sync_xen_wallclock_timer =
+       TIMER_INITIALIZER(sync_xen_wallclock, 0, 0);
+static void sync_xen_wallclock(unsigned long dummy)
+{
+       time_t sec;
+       s64 nsec;
+       dom0_op_t op;
+
+       if (((time_status & STA_UNSYNC) != 0) || 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);
+}
+
 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
 static int set_rtc_mmss(unsigned long nowtime)
 {
@@ -667,6 +700,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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.