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] Fix wallclock timebase extraction in XenLinux.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix wallclock timebase extraction in XenLinux.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Jul 2005 05:26:09 -0400
Delivery-date: Tue, 19 Jul 2005 09:26:37 +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 2ecb91fb6cdbdfa001a48bc2bb2b1db320a19485
# Parent  bf68b5fcbc9bc2673ce19817c01e362fc18af6fe

Fix wallclock timebase extraction in XenLinux.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r bf68b5fcbc9b -r 2ecb91fb6cdb 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Jul 19 08:52:32 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Jul 19 09:26:18 2005
@@ -227,9 +227,9 @@
 static void update_wallclock(void)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
-       long wtm_nsec;
-       time_t wtm_sec, sec;
-       s64 nsec;
+       long wtm_nsec, xtime_nsec;
+       time_t wtm_sec, xtime_sec;
+       u64 tmp, usec;
 
        shadow_tv.tv_sec  = s->wc_sec;
        shadow_tv.tv_usec = s->wc_usec;
@@ -240,20 +240,22 @@
        if ((time_status & STA_UNSYNC) != 0)
                return;
 
-       /* Adjust shadow for jiffies that haven't updated xtime yet. */
-       shadow_tv.tv_usec -= 
-               (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ);
-       HANDLE_USEC_UNDERFLOW(shadow_tv);
-
-       /* Update our unsynchronised xtime appropriately. */
-       sec = shadow_tv.tv_sec;
-       nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
-
-       __normalize_time(&sec, &nsec);
-       wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
-       wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
-
-       set_normalized_timespec(&xtime, sec, nsec);
+       /* Adjust wall-clock time base based on wall_jiffies ticks. */
+       usec = processed_system_time;
+       do_div(usec, 1000);
+       usec += (u64)shadow_tv.tv_sec * 1000000ULL;
+       usec += (u64)shadow_tv.tv_usec;
+       usec -= (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ);
+
+       /* Split wallclock base into seconds and nanoseconds. */
+       tmp = usec;
+       xtime_nsec = do_div(tmp, 1000000) * 1000ULL;
+       xtime_sec  = (time_t)tmp;
+
+       wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - xtime_sec);
+       wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - xtime_nsec);
+
+       set_normalized_timespec(&xtime, xtime_sec, xtime_nsec);
        set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix wallclock timebase extraction in XenLinux., Xen patchbot -unstable <=