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

[Xen-devel] [PATCH 2/2] range timer: useage

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 2/2] range timer: useage
From: "Yu, Ke" <ke.yu@xxxxxxxxx>
Date: Tue, 28 Oct 2008 14:58:53 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>, "Tian, Kevin" <kevin.tian@xxxxxxxxx>, "Wei, Gang" <gang.wei@xxxxxxxxx>
Delivery-date: Mon, 27 Oct 2008 23:59:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ack4yqOGkmDgMk0hToSRAWTxlhn7SQ==
Thread-topic: [PATCH 2/2] range timer: useage
apply range timer to HVM virtual periodic timer and platform time overflow timer

Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>

diff -r 451e20f880a0 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -24,6 +24,8 @@
 
 #define mode_is(d, name) \
     ((d)->arch.hvm_domain.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name)
+
+#define MIN(x,y)    (((x)<(y))?(x):(y))
 
 void hvm_init_guest_time(struct domain *d)
 {
@@ -185,7 +187,8 @@ void pt_restore_timer(struct vcpu *v)
     list_for_each_entry ( pt, head, list )
     {
         pt_process_missed_ticks(pt);
-        set_timer(&pt->timer, pt->scheduled);
+        set_range_timer( &pt->timer, pt->scheduled,
+                pt->scheduled + MIN(pt->period/8, MILLISECS(1)) );
     }
 
     pt_thaw_time(v);
@@ -206,7 +209,8 @@ static void pt_timer_fn(void *data)
     {
         pt->scheduled += pt->period;
         pt_process_missed_ticks(pt);
-        set_timer(&pt->timer, pt->scheduled);
+        set_range_timer( &pt->timer, pt->scheduled,
+                pt->scheduled + MIN(pt->period/8, MILLISECS(1)) );
     }
 
     vcpu_kick(pt->vcpu);
@@ -335,7 +339,8 @@ void pt_reset(struct vcpu *v)
         pt->pending_intr_nr = 0;
         pt->last_plt_gtime = hvm_get_guest_time(pt->vcpu);
         pt->scheduled = NOW() + pt->period;
-        set_timer(&pt->timer, pt->scheduled);
+        set_range_timer(&pt->timer, pt->scheduled,
+                pt->scheduled + MIN(pt->period/8, MILLISECS(1)) );
     }
 
     spin_unlock(&v->arch.hvm_vcpu.tm_lock);
@@ -398,7 +403,8 @@ void create_periodic_time(
     list_add(&pt->list, &v->arch.hvm_vcpu.tm_list);
 
     init_timer(&pt->timer, pt_timer_fn, pt, v->processor);
-    set_timer(&pt->timer, pt->scheduled);
+    set_range_timer( &pt->timer, pt->scheduled,
+            pt->scheduled + MIN(pt->period/8, MILLISECS(1)) );
 
     spin_unlock(&v->arch.hvm_vcpu.tm_lock);
 }
diff -r 451e20f880a0 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -508,7 +508,9 @@ static void plt_overflow(void *unused)
     plt_stamp = count;
     spin_unlock_irq(&platform_timer_lock);
 
-    set_timer(&plt_overflow_timer, NOW() + plt_overflow_period);
+    set_range_timer( &plt_overflow_timer,
+            NOW() + plt_overflow_period - plt_overflow_period/8,
+            NOW() + plt_overflow_period );
 }
 
 static s_time_t __read_platform_stime(u64 platform_time)

Attachment: range-timer-use.patch
Description: range-timer-use.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 2/2] range timer: useage, Yu, Ke <=