diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2016-09-29 00:34:20 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2016-09-29 00:34:20 +0100 |
| commit | cc9a366d3b161d255fcf25aad30e0c8fcc766013 (patch) | |
| tree | 1d11db4580c10d5cd3ab3468746030cbe07bd005 /trace/control-target.c | |
| parent | c640f2849ee8775fe1bbd7a2772610aa77816f9f (diff) | |
| parent | 43e21e4907a009d87f6aef44663d9e1f7b181b8d (diff) | |
| download | focaccia-qemu-cc9a366d3b161d255fcf25aad30e0c8fcc766013.tar.gz focaccia-qemu-cc9a366d3b161d255fcf25aad30e0c8fcc766013.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
# gpg: Signature made Wed 28 Sep 2016 22:30:45 BST # gpg: using RSA key 0x9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/tracing-pull-request: trace: Document the execution mode of guest events trace: Add event "guest_cpu_reset" trace: Add event "guest_cpu_enter" trace: Properly initialize dynamic event states in hot-plugged vCPUs trace: move hw/virtio/virtio-balloon.c trace points into correct file trace: move hw/mem/pc-dimm.c trace points into correct file trace: move util/qemu-coroutine*.c trace points into correct file trace: move util/buffer.c trace points into correct file Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'trace/control-target.c')
| -rw-r--r-- | trace/control-target.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/trace/control-target.c b/trace/control-target.c index 72081e2a34..52fcce5a00 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "trace.h" #include "trace/control.h" #include "translate-all.h" @@ -81,3 +82,42 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, } } } + +static bool adding_first_cpu(void) +{ + CPUState *cpu; + size_t count = 0; + CPU_FOREACH(cpu) { + count++; + if (count > 1) { + return false; + } + } + return true; +} + +void trace_init_vcpu(CPUState *vcpu) +{ + TraceEvent *ev = NULL; + + while ((ev = trace_event_pattern("*", ev)) != NULL) { + if (trace_event_is_vcpu(ev) && + trace_event_get_state_static(ev) && + trace_event_get_state_dynamic(ev)) { + TraceEventID id = trace_event_get_id(ev); + if (adding_first_cpu()) { + /* 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_vcpu_state_dynamic(vcpu, ev, true); + } else { + trace_event_set_vcpu_state_dynamic(vcpu, ev, true); + } + } + } + + trace_guest_cpu_enter(vcpu); +} |