Commit 48151859 authored by Lluís Vilanova's avatar Lluís Vilanova Committed by Stefan Hajnoczi
Browse files

trace: Add per-vCPU tracing states for events with the 'vcpu' property



Each vCPU gets a 'trace_dstate' bitmap to control the per-vCPU dynamic
tracing state of events with the 'vcpu' property.

Signed-off-by: default avatarLluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent e1d6e0a4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1131,6 +1131,7 @@ int main(int argc, char **argv)
        gdbserver_start (gdbstub_port);
        gdb_handlesig(cpu, 0);
    }
    trace_init_vcpu_events();
    cpu_loop(env);
    /* never exits */
    return 0;
+6 −0
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@
#include "disas/bfd.h"
#include "exec/hwaddr.h"
#include "exec/memattrs.h"
#include "qemu/bitmap.h"
#include "qemu/queue.h"
#include "qemu/thread.h"
#include "trace/generated-events.h"

typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
                                     void *opaque);
@@ -280,6 +282,7 @@ struct qemu_work_item {
 * @kvm_fd: vCPU file descriptor for KVM.
 * @work_mutex: Lock to prevent multiple access to queued_work_*.
 * @queued_work_first: First asynchronous work pending.
 * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).
 *
 * State of one CPU core or thread.
 */
@@ -347,6 +350,9 @@ struct CPUState {
    struct KVMState *kvm_state;
    struct kvm_run *kvm_run;

    /* Used for events with 'vcpu' and *without* the 'disabled' properties */
    DECLARE_BITMAP(trace_dstate, TRACE_VCPU_EVENT_COUNT);

    /* TODO Move common fields from CPUArchState here. */
    int cpu_index; /* used by alpha TCG */
    uint32_t halted; /* used by alpha, cris, ppc TCG */
+1 −0
Original line number Diff line number Diff line
@@ -4810,6 +4810,7 @@ int main(int argc, char **argv, char **envp)
        }
        gdb_handlesig(cpu, 0);
    }
    trace_init_vcpu_events();
    cpu_loop(env);
    /* never exits */
    return 0;
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ static void cpu_common_initfn(Object *obj)
    qemu_mutex_init(&cpu->work_mutex);
    QTAILQ_INIT(&cpu->breakpoints);
    QTAILQ_INIT(&cpu->watchpoints);
    bitmap_zero(cpu->trace_dstate, TRACE_VCPU_EVENT_COUNT);
}

static void cpu_common_finalize(Object *obj)
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ stub-obj-y += runstate-check.o
stub-obj-y += set-fd-handler.o
stub-obj-y += slirp.o
stub-obj-y += sysbus.o
stub-obj-y += trace-control.o
stub-obj-y += uuid.o
stub-obj-y += vm-stop.o
stub-obj-y += vmstate.o
Loading