[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.