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

[Xen-changelog] [xen-unstable] hvm: Initialize vlapic->timer_last_update.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196863299 0
# Node ID 89e7031e153c62b9ce223a58a7ba49df285784a7
# Parent  c67d024fdd2d3527ccd08e513ca3ed3c9dcb4b68
hvm: Initialize vlapic->timer_last_update.

Without the fix, before the first vlapic timer interrupt is injected,
the "vlapic->timer_last_update" in vlapic_get_tmcct()  is always 0,
causing a wrong value of counter_passed.

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 xen/arch/x86/hvm/vlapic.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff -r c67d024fdd2d -r 89e7031e153c xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Wed Dec 05 13:49:19 2007 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Wed Dec 05 14:01:39 2007 +0000
@@ -430,9 +430,9 @@ static uint32_t vlapic_get_tmcct(struct 
     uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT);
     uint64_t counter_passed;
 
-    counter_passed = (hvm_get_guest_time(v) - vlapic->timer_last_update) // TSC
-                     * 1000000000ULL / ticks_per_sec(v) // NS
-                     / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor;
+    counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update)
+                      * 1000000000ULL / ticks_per_sec(v)
+                      / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor);
     tmcct = tmict - counter_passed;
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER,
@@ -668,6 +668,7 @@ static void vlapic_write(struct vcpu *v,
         create_periodic_time(current, &vlapic->pt, period, vlapic->pt.irq,
                              !vlapic_lvtt_period(vlapic), vlapic_pt_cb,
                              &vlapic->timer_last_update);
+        vlapic->timer_last_update = vlapic->pt.last_plt_gtime;
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
                     "bus cycle is %uns, "
@@ -831,6 +832,7 @@ static void lapic_rearm(struct vlapic *s
         create_periodic_time(vlapic_vcpu(s), &s->pt, period, s->pt.irq,
                              !vlapic_lvtt_period(s), vlapic_pt_cb,
                              &s->timer_last_update);
+        s->timer_last_update = s->pt.last_plt_gtime;
 
         printk("lapic_load to rearm the actimer:"
                "bus cycle is %uns, "

_______________________________________________
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®.