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>
v->domain = d;
v->vcpu_id = vcpu_id;
- v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
- v->runstate.state_entry_time = NOW();
-
spin_lock_init(&v->virq_lock);
- if ( !is_idle_domain(d) )
+ if ( is_idle_domain(d) )
+ {
+ v->runstate.state = RUNSTATE_running;
+ }
+ else
{
+ v->runstate.state = RUNSTATE_offline;
+ v->runstate.state_entry_time = NOW();
set_bit(_VPF_down, &v->pause_flags);
v->vcpu_info = (void *)&shared_info(d, vcpu_info[vcpu_id]);
}