[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 00/11] trace: [tcg] Allow tracing guest event
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v5 00/11] trace: [tcg] Allow tracing guest events in TCG-generated code |
Date: |
Wed, 9 Jul 2014 09:40:09 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, May 30, 2014 at 02:11:20PM +0200, Lluís Vilanova wrote:
> 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_wrapper(bool, TCGv)
> Declared: "trace/generated-helpers-wrappers.h"
> Defined : "trace/generated-helpers-wrappers.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 v5:
>
> * Rename 'gen_helper_trace_${name}_exec' as
> 'gen_helper_trace_${name}_exec_wrapper'.
> * Split generation of 'gen_helper_trace_${name}_exec_wrapper' into a separate
> file ("trace/generated-helpers-wrappers.h"), using the new
> 'tcg-helper-wrapper-h' tracetool backend.
>
> 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 (11):
> 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] Define TCG tracing helper routine wrappers
> 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 | 4 +
> Makefile | 6 +
> Makefile.objs | 7 +
> Makefile.target | 5 +
> docs/tracing.txt | 40 +++++
> include/exec/helper-gen.h | 2
> 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 | 50 +++++++
> scripts/tracetool/format/tcg_helper_wrapper_h.py | 70 +++++++++
> 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 | 53 ++++++-
> 34 files changed, 654 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/format/tcg_helper_wrapper_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>
>
Merged for QEMU 2.2.
Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next
Stefan
pgpFb0UiZZeAd.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v5 00/11] trace: [tcg] Allow tracing guest events in TCG-generated code,
Stefan Hajnoczi <=