Skip to contentSkip to conversation

xentrace: fix lost records resume

PATCH New George Dunlap 1 participant 1 message Apr 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

xen/common/schedule.c +8 -4
diff -r eba9b07a15ec xen/common/schedule.c
@@ -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);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel