[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xentrace: fix lost records resume



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271093313 -3600
# Node ID 9471200daee46c5a6f3b054b0a53f95545386029
# Parent  94cae4dfa25bcf9aaeb93fb374926cb40411ebdf
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@xxxxxxxxxxxxx>
---
 xen/common/schedule.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff -r 94cae4dfa25b -r 9471200daee4 xen/common/schedule.c
--- a/xen/common/schedule.c     Mon Apr 12 17:54:48 2010 +0100
+++ b/xen/common/schedule.c     Mon Apr 12 18:28:33 2010 +0100
@@ -877,6 +877,11 @@ static void schedule(void)
              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 :
@@ -887,6 +892,11 @@ static void schedule(void)
     ASSERT(next->runstate.state != RUNSTATE_running);
     vcpu_runstate_change(next, RUNSTATE_running, now);
 
+    /*
+     * NB. Don't add any trace records from here until the actual context
+     * switch, else lost_records resume will not work properly.
+     */
+
     ASSERT(!next->is_running);
     next->is_running = 1;
 
@@ -899,10 +909,6 @@ static void schedule(void)
     /* Ensure that the domain has an up-to-date time base. */
     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);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.