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

[Xen-changelog] [xen-unstable] [HVM] Remove HVM halt timer. It's no longer needed since interrupts



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5a4517468f4f7341eef9d20d4959187a7f2f2267
# Parent  2d20b54322535f8d64696e3b7f0feaf2207a244b
[HVM] Remove HVM halt timer. It's no longer needed since interrupts
can wake it up now.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c         |   14 --------------
 xen/arch/x86/hvm/intercept.c   |   18 +++++++-----------
 xen/arch/x86/hvm/svm/svm.c     |    9 +++++----
 xen/arch/x86/hvm/vlapic.c      |    2 ++
 xen/arch/x86/hvm/vmx/vmx.c     |    9 +++++----
 xen/include/asm-x86/hvm/vcpu.h |    3 ---
 6 files changed, 19 insertions(+), 36 deletions(-)

diff -r 2d20b5432253 -r 5a4517468f4f xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Fri Nov 10 11:01:15 2006 +0000
@@ -176,8 +176,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
         get_vio(v->domain, v->vcpu_id)->vp_eport =
             v->arch.hvm_vcpu.xen_port;
 
-    init_timer(&v->arch.hvm_vcpu.hlt_timer, hlt_timer_fn, v, v->processor);
-
     if ( v->vcpu_id != 0 )
         return 0;
 
@@ -198,7 +196,6 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
-    kill_timer(&v->arch.hvm_vcpu.hlt_timer);
     vlapic_destroy(v);
     hvm_funcs.vcpu_destroy(v);
 
