[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 00/10] trace: [tcg] Allow tracing guest events in
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v4 00/10] trace: [tcg] Allow tracing guest events in TCG-generated code |
Date: |
Thu, 29 May 2014 14:22:32 +0200 |
User-agent: |
StGit/0.17.1-dirty |
NOTE: TCG code for execution-time event tracing is always generated, regardless
of wether the event has been dynamically disabled or not (unless the event
has the static "disable" property).
This approach keeps this series simple, and a future series will handle
the case of having per-CPU tracing states for these events, and only
generate the code if the event is dynamicaly enabled.
Adds the base ability to specify which events in the "trace-events" file may be
used to trace guest activity in the TCG code (using the "tcg" event propery).
An event with that property actually generates two independent events
"${name}_trans" and "${name}_exec", and a set of conveniency functions. Having
two events allows us to trace both translation and execution of guest code
(e.g., generating vs executing a basic block). See the first patch for more
information on its usage.
Files generating guest code (TCG) must include "trace-tcg.h".
The flow of the generated routines is (convenience wrappers are inlined):
[At translation time]
* trace_${name}_tcg(bool, TCGv)
Declared: "trace/generated-tcg-tracers.h"
Defined : "trace/generated-tcg-tracers.h"
Invokes "trace_${name}_trans" (with all non-TCG arguments) and
"gen_helper_trace_${name}_exec" (with all arguments).
* trace_${name}_trans(bool)
Declared: "trace/generated-tracers.h"
Defined : "trace/generated-tracers.h"
Invokes the actual tracing backends for the translation-time event.
* gen_helper_trace_${name}_exec(bool, TCGv)
Declared: "trace/generated-helpers.h"
Defined : "trace/generated-helpers.h"
Convenience wrapper that will allocate (and free) TCG temporaries for all
non-TCG arguments before calling "gen_helper_trace_${name}_exec_proxy".
* gen_helper_trace_${name}_exec_proxy(TCGi32, TCGv)
Declared: "trace/generated-helpers.h"
Defined : "trace/generated-helpers.h" (using helper machinery)
The actual TCG helper function, created using QEMU's TCG helper machinery.
[At execution time]
* helper_trace_${name}_exec_proxy(uint32_t, uint64_t)
Declared: "trace/generated-helpers.h"
Defined : "trace/generated-helpers.c"
Convenience wrapper that casts arguments to the appropriate type before
calling "trace_${name}_exec".
This is necessary because TCG helpers can only receive a limited number of
argument types (e.g., must use 'uint32_t' instead of 'bool').
* trace_${name}_exec(bool, uint64_t)
Declared: "trace/generated-tracers.h"
Defined : "trace/generated-tracers.h"
Invokes the actual tracing backends for the execution-time event.
Signed-off-by: Lluís Vilanova <address@hidden>
---
Changes in v4:
* Rebase on d7d3d60 (use new helper header machinery).
Changes in v3:
* None (re-send with cover).
Changes in v2:
* Split the guest memory access event out of this series.
* Generate two independent events from each "tcg" event (one for
translation-time events and one for execution-time events).
Lluís Vilanova (10):
trace: [tcg] Add documentation
trace: [tcg] Argument type transformation rules
trace: [tcg] Argument type transformation machinery
trace: [tcg] Add 'tcg' event property
trace: [tcg] Declare TCG tracing helper routines
trace: [tcg] Define TCG tracing helper routines
trace: [tcg] Include TCG-tracing helpers
trace: [tcg] Generate TCG tracing routines
trace: [tcg] Include event definitions in "trace.h"
trace: [tcg] Include TCG-tracing header on all targets
.gitignore | 3 +
Makefile | 5 +
Makefile.objs | 7 +
Makefile.target | 5 +
docs/tracing.txt | 40 +++++++
include/exec/helper-gen.h | 3 +
include/exec/helper-proto.h | 1
include/exec/helper-tcg.h | 1
include/trace-tcg.h | 7 +
include/trace.h | 1
scripts/tracetool/__init__.py | 95 ++++++++++++++++-
scripts/tracetool/format/events_h.py | 5 +
scripts/tracetool/format/tcg_h.py | 57 ++++++++++
scripts/tracetool/format/tcg_helper_c.py | 50 +++++++++
scripts/tracetool/format/tcg_helper_h.py | 90 ++++++++++++++++
scripts/tracetool/transform.py | 166 ++++++++++++++++++++++++++++++
target-alpha/translate.c | 3 +
target-arm/translate-a64.c | 2
target-arm/translate.c | 3 +
target-cris/translate.c | 3 +
target-i386/translate.c | 3 +
target-lm32/translate.c | 3 +
target-m68k/translate.c | 3 +
target-microblaze/translate.c | 3 +
target-mips/translate.c | 3 +
target-openrisc/translate.c | 3 +
target-ppc/translate.c | 3 +
target-s390x/translate.c | 2
target-sh4/translate.c | 3 +
target-sparc/translate.c | 3 +
target-unicore32/translate.c | 3 +
target-xtensa/translate.c | 3 +
trace/Makefile.objs | 45 +++++++-
33 files changed, 615 insertions(+), 12 deletions(-)
create mode 100644 include/trace-tcg.h
create mode 100644 scripts/tracetool/format/tcg_h.py
create mode 100644 scripts/tracetool/format/tcg_helper_c.py
create mode 100644 scripts/tracetool/format/tcg_helper_h.py
create mode 100644 scripts/tracetool/transform.py
To: address@hidden
Cc: Stefan Hajnoczi <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Peter Maydell <address@hidden>
- [Qemu-devel] [PATCH v4 00/10] trace: [tcg] Allow tracing guest events in TCG-generated code,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v4 02/10] trace: [tcg] Argument type transformation rules, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 04/10] trace: [tcg] Add 'tcg' event property, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 01/10] trace: [tcg] Add documentation, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 05/10] trace: [tcg] Declare TCG tracing helper routines, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 03/10] trace: [tcg] Argument type transformation machinery, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 06/10] trace: [tcg] Define TCG tracing helper routines, Lluís Vilanova, 2014/05/29
- [Qemu-devel] [PATCH v4 07/10] trace: [tcg] Include TCG-tracing helpers, Lluís Vilanova, 2014/05/29