aboutsummaryrefslogtreecommitdiff
path: root/trace/control-target.c
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2017-09-13 01:50:25 +0300
committerStefan Hajnoczi <stefanha@redhat.com>2017-09-15 14:25:22 +0100
commitf99b38fc7c1bdf2dcc5e316478281c35b8c60f79 (patch)
treec158999275a8d21f30d2e5596daf400d43935542 /trace/control-target.c
parent3dabde1128b671f36ac6cb36b97b273139964420 (diff)
trace: Immediately apply per-vCPU state changes if a vCPU is being created
Right now, function trace_event_set_vcpu_state_dynamic() asynchronously enables events in the case a vCPU is executing TCG code. If the vCPU is being created this makes some events like "guest_cpu_enter" to not be traced. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Emilio G. Cota <cota@braap.org> Message-id: 150525662577.19850.13767570977540117247.stgit@frigg.lan Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'trace/control-target.c')
-rw-r--r--trace/control-target.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/trace/control-target.c b/trace/control-target.c
index 4e36101997..706b2cee9d 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -88,13 +88,17 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
clear_bit(vcpu_id, vcpu->trace_dstate_delayed);
(*ev->dstate)--;
}
- /*
- * Delay changes until next TB; we want all TBs to be built from a
- * single set of dstate values to ensure consistency of generated
- * tracing code.
- */
- async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
- RUN_ON_CPU_NULL);
+ if (vcpu->created) {
+ /*
+ * Delay changes until next TB; we want all TBs to be built from a
+ * single set of dstate values to ensure consistency of generated
+ * tracing code.
+ */
+ async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
+ RUN_ON_CPU_NULL);
+ } else {
+ trace_event_synchronize_vcpu_state_dynamic(vcpu, RUN_ON_CPU_NULL);
+ }
}
}