ia64/xen-unstable
changeset 16536:89e7031e153c
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@intel.com>
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@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Wed Dec 05 14:01:39 2007 +0000 (2007-12-05) |
parents | c67d024fdd2d |
children | bf21e00155b7 |
files | xen/arch/x86/hvm/vlapic.c |
line diff
1.1 --- a/xen/arch/x86/hvm/vlapic.c Wed Dec 05 13:49:19 2007 +0000 1.2 +++ b/xen/arch/x86/hvm/vlapic.c Wed Dec 05 14:01:39 2007 +0000 1.3 @@ -430,9 +430,9 @@ static uint32_t vlapic_get_tmcct(struct 1.4 uint32_t tmcct, tmict = vlapic_get_reg(vlapic, APIC_TMICT); 1.5 uint64_t counter_passed; 1.6 1.7 - counter_passed = (hvm_get_guest_time(v) - vlapic->timer_last_update) // TSC 1.8 - * 1000000000ULL / ticks_per_sec(v) // NS 1.9 - / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor; 1.10 + counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update) 1.11 + * 1000000000ULL / ticks_per_sec(v) 1.12 + / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor); 1.13 tmcct = tmict - counter_passed; 1.14 1.15 HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, 1.16 @@ -668,6 +668,7 @@ static void vlapic_write(struct vcpu *v, 1.17 create_periodic_time(current, &vlapic->pt, period, vlapic->pt.irq, 1.18 !vlapic_lvtt_period(vlapic), vlapic_pt_cb, 1.19 &vlapic->timer_last_update); 1.20 + vlapic->timer_last_update = vlapic->pt.last_plt_gtime; 1.21 1.22 HVM_DBG_LOG(DBG_LEVEL_VLAPIC, 1.23 "bus cycle is %uns, " 1.24 @@ -831,6 +832,7 @@ static void lapic_rearm(struct vlapic *s 1.25 create_periodic_time(vlapic_vcpu(s), &s->pt, period, s->pt.irq, 1.26 !vlapic_lvtt_period(s), vlapic_pt_cb, 1.27 &s->timer_last_update); 1.28 + s->timer_last_update = s->pt.last_plt_gtime; 1.29 1.30 printk("lapic_load to rearm the actimer:" 1.31 "bus cycle is %uns, "