diff -r eba9b07a15ec xen/common/schedule.c --- a/xen/common/schedule.c Mon Apr 12 14:55:06 2010 +0100 +++ b/xen/common/schedule.c Mon Apr 12 16:18:22 2010 +0100 @@ -837,6 +837,11 @@ next_slice.time); ASSERT(prev->runstate.state == RUNSTATE_running); + + TRACE_4D(TRC_SCHED_SWITCH, + prev->domain->domain_id, prev->vcpu_id, + next->domain->domain_id, next->vcpu_id); + vcpu_runstate_change( prev, (test_bit(_VPF_blocked, &prev->pause_flags) ? RUNSTATE_blocked : @@ -845,6 +850,9 @@ prev->last_run_time = now; ASSERT(next->runstate.state != RUNSTATE_running); + /* We don't any trace records betweeen here and the + * actual context switch, so that lost_records resume + * works properly. */ vcpu_runstate_change(next, RUNSTATE_running, now); ASSERT(!next->is_running); @@ -860,10 +868,6 @@ update_vcpu_system_time(next); vcpu_periodic_timer_work(next); - TRACE_4D(TRC_SCHED_SWITCH, - prev->domain->domain_id, prev->vcpu_id, - next->domain->domain_id, next->vcpu_id); - context_switch(prev, next); }