diff options
Diffstat (limited to 'trace/control.c')
-rw-r--r-- | trace/control.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/trace/control.c b/trace/control.c index b179cde9df..05d85accbd 100644 --- a/trace/control.c +++ b/trace/control.c @@ -34,8 +34,6 @@ int trace_events_enabled_count; * - true : Integral counting the number of vCPUs that have this event enabled. */ uint16_t trace_events_dstate[TRACE_EVENT_COUNT]; -/* Marks events for late vCPU state init */ -static bool trace_events_dstate_init[TRACE_EVENT_COUNT]; QemuOptsList qemu_trace_opts = { .name = "trace", @@ -145,10 +143,7 @@ static void do_trace_enable_events(const char *line_buf) TraceEvent *ev = NULL; while ((ev = trace_event_pattern(line_ptr, ev)) != NULL) { if (trace_event_get_state_static(ev)) { - /* start tracing */ - trace_event_set_state_dynamic(ev, enable); - /* mark for late vCPU init */ - trace_events_dstate_init[ev->id] = true; + trace_event_set_state_dynamic_init(ev, enable); } } } else { @@ -160,10 +155,7 @@ static void do_trace_enable_events(const char *line_buf) error_report("WARNING: trace event '%s' is not traceable", line_ptr); } else { - /* start tracing */ - trace_event_set_state_dynamic(ev, enable); - /* mark for late vCPU init */ - trace_events_dstate_init[ev->id] = true; + trace_event_set_state_dynamic_init(ev, enable); } } } @@ -284,7 +276,14 @@ void trace_init_vcpu_events(void) while ((ev = trace_event_pattern("*", ev)) != NULL) { if (trace_event_is_vcpu(ev) && trace_event_get_state_static(ev) && - trace_events_dstate_init[ev->id]) { + trace_event_get_state_dynamic(ev)) { + TraceEventID id = trace_event_get_id(ev); + /* check preconditions */ + assert(trace_events_dstate[id] == 1); + /* disable early-init state ... */ + trace_events_dstate[id] = 0; + trace_events_enabled_count--; + /* ... and properly re-enable */ trace_event_set_state_dynamic(ev, true); } } |