All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] Fix the slow wall clock time issue in x64 SMP Vista
@ 2007-01-10 11:29 Cui, Dexuan
  2007-01-10 11:36 ` Keir Fraser
  0 siblings, 1 reply; 10+ messages in thread
From: Cui, Dexuan @ 2007-01-10 11:29 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

In x64 SMP Vista HVM guest (vcpus=2 in the configuration file), the wall
clock time is 50% slower than that in the real world. The attached patch
fixes the issue.

-- Dexuan

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>

[-- Attachment #2: hpet.c.diff --]
[-- Type: application/octet-stream, Size: 1412 bytes --]

diff -r 3157b54eb465 xen/arch/x86/hvm/hpet.c
--- a/xen/arch/x86/hvm/hpet.c	Thu Jan 04 16:34:19 2007 +0000
+++ b/xen/arch/x86/hvm/hpet.c	Wed Jan 10 16:50:52 2007 +0800
@@ -144,7 +144,7 @@ static void hpet_stop_timer(HPETState *h
 
 static void hpet_set_timer(HPETState *h, unsigned int tn)
 {
-    uint64_t tn_cmp, cur_tick;
+    uint64_t tn_cmp, cur_tick, scheduled, passed;
 
     ASSERT(tn < HPET_TIMER_NUM);
     
@@ -167,11 +167,25 @@ static void hpet_set_timer(HPETState *h,
         cur_tick = (uint32_t)cur_tick;
     }
 
-    if ( (int64_t)(tn_cmp - cur_tick) > 0 )
-        set_timer(&h->timers[tn], NOW() +
-                  hpet_tick_to_ns(h, tn_cmp-cur_tick));
-    else
-        set_timer(&h->timers[tn], NOW());
+    scheduled = tn_cmp - cur_tick;
+    if ( (int64_t)scheduled < 0 )
+    {
+        passed = cur_tick - tn_cmp;
+
+         /* the number of HPET tick that stands for
+          * 1/(2^10) second, namely, 0.9765625 millisecond */
+        #define  hpet_tiny_time_span  (h->tsc_freq >> 10)
+        if ( passed < hpet_tiny_time_span )
+             scheduled = 0;
+        else
+        {
+            if ( timer_is_32bit(h, tn) )
+                scheduled = (uint32_t)scheduled;
+            else
+                scheduled = (uint64_t)scheduled;
+        }
+    }
+    set_timer(&h->timers[tn], NOW() + hpet_tick_to_ns(h, scheduled));
 }
 
 static inline uint64_t hpet_fixup_reg(

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-01-11 13:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10 11:29 [Patch] Fix the slow wall clock time issue in x64 SMP Vista Cui, Dexuan
2007-01-10 11:36 ` Keir Fraser
2007-01-10 11:53   ` Cui, Dexuan
2007-01-10 12:00     ` [Patch] Fix the slow wall clock time issue in x64 SMPVista Cui, Dexuan
2007-01-10 13:49       ` Keir Fraser
2007-01-10 12:02     ` [Patch] Fix the slow wall clock time issue in x64 SMP Vista Keir Fraser
2007-01-10 13:09       ` Cui, Dexuan
2007-01-10 13:45         ` Keir Fraser
2007-01-11 13:29         ` [Patch] Fix the slow wall clock time issue in x64 SMPVista Dong, Eddie
2007-01-10 14:42       ` [Patch] Fix the slow wall clock time issue in x64SMP Vista Dong, Eddie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.