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] Periodically sytnchronize Xen's wallclock time with NTP-

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Periodically sytnchronize Xen's wallclock time with NTP-synchronized time in domain0.
From: Xen patchbot -3.0-testing <patchbot-3.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Feb 2006 20:42:15 +0000
Delivery-date: Sun, 26 Feb 2006 20:42:32 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 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

<Prev in Thread] Current Thread [Next in Thread>