ia64/xen-unstable

changeset 10327:cca6641d4087

[HVM][PIT] Fix missed_ticks() logic.
Signed-off-by Xiaowei Yang <xiaowei.yang@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 07 13:42:21 2006 +0100 (2006-06-07)
parents 28128dafbe03
children f8af7041bf5b
files xen/arch/x86/hvm/intercept.c
line diff
     1.1 --- a/xen/arch/x86/hvm/intercept.c	Wed Jun 07 13:38:08 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/intercept.c	Wed Jun 07 13:42:21 2006 +0100
     1.3 @@ -216,13 +216,14 @@ void hlt_timer_fn(void *data)
     1.4  
     1.5  static __inline__ void missed_ticks(struct periodic_time *pt)
     1.6  {
     1.7 -    int missed_ticks;
     1.8 +    s_time_t missed_ticks;
     1.9  
    1.10 -    missed_ticks = (NOW() - pt->scheduled)/(s_time_t) pt->period;
    1.11 -    if ( missed_ticks++ >= 0 ) {
    1.12 +    missed_ticks = NOW() - pt->scheduled;
    1.13 +    if ( missed_ticks > 0 ) {
    1.14 +	missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
    1.15          if ( missed_ticks > 1000 ) {
    1.16              /* TODO: Adjust guest time togther */
    1.17 -            pt->pending_intr_nr ++;
    1.18 +            pt->pending_intr_nr++;
    1.19          }
    1.20          else {
    1.21              pt->pending_intr_nr += missed_ticks;
    1.22 @@ -237,6 +238,9 @@ void pt_timer_fn(void *data)
    1.23      struct vcpu *v = data;
    1.24      struct periodic_time *pt = &(v->domain->arch.hvm_domain.pl_time.periodic_tm);
    1.25  
    1.26 +    pt->pending_intr_nr++;
    1.27 +    pt->scheduled += pt->period;
    1.28 +
    1.29      /* pick up missed timer tick */
    1.30      missed_ticks(pt);
    1.31      if ( test_bit(_VCPUF_running, &v->vcpu_flags) ) {