ia64/xen-unstable

changeset 18907:2a349db39496

Initialize state_entry_time to zero for all idle vcpus

NOW() is not usable since xen time sub-system hasn't
been initialized yet. On my box, it gives a initial
stamp ~60s due to local tsc stamp as zero and TSC
count is started from power on. Then a negative value
is added to runstate of that idle vcpu at schedule
point. The net effect is for some tool like xenpm
to show a big idle time gap between BSP and other APs.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 10 13:41:34 2008 +0000 (2008-12-10)
parents 415a69b41397
children 6401c9533ef5
files xen/common/domain.c
line diff
     1.1 --- a/xen/common/domain.c	Wed Dec 10 13:30:10 2008 +0000
     1.2 +++ b/xen/common/domain.c	Wed Dec 10 13:41:34 2008 +0000
     1.3 @@ -144,13 +144,16 @@ struct vcpu *alloc_vcpu(
     1.4      v->domain = d;
     1.5      v->vcpu_id = vcpu_id;
     1.6  
     1.7 -    v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
     1.8 -    v->runstate.state_entry_time = NOW();
     1.9 -
    1.10      spin_lock_init(&v->virq_lock);
    1.11  
    1.12 -    if ( !is_idle_domain(d) )
    1.13 +    if ( is_idle_domain(d) )
    1.14      {
    1.15 +        v->runstate.state = RUNSTATE_running;
    1.16 +    }
    1.17 +    else
    1.18 +    {
    1.19 +        v->runstate.state = RUNSTATE_offline;        
    1.20 +        v->runstate.state_entry_time = NOW();
    1.21          set_bit(_VPF_down, &v->pause_flags);
    1.22          v->vcpu_info = (void *)&shared_info(d, vcpu_info[vcpu_id]);
    1.23      }