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-devel

Re: [Xen-devel] [PATCH 0/2] Improve hpet accuracy

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 0/2] Improve hpet accuracy
From: Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>
Date: Tue, 10 Jun 2008 13:13:56 -0400
Cc: dan.magenheimer@xxxxxxxxxx, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
Delivery-date: Tue, 10 Jun 2008 10:13:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C474353A.21E15%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C474353A.21E15%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)
Keir, Dan:

Although I plan to break up the patch, etc., I'm posting
this fix to the patch for anyone who might be interested.

thanks,
Dave
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2008/06/10 12:20:48-04:00 winchell@xxxxxxxxxxxxxxxxxxxxxxxxxx 
#   vi-patch: xen-hpet
#   
#   Bug Id: 6057 
#   
#   Reviewed by: Robert
#   
#   SUMMARY: Fix wrap issue in monotonic s_time().
# 
# xen/arch/x86/time.c
#   2008/06/10 12:20:48-04:00 winchell@xxxxxxxxxxxxxxxxxxxxxxxxxx +3 -2
#   Fix wrap issue in monotonic s_time().
# 
diff -Nru a/xen/arch/x86/time.c b/xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       2008-06-10 13:08:39 -04:00
+++ b/xen/arch/x86/time.c       2008-06-10 13:08:39 -04:00
@@ -534,7 +534,7 @@
     u64 count;
     unsigned long flags;
     struct cpu_time *t = &this_cpu(cpu_time);
-    u64 tsc, delta;
+    u64 tsc, delta, diff;
     s_time_t now;
 
     if(hpet_main_counter_phys_avoid_hdw || !hpet_physical_inited) {
@@ -542,7 +542,8 @@
         rdtscll(tsc);
         delta = tsc - t->local_tsc_stamp;
         now = t->stime_local_stamp + scale_delta(delta, &t->tsc_scale);
-        if(now > get_s_time_mon.last_ret)
+        diff = (u64)now - (u64)get_s_time_mon.last_ret;
+        if((s64)diff > (s64)0)
             get_s_time_mon.last_ret = now;
         else
             now = get_s_time_mon.last_ret;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel