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-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Initialize vlapic->timer_last_update.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 05 Dec 2007 16:20:18 -0800
Delivery-date: Wed, 05 Dec 2007 16:21:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Initialize vlapic->timer_last_update., Xen patchbot-unstable <=