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] NS_PER_TICK must be a s64 quantity. It is compared with

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] NS_PER_TICK must be a s64 quantity. It is compared with
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Oct 2005 12:30:17 +0000
Delivery-date: Thu, 13 Oct 2005 12:28:31 +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 9e373ffff3e659e665b6df702c44c1db3598742e
# Parent  48f542f8d906f988b6d7ffc0c5d44f5a9dfc8a31
NS_PER_TICK must be a s64 quantity. It is compared with
possibly -ve values which we do not want to 'promote' to
big +ve values.

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

diff -r 48f542f8d906 -r 9e373ffff3e6 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Thu Oct 13 07:06:27 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Thu Oct 13 07:38:49 2005
@@ -122,7 +122,8 @@
 static u64 processed_system_time;   /* System time (ns) at last processing. */
 static DEFINE_PER_CPU(u64, processed_system_time);
 
-#define NS_PER_TICK (1000000000ULL/HZ)
+/* Must be signed, as it's compared with s64 quantities which can be -ve. */
+#define NS_PER_TICK (1000000000LL/HZ)
 
 static inline void __normalize_time(time_t *sec, s64 *nsec)
 {
@@ -235,9 +236,9 @@
 
        /* Adjust wall-clock time base based on wall_jiffies ticks. */
        wc_nsec = processed_system_time;
-       wc_nsec += (u64)sec * 1000000000ULL;
-       wc_nsec += (u64)nsec;
-       wc_nsec -= (jiffies - wall_jiffies) * (u64)(NSEC_PER_SEC / HZ);
+       wc_nsec += sec * (u64)NSEC_PER_SEC;
+       wc_nsec += nsec;
+       wc_nsec -= (jiffies - wall_jiffies) * (u64)NS_PER_TICK;
 
        /* Split wallclock base into seconds and nanoseconds. */
        tmp = wc_nsec;
@@ -437,7 +438,7 @@
         * be stale, so we can retry with fresh ones.
         */
        for ( ; ; ) {
-               nsec = (s64)tv->tv_nsec - (s64)get_nsec_offset(shadow);
+               nsec = tv->tv_nsec - get_nsec_offset(shadow);
                if (time_values_up_to_date(cpu))
                        break;
                get_time_values_from_xen();
@@ -558,7 +559,7 @@
        }
        while (!time_values_up_to_date(cpu));
 
-       if (unlikely(delta < (s64)-1000000) || unlikely(delta_cpu < 0)) {
+       if (unlikely(delta < -1000000LL) || unlikely(delta_cpu < 0)) {
                printk("Timer ISR/%d: Time went backwards: "
                       "delta=%lld cpu_delta=%lld shadow=%lld "
                       "off=%lld processed=%lld cpu_processed=%lld\n",
@@ -802,7 +803,7 @@
                 * but that's ok: we'll just end up with a shorter timeout. */
                if (delta < 1) 
                        delta = 1;
-               st = processed_system_time + ((u64)delta * NS_PER_TICK);
+               st = processed_system_time + (delta * (u64)NS_PER_TICK);
        } while (read_seqretry(&xtime_lock, seq));
 
        return st;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] NS_PER_TICK must be a s64 quantity. It is compared with, Xen patchbot -unstable <=