debuggers.hg

changeset 21198:9471200daee4

xentrace: fix lost records resume

Reorder the SCHED_SWITCH trace before the runstate change trace to fix
a problem with the lost records "resume" code.

Namely: The "lost records" trace includes the currently running
process. But during SCHED_SWITCH, it reads the wrong value, confusing
xenalyze. Making sure there are no trace records between runstate
change trace and the actual context switch fixes it.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Apr 12 18:28:33 2010 +0100 (2010-04-12)
parents 94cae4dfa25b
children d2d8805868f1
files xen/common/schedule.c
line diff
     1.1 --- a/xen/common/schedule.c	Mon Apr 12 17:54:48 2010 +0100
     1.2 +++ b/xen/common/schedule.c	Mon Apr 12 18:28:33 2010 +0100
     1.3 @@ -877,6 +877,11 @@ static void schedule(void)
     1.4               next_slice.time);
     1.5  
     1.6      ASSERT(prev->runstate.state == RUNSTATE_running);
     1.7 +
     1.8 +    TRACE_4D(TRC_SCHED_SWITCH,
     1.9 +             prev->domain->domain_id, prev->vcpu_id,
    1.10 +             next->domain->domain_id, next->vcpu_id);
    1.11 +
    1.12      vcpu_runstate_change(
    1.13          prev,
    1.14          (test_bit(_VPF_blocked, &prev->pause_flags) ? RUNSTATE_blocked :
    1.15 @@ -887,6 +892,11 @@ static void schedule(void)
    1.16      ASSERT(next->runstate.state != RUNSTATE_running);
    1.17      vcpu_runstate_change(next, RUNSTATE_running, now);
    1.18  
    1.19 +    /*
    1.20 +     * NB. Don't add any trace records from here until the actual context
    1.21 +     * switch, else lost_records resume will not work properly.
    1.22 +     */
    1.23 +
    1.24      ASSERT(!next->is_running);
    1.25      next->is_running = 1;
    1.26  
    1.27 @@ -900,10 +910,6 @@ static void schedule(void)
    1.28      update_vcpu_system_time(next);
    1.29      vcpu_periodic_timer_work(next);
    1.30  
    1.31 -    TRACE_4D(TRC_SCHED_SWITCH,
    1.32 -             prev->domain->domain_id, prev->vcpu_id,
    1.33 -             next->domain->domain_id, next->vcpu_id);
    1.34 -
    1.35      context_switch(prev, next);
    1.36  }
    1.37