@@ -272,10 +269,6 @@ static void hvm_vcpu_down(void)
 
 void hvm_hlt(unsigned long rflags)
 {
-    struct vcpu *v = current;
-    struct periodic_time *pt = &v->domain->arch.hvm_domain.pl_time.periodic_tm;
-    s_time_t next_pt = -1, next_wakeup;
-
     /*
      * If we halt with interrupts disabled, that's a pretty sure sign that we
      * want to shut down. In a real processor, NMIs are the only way to break
@@ -284,13 +277,6 @@ void hvm_hlt(unsigned long rflags)
     if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
         return hvm_vcpu_down();
 
-    if ( !v->vcpu_id )
-        next_pt = get_scheduled(v, pt->irq, pt);
-    next_wakeup = get_apictime_scheduled(v);
-    if ( (next_pt != -1 && next_pt < next_wakeup) || next_wakeup == -1 )
-        next_wakeup = next_pt;
-    if ( next_wakeup != - 1 ) 
-        set_timer(&current->arch.hvm_vcpu.hlt_timer, next_wakeup);
     do_sched_op_compat(SCHEDOP_block, 0);
 }
 
diff -r 2d20b5432253 -r 5a4517468f4f xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c      Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/arch/x86/hvm/intercept.c      Fri Nov 10 11:01:15 2006 +0000
@@ -268,13 +268,6 @@ int register_io_handler(
     return 1;
 }
 
-/* Hook function for the HLT instruction emulation wakeup. */
-void hlt_timer_fn(void *data)
-{
-    struct vcpu *v = data;
-    vcpu_kick(v);
-}
-
 static __inline__ void missed_ticks(struct periodic_time *pt)
 {
     s_time_t missed_ticks;
@@ -297,16 +290,19 @@ void pt_timer_fn(void *data)
 void pt_timer_fn(void *data)
 {
     struct vcpu *v = data;
-    struct periodic_time *pt = 
&(v->domain->arch.hvm_domain.pl_time.periodic_tm);
+    struct periodic_time *pt = &v->domain->arch.hvm_domain.pl_time.periodic_tm;
 
     pt->pending_intr_nr++;
     pt->scheduled += pt->period;
 
-    /* pick up missed timer tick */
+    /* Pick up missed timer ticks. */
     missed_ticks(pt);
-    if ( test_bit(_VCPUF_running, &v->vcpu_flags) ) {
+
+    /* No need to run the timer while a VCPU is descheduled. */
+    if ( test_bit(_VCPUF_running, &v->vcpu_flags) )
         set_timer(&pt->timer, pt->scheduled);
-    }
+
+    vcpu_kick(v);
 }
 
 /* pick up missed timer ticks at deactive time */
diff -r 2d20b5432253 -r 5a4517468f4f xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Nov 10 11:01:15 2006 +0000
@@ -712,11 +712,13 @@ static void svm_freeze_time(struct vcpu 
 static void svm_freeze_time(struct vcpu *v)
 {
     struct periodic_time *pt=&v->domain->arch.hvm_domain.pl_time.periodic_tm;
-    
-    if ( pt->enabled && pt->first_injected && v->vcpu_id == pt->bind_vcpu 
+
+    if ( pt->enabled && pt->first_injected
+            && (v->vcpu_id == pt->bind_vcpu)
             && !v->arch.hvm_vcpu.guest_time ) {
         v->arch.hvm_vcpu.guest_time = hvm_get_guest_time(v);
-        stop_timer(&(pt->timer));
+        if ( test_bit(_VCPUF_blocked, &v->vcpu_flags) )
+            stop_timer(&pt->timer);
     }
 }
 
@@ -853,7 +855,6 @@ static void svm_migrate_timers(struct vc
     if ( pt->enabled )
     {
         migrate_timer(&pt->timer, v->processor);
-        migrate_timer(&v->arch.hvm_vcpu.hlt_timer, v->processor);
     }
     migrate_timer(&vcpu_vlapic(v)->vlapic_timer, v->processor);
     migrate_timer(&vrtc->second_timer, v->processor);
diff -r 2d20b5432253 -r 5a4517468f4f xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Fri Nov 10 11:01:15 2006 +0000
@@ -835,6 +835,8 @@ void vlapic_timer_fn(void *data)
     else
         vlapic_set_reg(vlapic, APIC_TMCCT, 0);
 
+    vcpu_kick(vlapic_vcpu(vlapic));
+
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
                 "now 0x%016"PRIx64", expire @ 0x%016"PRIx64", "
                 "timer initial count 0x%x, timer current count 0x%x.",
diff -r 2d20b5432253 -r 5a4517468f4f xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Nov 10 11:01:15 2006 +0000
@@ -368,11 +368,13 @@ static void vmx_freeze_time(struct vcpu 
 static void vmx_freeze_time(struct vcpu *v)
 {
     struct periodic_time *pt=&v->domain->arch.hvm_domain.pl_time.periodic_tm;
-    
-    if ( pt->enabled && pt->first_injected && v->vcpu_id == pt->bind_vcpu
+
+    if ( pt->enabled && pt->first_injected
+            && (v->vcpu_id == pt->bind_vcpu)
             && !v->arch.hvm_vcpu.guest_time ) {
         v->arch.hvm_vcpu.guest_time = hvm_get_guest_time(v);
-        stop_timer(&(pt->timer));
+        if ( !test_bit(_VCPUF_blocked, &v->vcpu_flags) )
+            stop_timer(&pt->timer);
     }
 }
 
@@ -407,7 +409,6 @@ void vmx_migrate_timers(struct vcpu *v)
     if ( pt->enabled )
     {
         migrate_timer(&pt->timer, v->processor);
-        migrate_timer(&v->arch.hvm_vcpu.hlt_timer, v->processor);
     }
     migrate_timer(&vcpu_vlapic(v)->vlapic_timer, v->processor);
     migrate_timer(&vrtc->second_timer, v->processor);
diff -r 2d20b5432253 -r 5a4517468f4f xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h    Fri Nov 10 10:31:29 2006 +0000
+++ b/xen/include/asm-x86/hvm/vcpu.h    Fri Nov 10 11:01:15 2006 +0000
@@ -44,9 +44,6 @@ struct hvm_vcpu {
     /* Flags */
     int                 flag_dr_dirty;
 
-    /* hlt ins emulation wakeup timer */
-    struct timer        hlt_timer;
-
     unsigned long       hvm_trace_values[5];
 
     union {

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


 


Rackspace

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