All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code
@ 2011-12-08 22:47 Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:47 UTC (permalink / raw)
  To: qemu-devel

Adds the basic ability to specify which events in the "trace-events" may be used
to trace guest activity in the TCG code.

Such events generate an extra set of tracing functions that can be called during
TCG code generation and will automatically redirect a call to the appropriate
backend-dependant tracing functions when the guest code is executed.

The extra routines and files generated by tracetool are:

* trace-tcg-helper.h

  Included on all "${target}/helper.h" headers.

  Declares a 'trace_${name}_proxy' TCG helper using the 'DEF_HELPER_*' macros
  for each TCG-aware event.

  Defines a 'gen_helper_trace_${name}' that ends up calling
  'gen_helper_trace_${name}_proxy'.

  In order to provide a more streamlined interface, this routine can take a mix
  of tracing-supported types and TCG types. In order to do this, it
  automatically casts the arguments and allocates them into the appropriate TCG
  types, calls 'gen_helper_trace_${name}_proxy' and frees the temporary TCG
  values it has allocated.

* trace-tcg-helper.c

  Defines a 'trace_${name}_proxy' TCG helper for each TCG-aware event. This
  helper will immediately call 'trace_${name}' with all the necessary argument
  type casts to match the signature of the callee.

NOTE: This patch series has been stripped out of all trace instrumentation
      features, and is thus applicable on top of QEMU 1.0

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---

Lluís Vilanova (10):
      trace: [doc] Document event properties on a separate section
      trace-tcg: Add documentation
      Trivial changes to eliminate auto-generated files
      [m68k,s390,xtensa] Move helpers.h to helper.h
      trace: [tracetool] Common functions to manage event arguments
      trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines
      trace-tcg: [tracetool] Allow TCG types in trace event declarations
      trace-tcg: [tracetool] Declare TCG tracing helper routines
      trace-tcg: [tracetool] Define TCG tracing helper routines
      trace-tcg: [all] Include TCG-tracing helpers


 .gitignore                 |    2 
 Makefile                   |   11 +
 Makefile.objs              |   17 ++
 Makefile.target            |    2 
 def-helper.h               |    9 +
 docs/tracing.txt           |   62 +++++-
 scripts/simpletrace.py     |    2 
 scripts/tracetool          |  449 +++++++++++++++++++++++++++++++++++++++++---
 target-alpha/helper.h      |    2 
 target-arm/helper.h        |    2 
 target-cris/helper.h       |    2 
 target-i386/helper.h       |    2 
 target-lm32/helper.h       |    2 
 target-m68k/helper.c       |    2 
 target-m68k/helper.h       |   56 +++++
 target-m68k/helpers.h      |   54 -----
 target-m68k/op_helper.c    |    2 
 target-m68k/translate.c    |    6 -
 target-microblaze/helper.h |    2 
 target-mips/helper.h       |    2 
 target-ppc/helper.h        |    2 
 target-s390x/helper.h      |  154 +++++++++++++++
 target-s390x/helpers.h     |  152 ---------------
 target-s390x/op_helper.c   |    2 
 target-s390x/translate.c   |    4 
 target-sh4/helper.h        |    2 
 target-sparc/helper.h      |    2 
 target-unicore32/helper.h  |    2 
 target-xtensa/helper.h     |   34 +++
 target-xtensa/helpers.h    |   32 ---
 target-xtensa/op_helper.c  |    2 
 target-xtensa/translate.c  |    6 -
 xtensa-semi.c              |    2 
 33 files changed, 796 insertions(+), 288 deletions(-)
 create mode 100644 target-m68k/helper.h
 delete mode 100644 target-m68k/helpers.h
 create mode 100644 target-s390x/helper.h
 delete mode 100644 target-s390x/helpers.h
 create mode 100644 target-xtensa/helper.h
 delete mode 100644 target-xtensa/helpers.h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
@ 2011-12-08 22:48 ` Lluís Vilanova
  2011-12-09 20:08   ` Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation Lluís Vilanova
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:48 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index ea29f2c..853cbf8 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -98,12 +98,6 @@ respectively.  This ensures portability between 32- and 64-bit platforms.
 4. Name trace events after their function.  If there are multiple trace events
    in one function, append a unique distinguisher at the end of the name.
 
-5. If specific trace events are going to be called a huge number of times, this
-   might have a noticeable performance impact even when the trace events are
-   programmatically disabled. In this case you should declare the trace event
-   with the "disable" property, which will effectively disable it at compile
-   time (using the "nop" backend).
-
 == Generic interface and monitor commands ==
 
 You can programmatically query and control the dynamic state of trace events
@@ -234,3 +228,19 @@ probes:
                       --target-type system \
                       --target-arch x86_64 \
                       <trace-events >qemu.stp
+
+== Trace event properties ==
+
+Each event in the "trace-events" file can be prefixed with a space-separated
+list of zero or more of the following event properties.
+
+=== "disable" ===
+
+If a specific trace event is going to be invoked a huge number of times, this
+might have a noticeable performance impact even when the event is
+programmatically disabled.
+
+In this case you should declare such event with the "disable" property. This
+will effectively disable the event at compile time (by using the "nop" backend),
+thus having no performance impact at all on regular builds (i.e., unless you
+edit the "trace-events" file).

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
@ 2011-12-08 22:48 ` Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files Lluís Vilanova
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:48 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index 853cbf8..44c5dba 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -244,3 +244,43 @@ In this case you should declare such event with the "disable" property. This
 will effectively disable the event at compile time (by using the "nop" backend),
 thus having no performance impact at all on regular builds (i.e., unless you
 edit the "trace-events" file).
+
+=== "tcg" ===
+
+Code from the guest generated by TCG can be traced by defining an event with the
+"tcg" event property.
+
+In addition to the regular "trace_<eventname>" routine in the "trace.h" header,
+events with the "tcg" property will also provide the TCG helper routine
+"gen_helper_trace_<eventname>". This routine can be called during TCG code
+generation as any other TCG helper to automatically generate TCG code to call
+"trace_<eventname>" during TCG code execution.
+
+The notable difference is that these events can be declared in the
+"trace-events" file with both basic types as well as TCG types. The
+"gen_helper_trace_<eventname>" routine will transparently take care of turning
+any non-TCG argument into a TCG value.
+
+For example, the event:
+
+    tcg foo(uint8_t a1, TCGv_i32 a2) "a1=%d a2=%d"
+
+Can be invoked from TCG code as:
+
+    uint8_t a1 = ...;
+    TCGv_i32 a2 = ...;
+    gen_helper_trace_foo(a1, a2);
+
+And the intermediate boilerplate code will take care of generating the TCG code
+to call:
+
+    void trace_foo(uint8_t a1, uint32_t a2);
+
+=== "tcg-vcpu" ===
+
+Events with the "tcg" property will generate code helpers with the
+"TCG_CALL_CONST" flag (see "tcg/README" and "tcg/tcg.h"), which produces faster
+code that is unable to reliably access the state of the vCPU.
+
+Using the "tcg-vcpu" property will generate a slower TCG helper that will be
+able to reliably get and set values from the vCPU.

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation Lluís Vilanova
@ 2011-12-08 22:48 ` Lluís Vilanova
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h Lluís Vilanova
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:48 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 Makefile |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 301c75e..506db1b 100644
--- a/Makefile
+++ b/Makefile
@@ -3,10 +3,14 @@
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
 
-GENERATED_HEADERS = config-host.h trace.h qemu-options.def
+GENERATED_HEADERS = config-host.h qemu-options.def
+
+GENERATED_HEADERS += trace.h
 ifeq ($(TRACE_BACKEND),dtrace)
 GENERATED_HEADERS += trace-dtrace.h
 endif
+GENERATED_SOURCES += trace.c
+
 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
 GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
 
@@ -226,10 +230,11 @@ clean:
 	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d
 	rm -f qemu-img-cmds.h
 	rm -f trace/*.o trace/*.d
-	rm -f trace.c trace.h trace.c-timestamp trace.h-timestamp
 	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
+	@# May not be present in GENERATED_HEADERS
 	rm -f trace-dtrace.h trace-dtrace.h-timestamp
-	rm -f $(GENERATED_SOURCES)
+	rm -f $(foreach f,$(GENERATED_HEADERS) $(foreach h,$(GENERATED_HEADERS),$(h)-timestamp),$(f) */$(f))
+	rm -f $(foreach f,$(GENERATED_SOURCES) $(foreach h,$(GENERATED_SOURCES),$(h)-timestamp),$(f) */$(f))
 	rm -rf $(qapi-dir)
 	$(MAKE) -C tests clean
 	for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (2 preceding siblings ...)
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files Lluís Vilanova
@ 2011-12-08 22:48 ` Lluís Vilanova
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments Lluís Vilanova
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:48 UTC (permalink / raw)
  To: qemu-devel

This provides a consistent file naming scheme across all targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target-m68k/helper.c      |    2 -
 target-m68k/helper.h      |   54 ++++++++++++++++
 target-m68k/helpers.h     |   54 ----------------
 target-m68k/op_helper.c   |    2 -
 target-m68k/translate.c   |    6 +-
 target-s390x/helper.h     |  152 +++++++++++++++++++++++++++++++++++++++++++++
 target-s390x/helpers.h    |  152 ---------------------------------------------
 target-s390x/op_helper.c  |    2 -
 target-s390x/translate.c  |    4 +
 target-xtensa/helper.h    |   32 +++++++++
 target-xtensa/helpers.h   |   32 ---------
 target-xtensa/op_helper.c |    2 -
 target-xtensa/translate.c |    6 +-
 xtensa-semi.c             |    2 -
 14 files changed, 251 insertions(+), 251 deletions(-)
 create mode 100644 target-m68k/helper.h
 delete mode 100644 target-m68k/helpers.h
 create mode 100644 target-s390x/helper.h
 delete mode 100644 target-s390x/helpers.h
 create mode 100644 target-xtensa/helper.h
 delete mode 100644 target-xtensa/helpers.h

diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 674c8e6..123e1d9 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -26,7 +26,7 @@
 #include "qemu-common.h"
 #include "gdbstub.h"
 
-#include "helpers.h"
+#include "helper.h"
 
 #define SIGNBIT (1u << 31)
 
diff --git a/target-m68k/helper.h b/target-m68k/helper.h
new file mode 100644
index 0000000..cb8a0c7
--- /dev/null
+++ b/target-m68k/helper.h
@@ -0,0 +1,54 @@
+#include "def-helper.h"
+
+DEF_HELPER_1(bitrev, i32, i32)
+DEF_HELPER_1(ff1, i32, i32)
+DEF_HELPER_2(sats, i32, i32, i32)
+DEF_HELPER_2(divu, void, env, i32)
+DEF_HELPER_2(divs, void, env, i32)
+DEF_HELPER_3(addx_cc, i32, env, i32, i32)
+DEF_HELPER_3(subx_cc, i32, env, i32, i32)
+DEF_HELPER_3(shl_cc, i32, env, i32, i32)
+DEF_HELPER_3(shr_cc, i32, env, i32, i32)
+DEF_HELPER_3(sar_cc, i32, env, i32, i32)
+DEF_HELPER_2(xflag_lt, i32, i32, i32)
+DEF_HELPER_2(set_sr, void, env, i32)
+DEF_HELPER_3(movec, void, env, i32, i32)
+
+DEF_HELPER_2(f64_to_i32, f32, env, f64)
+DEF_HELPER_2(f64_to_f32, f32, env, f64)
+DEF_HELPER_2(i32_to_f64, f64, env, i32)
+DEF_HELPER_2(f32_to_f64, f64, env, f32)
+DEF_HELPER_2(iround_f64, f64, env, f64)
+DEF_HELPER_2(itrunc_f64, f64, env, f64)
+DEF_HELPER_2(sqrt_f64, f64, env, f64)
+DEF_HELPER_1(abs_f64, f64, f64)
+DEF_HELPER_1(chs_f64, f64, f64)
+DEF_HELPER_3(add_f64, f64, env, f64, f64)
+DEF_HELPER_3(sub_f64, f64, env, f64, f64)
+DEF_HELPER_3(mul_f64, f64, env, f64, f64)
+DEF_HELPER_3(div_f64, f64, env, f64, f64)
+DEF_HELPER_3(sub_cmp_f64, f64, env, f64, f64)
+DEF_HELPER_2(compare_f64, i32, env, f64)
+
+DEF_HELPER_3(mac_move, void, env, i32, i32)
+DEF_HELPER_3(macmulf, i64, env, i32, i32)
+DEF_HELPER_3(macmuls, i64, env, i32, i32)
+DEF_HELPER_3(macmulu, i64, env, i32, i32)
+DEF_HELPER_2(macsats, void, env, i32)
+DEF_HELPER_2(macsatu, void, env, i32)
+DEF_HELPER_2(macsatf, void, env, i32)
+DEF_HELPER_2(mac_set_flags, void, env, i32)
+DEF_HELPER_2(set_macsr, void, env, i32)
+DEF_HELPER_2(get_macf, i32, env, i64)
+DEF_HELPER_1(get_macs, i32, i64)
+DEF_HELPER_1(get_macu, i32, i64)
+DEF_HELPER_2(get_mac_extf, i32, env, i32)
+DEF_HELPER_2(get_mac_exti, i32, env, i32)
+DEF_HELPER_3(set_mac_extf, void, env, i32, i32)
+DEF_HELPER_3(set_mac_exts, void, env, i32, i32)
+DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
+
+DEF_HELPER_2(flush_flags, void, env, i32)
+DEF_HELPER_1(raise_exception, void, i32)
+
+#include "def-helper.h"
diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h
deleted file mode 100644
index cb8a0c7..0000000
--- a/target-m68k/helpers.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "def-helper.h"
-
-DEF_HELPER_1(bitrev, i32, i32)
-DEF_HELPER_1(ff1, i32, i32)
-DEF_HELPER_2(sats, i32, i32, i32)
-DEF_HELPER_2(divu, void, env, i32)
-DEF_HELPER_2(divs, void, env, i32)
-DEF_HELPER_3(addx_cc, i32, env, i32, i32)
-DEF_HELPER_3(subx_cc, i32, env, i32, i32)
-DEF_HELPER_3(shl_cc, i32, env, i32, i32)
-DEF_HELPER_3(shr_cc, i32, env, i32, i32)
-DEF_HELPER_3(sar_cc, i32, env, i32, i32)
-DEF_HELPER_2(xflag_lt, i32, i32, i32)
-DEF_HELPER_2(set_sr, void, env, i32)
-DEF_HELPER_3(movec, void, env, i32, i32)
-
-DEF_HELPER_2(f64_to_i32, f32, env, f64)
-DEF_HELPER_2(f64_to_f32, f32, env, f64)
-DEF_HELPER_2(i32_to_f64, f64, env, i32)
-DEF_HELPER_2(f32_to_f64, f64, env, f32)
-DEF_HELPER_2(iround_f64, f64, env, f64)
-DEF_HELPER_2(itrunc_f64, f64, env, f64)
-DEF_HELPER_2(sqrt_f64, f64, env, f64)
-DEF_HELPER_1(abs_f64, f64, f64)
-DEF_HELPER_1(chs_f64, f64, f64)
-DEF_HELPER_3(add_f64, f64, env, f64, f64)
-DEF_HELPER_3(sub_f64, f64, env, f64, f64)
-DEF_HELPER_3(mul_f64, f64, env, f64, f64)
-DEF_HELPER_3(div_f64, f64, env, f64, f64)
-DEF_HELPER_3(sub_cmp_f64, f64, env, f64, f64)
-DEF_HELPER_2(compare_f64, i32, env, f64)
-
-DEF_HELPER_3(mac_move, void, env, i32, i32)
-DEF_HELPER_3(macmulf, i64, env, i32, i32)
-DEF_HELPER_3(macmuls, i64, env, i32, i32)
-DEF_HELPER_3(macmulu, i64, env, i32, i32)
-DEF_HELPER_2(macsats, void, env, i32)
-DEF_HELPER_2(macsatu, void, env, i32)
-DEF_HELPER_2(macsatf, void, env, i32)
-DEF_HELPER_2(mac_set_flags, void, env, i32)
-DEF_HELPER_2(set_macsr, void, env, i32)
-DEF_HELPER_2(get_macf, i32, env, i64)
-DEF_HELPER_1(get_macs, i32, i64)
-DEF_HELPER_1(get_macu, i32, i64)
-DEF_HELPER_2(get_mac_extf, i32, env, i32)
-DEF_HELPER_2(get_mac_exti, i32, env, i32)
-DEF_HELPER_3(set_mac_extf, void, env, i32, i32)
-DEF_HELPER_3(set_mac_exts, void, env, i32, i32)
-DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
-
-DEF_HELPER_2(flush_flags, void, env, i32)
-DEF_HELPER_1(raise_exception, void, i32)
-
-#include "def-helper.h"
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
index 2f7fe6b..da7ebe4 100644
--- a/target-m68k/op_helper.c
+++ b/target-m68k/op_helper.c
@@ -18,7 +18,7 @@
  */
 #include "cpu.h"
 #include "dyngen-exec.h"
-#include "helpers.h"
+#include "helper.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 0e7f1fe..fe750e2 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -29,9 +29,9 @@
 #include "tcg-op.h"
 #include "qemu-log.h"
 
-#include "helpers.h"
+#include "helper.h"
 #define GEN_HELPER 1
-#include "helpers.h"
+#include "helper.h"
 
 //#define DEBUG_DISPATCH 1
 
@@ -110,7 +110,7 @@ void m68k_tcg_init(void)
     store_dummy = tcg_global_mem_new(TCG_AREG0, -8, "NULL");
 
 #define GEN_HELPER 2
-#include "helpers.h"
+#include "helper.h"
 }
 
 static inline void qemu_assert(int cond, const char *msg)
diff --git a/target-s390x/helper.h b/target-s390x/helper.h
new file mode 100644
index 0000000..01c8d0e
--- /dev/null
+++ b/target-s390x/helper.h
@@ -0,0 +1,152 @@
+#include "def-helper.h"
+
+DEF_HELPER_1(exception, void, i32)
+DEF_HELPER_3(nc, i32, i32, i64, i64)
+DEF_HELPER_3(oc, i32, i32, i64, i64)
+DEF_HELPER_3(xc, i32, i32, i64, i64)
+DEF_HELPER_3(mvc, void, i32, i64, i64)
+DEF_HELPER_3(clc, i32, i32, i64, i64)
+DEF_HELPER_2(mvcl, i32, i32, i32)
+DEF_HELPER_FLAGS_1(set_cc_comp_s32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32)
+DEF_HELPER_FLAGS_1(set_cc_comp_s64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64)
+DEF_HELPER_FLAGS_2(set_cc_icm, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32)
+DEF_HELPER_3(clm, i32, i32, i32, i64)
+DEF_HELPER_3(stcm, void, i32, i32, i64)
+DEF_HELPER_2(mlg, void, i32, i64)
+DEF_HELPER_2(dlg, void, i32, i64)
+DEF_HELPER_FLAGS_3(set_cc_add64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64)
+DEF_HELPER_FLAGS_3(set_cc_addu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
+DEF_HELPER_FLAGS_3(set_cc_add32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32, s32, s32)
+DEF_HELPER_FLAGS_3(set_cc_addu32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
+DEF_HELPER_FLAGS_3(set_cc_sub64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64)
+DEF_HELPER_FLAGS_3(set_cc_subu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
+DEF_HELPER_FLAGS_3(set_cc_sub32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32, s32, s32)
+DEF_HELPER_FLAGS_3(set_cc_subu32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
+DEF_HELPER_3(srst, i32, i32, i32, i32)
+DEF_HELPER_3(clst, i32, i32, i32, i32)
+DEF_HELPER_3(mvpg, void, i64, i64, i64)
+DEF_HELPER_3(mvst, void, i32, i32, i32)
+DEF_HELPER_3(csg, i32, i32, i64, i32)
+DEF_HELPER_3(cdsg, i32, i32, i64, i32)
+DEF_HELPER_3(cs, i32, i32, i64, i32)
+DEF_HELPER_4(ex, i32, i32, i64, i64, i64)
+DEF_HELPER_FLAGS_1(abs_i32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32)
+DEF_HELPER_FLAGS_1(nabs_i32, TCG_CALL_PURE|TCG_CALL_CONST, s32, s32)
+DEF_HELPER_FLAGS_1(abs_i64, TCG_CALL_PURE|TCG_CALL_CONST, i64, s64)
+DEF_HELPER_FLAGS_1(nabs_i64, TCG_CALL_PURE|TCG_CALL_CONST, s64, s64)
+DEF_HELPER_3(stcmh, void, i32, i64, i32)
+DEF_HELPER_3(icmh, i32, i32, i64, i32)
+DEF_HELPER_2(ipm, void, i32, i32)
+DEF_HELPER_FLAGS_3(addc_u32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
+DEF_HELPER_FLAGS_3(set_cc_addc_u64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
+DEF_HELPER_3(stam, void, i32, i64, i32)
+DEF_HELPER_3(lam, void, i32, i64, i32)
+DEF_HELPER_3(mvcle, i32, i32, i64, i32)
+DEF_HELPER_3(clcle, i32, i32, i64, i32)
+DEF_HELPER_3(slb, i32, i32, i32, i32)
+DEF_HELPER_4(slbg, i32, i32, i32, i64, i64)
+DEF_HELPER_2(cefbr, void, i32, s32)
+DEF_HELPER_2(cdfbr, void, i32, s32)
+DEF_HELPER_2(cxfbr, void, i32, s32)
+DEF_HELPER_2(cegbr, void, i32, s64)
+DEF_HELPER_2(cdgbr, void, i32, s64)
+DEF_HELPER_2(cxgbr, void, i32, s64)
+DEF_HELPER_2(adbr, i32, i32, i32)
+DEF_HELPER_2(aebr, i32, i32, i32)
+DEF_HELPER_2(sebr, i32, i32, i32)
+DEF_HELPER_2(sdbr, i32, i32, i32)
+DEF_HELPER_2(debr, void, i32, i32)
+DEF_HELPER_2(dxbr, void, i32, i32)
+DEF_HELPER_2(mdbr, void, i32, i32)
+DEF_HELPER_2(mxbr, void, i32, i32)
+DEF_HELPER_2(ldebr, void, i32, i32)
+DEF_HELPER_2(ldxbr, void, i32, i32)
+DEF_HELPER_2(lxdbr, void, i32, i32)
+DEF_HELPER_2(ledbr, void, i32, i32)
+DEF_HELPER_2(lexbr, void, i32, i32)
+DEF_HELPER_2(lpebr, i32, i32, i32)
+DEF_HELPER_2(lpdbr, i32, i32, i32)
+DEF_HELPER_2(lpxbr, i32, i32, i32)
+DEF_HELPER_2(ltebr, i32, i32, i32)
+DEF_HELPER_2(ltdbr, i32, i32, i32)
+DEF_HELPER_2(ltxbr, i32, i32, i32)
+DEF_HELPER_2(lcebr, i32, i32, i32)
+DEF_HELPER_2(lcdbr, i32, i32, i32)
+DEF_HELPER_2(lcxbr, i32, i32, i32)
+DEF_HELPER_2(aeb, void, i32, i32)
+DEF_HELPER_2(deb, void, i32, i32)
+DEF_HELPER_2(meeb, void, i32, i32)
+DEF_HELPER_2(cdb, i32, i32, i64)
+DEF_HELPER_2(adb, i32, i32, i64)
+DEF_HELPER_2(seb, void, i32, i32)
+DEF_HELPER_2(sdb, i32, i32, i64)
+DEF_HELPER_2(mdb, void, i32, i64)
+DEF_HELPER_2(ddb, void, i32, i64)
+DEF_HELPER_FLAGS_2(cebr, TCG_CALL_PURE, i32, i32, i32)
+DEF_HELPER_FLAGS_2(cdbr, TCG_CALL_PURE, i32, i32, i32)
+DEF_HELPER_FLAGS_2(cxbr, TCG_CALL_PURE, i32, i32, i32)
+DEF_HELPER_3(cgebr, i32, i32, i32, i32)
+DEF_HELPER_3(cgdbr, i32, i32, i32, i32)
+DEF_HELPER_3(cgxbr, i32, i32, i32, i32)
+DEF_HELPER_1(lzer, void, i32)
+DEF_HELPER_1(lzdr, void, i32)
+DEF_HELPER_1(lzxr, void, i32)
+DEF_HELPER_3(cfebr, i32, i32, i32, i32)
+DEF_HELPER_3(cfdbr, i32, i32, i32, i32)
+DEF_HELPER_3(cfxbr, i32, i32, i32, i32)
+DEF_HELPER_2(axbr, i32, i32, i32)
+DEF_HELPER_2(sxbr, i32, i32, i32)
+DEF_HELPER_2(meebr, void, i32, i32)
+DEF_HELPER_2(ddbr, void, i32, i32)
+DEF_HELPER_3(madb, void, i32, i64, i32)
+DEF_HELPER_3(maebr, void, i32, i32, i32)
+DEF_HELPER_3(madbr, void, i32, i32, i32)
+DEF_HELPER_3(msdbr, void, i32, i32, i32)
+DEF_HELPER_2(ldeb, void, i32, i64)
+DEF_HELPER_2(lxdb, void, i32, i64)
+DEF_HELPER_FLAGS_2(tceb, TCG_CALL_PURE, i32, i32, i64)
+DEF_HELPER_FLAGS_2(tcdb, TCG_CALL_PURE, i32, i32, i64)
+DEF_HELPER_FLAGS_2(tcxb, TCG_CALL_PURE, i32, i32, i64)
+DEF_HELPER_2(flogr, i32, i32, i64)
+DEF_HELPER_2(sqdbr, void, i32, i32)
+DEF_HELPER_FLAGS_1(cvd, TCG_CALL_PURE|TCG_CALL_CONST, i64, s32)
+DEF_HELPER_3(unpk, void, i32, i64, i64)
+DEF_HELPER_3(tr, void, i32, i64, i64)
+
+DEF_HELPER_2(servc, i32, i32, i64)
+DEF_HELPER_3(diag, i64, i32, i64, i64)
+DEF_HELPER_2(load_psw, void, i64, i64)
+DEF_HELPER_1(program_interrupt, void, i32)
+DEF_HELPER_FLAGS_1(stidp, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(spx, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(sck, TCG_CALL_CONST, i32, i64)
+DEF_HELPER_1(stck, i32, i64)
+DEF_HELPER_1(stcke, i32, i64)
+DEF_HELPER_FLAGS_1(sckc, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(stckc, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(spt, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(stpt, TCG_CALL_CONST, void, i64)
+DEF_HELPER_3(stsi, i32, i64, i32, i32)
+DEF_HELPER_3(lctl, void, i32, i64, i32)
+DEF_HELPER_3(lctlg, void, i32, i64, i32)
+DEF_HELPER_3(stctl, void, i32, i64, i32)
+DEF_HELPER_3(stctg, void, i32, i64, i32)
+DEF_HELPER_FLAGS_2(tprot, TCG_CALL_CONST, i32, i64, i64)
+DEF_HELPER_FLAGS_1(iske, TCG_CALL_PURE|TCG_CALL_CONST, i64, i64)
+DEF_HELPER_FLAGS_2(sske, TCG_CALL_CONST, void, i32, i64)
+DEF_HELPER_FLAGS_2(rrbe, TCG_CALL_CONST, i32, i32, i64)
+DEF_HELPER_2(csp, i32, i32, i32)
+DEF_HELPER_3(mvcs, i32, i64, i64, i64)
+DEF_HELPER_3(mvcp, i32, i64, i64, i64)
+DEF_HELPER_3(sigp, i32, i64, i32, i64)
+DEF_HELPER_1(sacf, void, i64)
+DEF_HELPER_FLAGS_2(ipte, TCG_CALL_CONST, void, i64, i64)
+DEF_HELPER_FLAGS_0(ptlb, TCG_CALL_CONST, void)
+DEF_HELPER_2(lra, i32, i64, i32)
+DEF_HELPER_2(stura, void, i64, i32)
+DEF_HELPER_2(cksm, void, i32, i32)
+
+DEF_HELPER_FLAGS_4(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
+                   i32, i32, i64, i64, i64)
+
+#include "def-helper.h"
diff --git a/target-s390x/helpers.h b/target-s390x/helpers.h
deleted file mode 100644
index 01c8d0e..0000000
--- a/target-s390x/helpers.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#include "def-helper.h"
-
-DEF_HELPER_1(exception, void, i32)
-DEF_HELPER_3(nc, i32, i32, i64, i64)
-DEF_HELPER_3(oc, i32, i32, i64, i64)
-DEF_HELPER_3(xc, i32, i32, i64, i64)
-DEF_HELPER_3(mvc, void, i32, i64, i64)
-DEF_HELPER_3(clc, i32, i32, i64, i64)
-DEF_HELPER_2(mvcl, i32, i32, i32)
-DEF_HELPER_FLAGS_1(set_cc_comp_s32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32)
-DEF_HELPER_FLAGS_1(set_cc_comp_s64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64)
-DEF_HELPER_FLAGS_2(set_cc_icm, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32)
-DEF_HELPER_3(clm, i32, i32, i32, i64)
-DEF_HELPER_3(stcm, void, i32, i32, i64)
-DEF_HELPER_2(mlg, void, i32, i64)
-DEF_HELPER_2(dlg, void, i32, i64)
-DEF_HELPER_FLAGS_3(set_cc_add64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64)
-DEF_HELPER_FLAGS_3(set_cc_addu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
-DEF_HELPER_FLAGS_3(set_cc_add32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32, s32, s32)
-DEF_HELPER_FLAGS_3(set_cc_addu32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
-DEF_HELPER_FLAGS_3(set_cc_sub64, TCG_CALL_PURE|TCG_CALL_CONST, i32, s64, s64, s64)
-DEF_HELPER_FLAGS_3(set_cc_subu64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
-DEF_HELPER_FLAGS_3(set_cc_sub32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32, s32, s32)
-DEF_HELPER_FLAGS_3(set_cc_subu32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
-DEF_HELPER_3(srst, i32, i32, i32, i32)
-DEF_HELPER_3(clst, i32, i32, i32, i32)
-DEF_HELPER_3(mvpg, void, i64, i64, i64)
-DEF_HELPER_3(mvst, void, i32, i32, i32)
-DEF_HELPER_3(csg, i32, i32, i64, i32)
-DEF_HELPER_3(cdsg, i32, i32, i64, i32)
-DEF_HELPER_3(cs, i32, i32, i64, i32)
-DEF_HELPER_4(ex, i32, i32, i64, i64, i64)
-DEF_HELPER_FLAGS_1(abs_i32, TCG_CALL_PURE|TCG_CALL_CONST, i32, s32)
-DEF_HELPER_FLAGS_1(nabs_i32, TCG_CALL_PURE|TCG_CALL_CONST, s32, s32)
-DEF_HELPER_FLAGS_1(abs_i64, TCG_CALL_PURE|TCG_CALL_CONST, i64, s64)
-DEF_HELPER_FLAGS_1(nabs_i64, TCG_CALL_PURE|TCG_CALL_CONST, s64, s64)
-DEF_HELPER_3(stcmh, void, i32, i64, i32)
-DEF_HELPER_3(icmh, i32, i32, i64, i32)
-DEF_HELPER_2(ipm, void, i32, i32)
-DEF_HELPER_FLAGS_3(addc_u32, TCG_CALL_PURE|TCG_CALL_CONST, i32, i32, i32, i32)
-DEF_HELPER_FLAGS_3(set_cc_addc_u64, TCG_CALL_PURE|TCG_CALL_CONST, i32, i64, i64, i64)
-DEF_HELPER_3(stam, void, i32, i64, i32)
-DEF_HELPER_3(lam, void, i32, i64, i32)
-DEF_HELPER_3(mvcle, i32, i32, i64, i32)
-DEF_HELPER_3(clcle, i32, i32, i64, i32)
-DEF_HELPER_3(slb, i32, i32, i32, i32)
-DEF_HELPER_4(slbg, i32, i32, i32, i64, i64)
-DEF_HELPER_2(cefbr, void, i32, s32)
-DEF_HELPER_2(cdfbr, void, i32, s32)
-DEF_HELPER_2(cxfbr, void, i32, s32)
-DEF_HELPER_2(cegbr, void, i32, s64)
-DEF_HELPER_2(cdgbr, void, i32, s64)
-DEF_HELPER_2(cxgbr, void, i32, s64)
-DEF_HELPER_2(adbr, i32, i32, i32)
-DEF_HELPER_2(aebr, i32, i32, i32)
-DEF_HELPER_2(sebr, i32, i32, i32)
-DEF_HELPER_2(sdbr, i32, i32, i32)
-DEF_HELPER_2(debr, void, i32, i32)
-DEF_HELPER_2(dxbr, void, i32, i32)
-DEF_HELPER_2(mdbr, void, i32, i32)
-DEF_HELPER_2(mxbr, void, i32, i32)
-DEF_HELPER_2(ldebr, void, i32, i32)
-DEF_HELPER_2(ldxbr, void, i32, i32)
-DEF_HELPER_2(lxdbr, void, i32, i32)
-DEF_HELPER_2(ledbr, void, i32, i32)
-DEF_HELPER_2(lexbr, void, i32, i32)
-DEF_HELPER_2(lpebr, i32, i32, i32)
-DEF_HELPER_2(lpdbr, i32, i32, i32)
-DEF_HELPER_2(lpxbr, i32, i32, i32)
-DEF_HELPER_2(ltebr, i32, i32, i32)
-DEF_HELPER_2(ltdbr, i32, i32, i32)
-DEF_HELPER_2(ltxbr, i32, i32, i32)
-DEF_HELPER_2(lcebr, i32, i32, i32)
-DEF_HELPER_2(lcdbr, i32, i32, i32)
-DEF_HELPER_2(lcxbr, i32, i32, i32)
-DEF_HELPER_2(aeb, void, i32, i32)
-DEF_HELPER_2(deb, void, i32, i32)
-DEF_HELPER_2(meeb, void, i32, i32)
-DEF_HELPER_2(cdb, i32, i32, i64)
-DEF_HELPER_2(adb, i32, i32, i64)
-DEF_HELPER_2(seb, void, i32, i32)
-DEF_HELPER_2(sdb, i32, i32, i64)
-DEF_HELPER_2(mdb, void, i32, i64)
-DEF_HELPER_2(ddb, void, i32, i64)
-DEF_HELPER_FLAGS_2(cebr, TCG_CALL_PURE, i32, i32, i32)
-DEF_HELPER_FLAGS_2(cdbr, TCG_CALL_PURE, i32, i32, i32)
-DEF_HELPER_FLAGS_2(cxbr, TCG_CALL_PURE, i32, i32, i32)
-DEF_HELPER_3(cgebr, i32, i32, i32, i32)
-DEF_HELPER_3(cgdbr, i32, i32, i32, i32)
-DEF_HELPER_3(cgxbr, i32, i32, i32, i32)
-DEF_HELPER_1(lzer, void, i32)
-DEF_HELPER_1(lzdr, void, i32)
-DEF_HELPER_1(lzxr, void, i32)
-DEF_HELPER_3(cfebr, i32, i32, i32, i32)
-DEF_HELPER_3(cfdbr, i32, i32, i32, i32)
-DEF_HELPER_3(cfxbr, i32, i32, i32, i32)
-DEF_HELPER_2(axbr, i32, i32, i32)
-DEF_HELPER_2(sxbr, i32, i32, i32)
-DEF_HELPER_2(meebr, void, i32, i32)
-DEF_HELPER_2(ddbr, void, i32, i32)
-DEF_HELPER_3(madb, void, i32, i64, i32)
-DEF_HELPER_3(maebr, void, i32, i32, i32)
-DEF_HELPER_3(madbr, void, i32, i32, i32)
-DEF_HELPER_3(msdbr, void, i32, i32, i32)
-DEF_HELPER_2(ldeb, void, i32, i64)
-DEF_HELPER_2(lxdb, void, i32, i64)
-DEF_HELPER_FLAGS_2(tceb, TCG_CALL_PURE, i32, i32, i64)
-DEF_HELPER_FLAGS_2(tcdb, TCG_CALL_PURE, i32, i32, i64)
-DEF_HELPER_FLAGS_2(tcxb, TCG_CALL_PURE, i32, i32, i64)
-DEF_HELPER_2(flogr, i32, i32, i64)
-DEF_HELPER_2(sqdbr, void, i32, i32)
-DEF_HELPER_FLAGS_1(cvd, TCG_CALL_PURE|TCG_CALL_CONST, i64, s32)
-DEF_HELPER_3(unpk, void, i32, i64, i64)
-DEF_HELPER_3(tr, void, i32, i64, i64)
-
-DEF_HELPER_2(servc, i32, i32, i64)
-DEF_HELPER_3(diag, i64, i32, i64, i64)
-DEF_HELPER_2(load_psw, void, i64, i64)
-DEF_HELPER_1(program_interrupt, void, i32)
-DEF_HELPER_FLAGS_1(stidp, TCG_CALL_CONST, void, i64)
-DEF_HELPER_FLAGS_1(spx, TCG_CALL_CONST, void, i64)
-DEF_HELPER_FLAGS_1(sck, TCG_CALL_CONST, i32, i64)
-DEF_HELPER_1(stck, i32, i64)
-DEF_HELPER_1(stcke, i32, i64)
-DEF_HELPER_FLAGS_1(sckc, TCG_CALL_CONST, void, i64)
-DEF_HELPER_FLAGS_1(stckc, TCG_CALL_CONST, void, i64)
-DEF_HELPER_FLAGS_1(spt, TCG_CALL_CONST, void, i64)
-DEF_HELPER_FLAGS_1(stpt, TCG_CALL_CONST, void, i64)
-DEF_HELPER_3(stsi, i32, i64, i32, i32)
-DEF_HELPER_3(lctl, void, i32, i64, i32)
-DEF_HELPER_3(lctlg, void, i32, i64, i32)
-DEF_HELPER_3(stctl, void, i32, i64, i32)
-DEF_HELPER_3(stctg, void, i32, i64, i32)
-DEF_HELPER_FLAGS_2(tprot, TCG_CALL_CONST, i32, i64, i64)
-DEF_HELPER_FLAGS_1(iske, TCG_CALL_PURE|TCG_CALL_CONST, i64, i64)
-DEF_HELPER_FLAGS_2(sske, TCG_CALL_CONST, void, i32, i64)
-DEF_HELPER_FLAGS_2(rrbe, TCG_CALL_CONST, i32, i32, i64)
-DEF_HELPER_2(csp, i32, i32, i32)
-DEF_HELPER_3(mvcs, i32, i64, i64, i64)
-DEF_HELPER_3(mvcp, i32, i64, i64, i64)
-DEF_HELPER_3(sigp, i32, i64, i32, i64)
-DEF_HELPER_1(sacf, void, i64)
-DEF_HELPER_FLAGS_2(ipte, TCG_CALL_CONST, void, i64, i64)
-DEF_HELPER_FLAGS_0(ptlb, TCG_CALL_CONST, void)
-DEF_HELPER_2(lra, i32, i64, i32)
-DEF_HELPER_2(stura, void, i64, i32)
-DEF_HELPER_2(cksm, void, i32, i32)
-
-DEF_HELPER_FLAGS_4(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
-                   i32, i32, i64, i64, i64)
-
-#include "def-helper.h"
diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
index 137bae7..4020b26 100644
--- a/target-s390x/op_helper.c
+++ b/target-s390x/op_helper.c
@@ -21,7 +21,7 @@
 #include "cpu.h"
 #include "dyngen-exec.h"
 #include "host-utils.h"
-#include "helpers.h"
+#include "helper.h"
 #include <string.h>
 #include "kvm.h"
 #include "qemu-timer.h"
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index ee15672..9fef77c 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -43,9 +43,9 @@
 static TCGv_ptr cpu_env;
 
 #include "gen-icount.h"
-#include "helpers.h"
+#include "helper.h"
 #define GEN_HELPER 1
-#include "helpers.h"
+#include "helper.h"
 
 typedef struct DisasContext DisasContext;
 struct DisasContext {
diff --git a/target-xtensa/helper.h b/target-xtensa/helper.h
new file mode 100644
index 0000000..09ab332
--- /dev/null
+++ b/target-xtensa/helper.h
@@ -0,0 +1,32 @@
+#include "def-helper.h"
+
+DEF_HELPER_1(exception, void, i32)
+DEF_HELPER_2(exception_cause, void, i32, i32)
+DEF_HELPER_3(exception_cause_vaddr, void, i32, i32, i32)
+DEF_HELPER_1(nsa, i32, i32)
+DEF_HELPER_1(nsau, i32, i32)
+DEF_HELPER_1(wsr_windowbase, void, i32)
+DEF_HELPER_3(entry, void, i32, i32, i32)
+DEF_HELPER_1(retw, i32, i32)
+DEF_HELPER_1(rotw, void, i32)
+DEF_HELPER_2(window_check, void, i32, i32)
+DEF_HELPER_0(restore_owb, void)
+DEF_HELPER_1(movsp, void, i32)
+DEF_HELPER_1(wsr_lbeg, void, i32)
+DEF_HELPER_1(wsr_lend, void, i32)
+DEF_HELPER_1(simcall, void, env)
+DEF_HELPER_0(dump_state, void)
+
+DEF_HELPER_2(waiti, void, i32, i32)
+DEF_HELPER_2(timer_irq, void, i32, i32)
+DEF_HELPER_1(advance_ccount, void, i32)
+DEF_HELPER_1(check_interrupts, void, env)
+
+DEF_HELPER_1(wsr_rasid, void, i32)
+DEF_HELPER_2(rtlb0, i32, i32, i32)
+DEF_HELPER_2(rtlb1, i32, i32, i32)
+DEF_HELPER_2(itlb, void, i32, i32)
+DEF_HELPER_2(ptlb, i32, i32, i32)
+DEF_HELPER_3(wtlb, void, i32, i32, i32)
+
+#include "def-helper.h"
diff --git a/target-xtensa/helpers.h b/target-xtensa/helpers.h
deleted file mode 100644
index 09ab332..0000000
--- a/target-xtensa/helpers.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "def-helper.h"
-
-DEF_HELPER_1(exception, void, i32)
-DEF_HELPER_2(exception_cause, void, i32, i32)
-DEF_HELPER_3(exception_cause_vaddr, void, i32, i32, i32)
-DEF_HELPER_1(nsa, i32, i32)
-DEF_HELPER_1(nsau, i32, i32)
-DEF_HELPER_1(wsr_windowbase, void, i32)
-DEF_HELPER_3(entry, void, i32, i32, i32)
-DEF_HELPER_1(retw, i32, i32)
-DEF_HELPER_1(rotw, void, i32)
-DEF_HELPER_2(window_check, void, i32, i32)
-DEF_HELPER_0(restore_owb, void)
-DEF_HELPER_1(movsp, void, i32)
-DEF_HELPER_1(wsr_lbeg, void, i32)
-DEF_HELPER_1(wsr_lend, void, i32)
-DEF_HELPER_1(simcall, void, env)
-DEF_HELPER_0(dump_state, void)
-
-DEF_HELPER_2(waiti, void, i32, i32)
-DEF_HELPER_2(timer_irq, void, i32, i32)
-DEF_HELPER_1(advance_ccount, void, i32)
-DEF_HELPER_1(check_interrupts, void, env)
-
-DEF_HELPER_1(wsr_rasid, void, i32)
-DEF_HELPER_2(rtlb0, i32, i32, i32)
-DEF_HELPER_2(rtlb1, i32, i32, i32)
-DEF_HELPER_2(itlb, void, i32, i32)
-DEF_HELPER_2(ptlb, i32, i32, i32)
-DEF_HELPER_3(wtlb, void, i32, i32, i32)
-
-#include "def-helper.h"
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c
index 0605611..2c3dc2e 100644
--- a/target-xtensa/op_helper.c
+++ b/target-xtensa/op_helper.c
@@ -27,7 +27,7 @@
 
 #include "cpu.h"
 #include "dyngen-exec.h"
-#include "helpers.h"
+#include "helper.h"
 #include "host-utils.h"
 
 static void do_unaligned_access(target_ulong addr, int is_write, int is_user,
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index c81450d..8b9d9ed 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -37,9 +37,9 @@
 #include "qemu-log.h"
 #include "sysemu.h"
 
-#include "helpers.h"
+#include "helper.h"
 #define GEN_HELPER 1
-#include "helpers.h"
+#include "helper.h"
 
 typedef struct DisasContext {
     const XtensaConfig *config;
@@ -169,7 +169,7 @@ void xtensa_translate_init(void)
         }
     }
 #define GEN_HELPER 2
-#include "helpers.h"
+#include "helper.h"
 }
 
 static inline bool option_bits_enabled(DisasContext *dc, uint64_t opt)
diff --git a/xtensa-semi.c b/xtensa-semi.c
index ba0e828..21d1912 100644
--- a/xtensa-semi.c
+++ b/xtensa-semi.c
@@ -31,7 +31,7 @@
 #include <stddef.h>
 #include "cpu.h"
 #include "dyngen-exec.h"
-#include "helpers.h"
+#include "helper.h"
 #include "qemu-log.h"
 
 enum {

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (3 preceding siblings ...)
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h Lluís Vilanova
@ 2011-12-08 22:49 ` Lluís Vilanova
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines Lluís Vilanova
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:49 UTC (permalink / raw)
  To: qemu-devel

This adds:

* zip_lists: Pair elements from two lists.
* get_argtypes: Get the list of types of the arguments; can optionally transform
  the types in the process.

The function 'get_args' is modified to use a combination of 'get_argnames',
'get_argtypes', 'zip_lists' and, optionally, use the type transformation
capabilities of 'get_argtypes'.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool |  117 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 1 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 4c9951d..f2b6680 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -74,15 +74,130 @@ has_property()
     return 1
 }
 
+# Convenience function to pair elements from two comma-separated lists of equal
+# size.
+# 1: first list
+# 2: second list
+# 3: printf format for each pair of elements (optional, default: "%s %s, ")
+zip_lists()
+{
+    [ -n "$1" -a -n "$2" ] || return
+
+    local format
+    format=$3
+    [ -n "$format" ] || format="%s %s, "
+
+    local i elem accum
+    i=1
+    accum=""
+    for elem in $1; do
+        if [ "$elem" = "${elem%,}" ]; then
+            accum="$accum $elem"
+        else
+            accum="$accum ${elem%,}"
+            eval __elem_$i=\"$accum\"
+            i=$(($i + 1))
+            accum=""
+        fi
+    done
+    eval __elem_$i=\"$accum\"
+
+    local tmp res
+    accum=""
+    res=""
+    i=1
+    for elem in $2; do
+        if [ "$elem" = "${elem%,}" ]; then
+            accum="$accum $elem"
+        else
+            accum="$accum ${elem%,}"
+            eval tmp=\$__elem_$i
+            tmp=$(printf "$format" "$tmp" "$accum")
+            res="$res$tmp"
+            i=$(($i + 1))
+            accum=""
+        fi
+    done
+    eval tmp=\$__elem_$i
+    tmp=$(printf "$format" "$tmp" "$accum")
+    res="$res$tmp"
+    res="${res%, }"
+    echo $res
+}
+
 # Get the argument list of a trace event, including types and names
+# 1: event name
+# 2: passed as the second argument to 'get_argtypes' (optional)
 get_args()
 {
     local args
     args=${1#*\(}
     args=${args%%\)*}
-    echo "$args"
+
+    if [ -z "$2" -o "$args" = "void" ]; then
+        echo "$args"
+    else
+        local argtypes argnames res
+        argtypes=$(get_argtypes "$1" $2)
+        argnames=$(get_argnames "$1" ",")
+        res=$(zip_lists "$argtypes" "$argnames")
+        echo "${res#, }"
+    fi
 }
 
+# Get the argument type list of a trace event
+# 1: event name
+# 2: function to translate each of the types (optional, default: nil_type)
+get_argtypes()
+{
+    local translate field type res
+
+    translate=$2
+    [ -n "$translate" ] || translate=nil_type
+
+    res=""
+    type=""
+    for field in $(get_args "$1"); do
+        if [ "${field%,}" != "${field}" ]; then
+            # it's a name, but can have a star in it
+            [ "${field#\*}" = "$field" ] || type="${type}*"
+            # trim spaces
+            type="${type## }"
+            type="${type%% }"
+            # translate
+            type=$($translate "$type")
+            res="$res$type, "
+            type=""
+        else
+            # types can have spaces
+            type="$type $field"
+        fi
+    done
+
+    # remove the accumulated name
+    field="${type##* }"
+    type="${type% *}"
+
+    # trim spaces
+    type="${type## }"
+    type="${type%% }"
+
+    # it's a name, but can have a star in it
+    [ "${field#\*}" = "$field" ] || type="${type}*"
+    # translate
+    type=$($translate "$type")
+    res="$res$type"
+
+    echo $res
+}
+
+# No-op type translator for get_argtypes
+nil_type()
+{
+    echo "$1"
+}
+
+
 # Get the argument name list of a trace event
 get_argnames()
 {

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (4 preceding siblings ...)
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments Lluís Vilanova
@ 2011-12-08 22:49 ` Lluís Vilanova
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations Lluís Vilanova
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:49 UTC (permalink / raw)
  To: qemu-devel

All backends now use 'get_api_name' to build the name of the routines that are
used by QEMU code when invoking trace points. This is built based on the value
of 'get_api_name_fmt_default'.

The old 'get_name' is still available to refer to the name of an event.

This ensures proper naming across tracing backends.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index f2b6680..853f1bd 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -57,6 +57,19 @@ get_name()
     echo "${name##* }"
 }
 
+get_api_name_fmt_default="trace_%s"
+
+# Get the tracepoint name of a trace event (the name of the function QEMU uses)
+# The result is 'printf "$fmt" $name', where 'fmt' is
+# 'get_api_name_fmt_default'.
+get_api_name()
+{
+    local name fmt
+    name=$(get_name "$1")
+    fmt="$get_api_name_fmt_default"
+    printf "$fmt" "$name"
+}
+
 # Get the given property of a trace event
 # 1: trace-events line
 # 2: property name
@@ -248,13 +261,13 @@ linetoh_begin_nop()
 
 linetoh_nop()
 {
-    local name args
-    name=$(get_name "$1")
+    local api args
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
 
     # Define an empty function for the trace event
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
 }
 EOF
@@ -300,8 +313,8 @@ cast_args_to_uint64_t()
 
 linetoh_simple()
 {
-    local name args argc trace_args
-    name=$(get_name "$1")
+    local api args argc trace_args
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argc=$(get_argc "$1")
 
@@ -312,7 +325,7 @@ linetoh_simple()
     fi
 
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
     trace$argc($trace_args);
 }
@@ -372,8 +385,9 @@ EOF
 
 linetoh_stderr()
 {
-    local name args argnames argc fmt
+    local name api args argnames argc fmt
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1" ",")
     argc=$(get_argc "$1")
@@ -384,7 +398,7 @@ linetoh_stderr()
     fi
 
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
     if (trace_list[$stderr_event_num].state != 0) {
         fprintf(stderr, "$name " $fmt "\n" $argnames);
@@ -448,14 +462,15 @@ linetoh_begin_ust()
 
 linetoh_ust()
 {
-    local name args argnames
+    local name api args argnames
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
 
     cat <<EOF
 DECLARE_TRACE(ust_$name, TP_PROTO($args), TP_ARGS($argnames));
-#define trace_$name trace_ust_$name
+#define ${api} trace_ust_$name
 EOF
 }
 
@@ -520,8 +535,9 @@ EOF
 
 linetoh_dtrace()
 {
-    local name args argnames nameupper
+    local name api args argnames nameupper
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
 
@@ -529,7 +545,7 @@ linetoh_dtrace()
 
     # Define an empty function for the trace event
     cat <<EOF
-static inline void trace_$name($args) {
+static inline void ${api}($args) {
     if (QEMU_${nameupper}_ENABLED()) {
         QEMU_${nameupper}($argnames);
     }

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (5 preceding siblings ...)
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines Lluís Vilanova
@ 2011-12-08 22:49 ` Lluís Vilanova
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines Lluís Vilanova
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:49 UTC (permalink / raw)
  To: qemu-devel

When found, TCG types are translated into the host native types when declaring
and defining the tracing routines in "trace.h" and "trace.c".
---
 scripts/tracetool |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 853f1bd..1d8a637 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -210,6 +210,21 @@ nil_type()
     echo "$1"
 }
 
+# Native type translator for get_argtypes
+# (e.g., TCGv_i32 -> uint32_t)
+host_type()
+{
+    case "$1" in
+        "TCGv_i32") echo "uint32_t" ;;
+        "TCGv_i64") echo "uint64_t" ;;
+        "TCGv_ptr") echo "void *"   ;;
+        # force a fixed-size type in trace.{h,c}
+        # (ideally would use a host-specific type)
+        "TCGv")     echo "uint64_t" ;;
+        *)          echo "$1"       ;;
+    esac
+}
+
 
 # Get the argument name list of a trace event
 get_argnames()
@@ -263,7 +278,7 @@ linetoh_nop()
 {
     local api args
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
 
     # Define an empty function for the trace event
     cat <<EOF
@@ -315,7 +330,7 @@ linetoh_simple()
 {
     local api args argc trace_args
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argc=$(get_argc "$1")
 
     trace_args="$simple_event_num"
@@ -388,7 +403,7 @@ linetoh_stderr()
     local name api args argnames argc fmt
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1" ",")
     argc=$(get_argc "$1")
     fmt=$(get_fmt "$1")
@@ -465,7 +480,7 @@ linetoh_ust()
     local name api args argnames
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
 
     cat <<EOF
@@ -492,7 +507,7 @@ linetoc_ust()
 {
     local name args argnames fmt
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
     [ -z "$argnames" ] || argnames=", $argnames"
     fmt=$(get_fmt "$1")
@@ -538,7 +553,7 @@ linetoh_dtrace()
     local name api args argnames nameupper
     name=$(get_name "$1")
     api=$(get_api_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     argnames=$(get_argnames "$1", ",")
 
     nameupper=`echo $name | tr '[:lower:]' '[:upper:]'`
@@ -585,7 +600,7 @@ linetod_dtrace()
 {
     local name args
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
 
     # DTrace provider syntax expects foo() for empty
     # params, not foo(void)
@@ -615,7 +630,7 @@ linetostap_dtrace()
 {
     local i arg name args arglist
     name=$(get_name "$1")
-    args=$(get_args "$1")
+    args=$(get_args "$1" host_type)
     arglist=$(get_argnames "$1", "")
 
     # Define prototype for probe arguments

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (6 preceding siblings ...)
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations Lluís Vilanova
@ 2011-12-08 22:49 ` Lluís Vilanova
  2011-12-08 22:50 ` [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define " Lluís Vilanova
  2011-12-08 22:50 ` [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers Lluís Vilanova
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:49 UTC (permalink / raw)
  To: qemu-devel

Generate the necessary TCG helper declarations for tracing events in guest code.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 .gitignore             |    1 
 Makefile               |    2 
 Makefile.objs          |    9 ++
 def-helper.h           |    9 ++
 scripts/simpletrace.py |    2 
 scripts/tracetool      |  202 ++++++++++++++++++++++++++++++++++++++++++++++--
 6 files changed, 214 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 406f75f..d47b586 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ trace.h
 trace.c
 trace-dtrace.h
 trace-dtrace.dtrace
+trace-tcg-helper.h
 *-timestamp
 *-softmmu
 *-darwin-user
diff --git a/Makefile b/Makefile
index 506db1b..516622a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ BUILD_DIR=$(CURDIR)
 
 GENERATED_HEADERS = config-host.h qemu-options.def
 
-GENERATED_HEADERS += trace.h
+GENERATED_HEADERS += trace.h trace-tcg-helper.h
 ifeq ($(TRACE_BACKEND),dtrace)
 GENERATED_HEADERS += trace-dtrace.h
 endif
diff --git a/Makefile.objs b/Makefile.objs
index d7a6539..8f97709 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -398,6 +398,15 @@ trace-obj-y += $(addprefix trace/, $(trace-nested-y))
 $(trace-obj-y): $(GENERATED_HEADERS)
 
 ######################################################################
+# trace tcg
+
+trace-tcg-helper.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool $(TRACETOOL_EXTRA) --tcg --tcg-h < $< > $@,"  GEN	$(TARGET_DIR)trace-tcg-helper.h")
+	@cmp -s $@ trace-tcg-helper.h || cp $@ trace-tcg-helper.h
+
+trace-tcg-helper.h: trace-tcg-helper.h-timestamp
+
+######################################################################
 # smartcard
 
 libcacard-y = cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o card_7816.o
diff --git a/def-helper.h b/def-helper.h
index 8a822c7..c4fce2d 100644
--- a/def-helper.h
+++ b/def-helper.h
@@ -13,6 +13,11 @@
    helper.c, defining:
     GEN_HELPER 1 to produce op generation functions (gen_helper_*)
     GEN_HELPER 2 to do runtime registration helper functions.
+
+   After including this header the GEN_HELPER_MACRO will have the following
+   values:
+    1  : op generation functions were produced (GEN_HELPER was 1)
+    -1 : otherwise
  */
 
 #ifndef DEF_HELPER_H
@@ -142,6 +147,7 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
 
 #undef GEN_HELPER
 #define GEN_HELPER -1
+#define GEN_HELPER_CODE -1
 
 #elif GEN_HELPER == 1
 /* Gen functions.  */
@@ -205,6 +211,7 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) dh_arg_decl(t1, 1
 
 #undef GEN_HELPER
 #define GEN_HELPER -1
+#define GEN_HELPER_CODE 1
 
 #elif GEN_HELPER == 2
 /* Register helpers.  */
@@ -226,6 +233,7 @@ DEF_HELPER_FLAGS_0(name, flags, ret)
 
 #undef GEN_HELPER
 #define GEN_HELPER -1
+#define GEN_HELPER_CODE -1
 
 #elif GEN_HELPER == -1
 /* Undefine macros.  */
@@ -236,5 +244,6 @@ DEF_HELPER_FLAGS_0(name, flags, ret)
 #undef DEF_HELPER_FLAGS_3
 #undef DEF_HELPER_FLAGS_4
 #undef GEN_HELPER
+#undef GEN_HELPER_CODE
 
 #endif
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index f55e5e6..3476d6c 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -20,7 +20,7 @@ dropped_event_id = 0xfffffffffffffffe
 
 trace_fmt = '=QQQQQQQQ'
 trace_len = struct.calcsize(trace_fmt)
-event_re  = re.compile(r'(disable\s+)?([a-zA-Z0-9_]+)\(([^)]*)\).*')
+event_re  = re.compile(r'(disable\s+|tcg\s+|tcg-vcpu\s+)*([a-zA-Z0-9_]+)\(([^)]*)\).*')
 
 def parse_events(fobj):
     """Parse a trace-events file into {event_num: (name, arg1, ...)}."""
diff --git a/scripts/tracetool b/scripts/tracetool
index 1d8a637..5431f2d 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -13,7 +13,7 @@ set -f
 usage()
 {
     cat >&2 <<EOF
-usage: $0 [--nop | --simple | --stderr | --ust | --dtrace] [-h | -c]
+usage: $0 [--nop | --simple | --stderr | --ust | --dtrace | --tcg] [-h | -c]
 Generate tracing code for a file on stdin.
 
 Backends:
@@ -22,12 +22,14 @@ Backends:
   --stderr  Stderr built-in backend
   --ust     LTTng User Space Tracing backend
   --dtrace  DTrace/SystemTAP backend
+  --tcg     Intermediate TCG helper to real backend proxy
 
 Output formats:
-  -h     Generate .h file
-  -c     Generate .c file
-  -d     Generate .d file (DTrace only)
-  --stap Generate .stp file (DTrace with SystemTAP only)
+  -h      Generate .h file
+  -c      Generate .c file
+  -d      Generate .d file (DTrace only)
+  --stap  Generate .stp file (DTrace with SystemTAP only)
+  --tcg-h Generate trace-tcg-helper.h file (tcg only)
 
 Options:
   --binary       [path]    Full path to QEMU binary
@@ -218,13 +220,57 @@ host_type()
         "TCGv_i32") echo "uint32_t" ;;
         "TCGv_i64") echo "uint64_t" ;;
         "TCGv_ptr") echo "void *"   ;;
-        # force a fixed-size type in trace.{h,c}
-        # (ideally would use a host-specific type)
-        "TCGv")     echo "uint64_t" ;;
+        "TCGv")
+            if [ "$backend" = "tcg" ]; then
+                echo "target_ulong"
+            else
+                # force a fixed-size type in trace.{h,c}
+                # (ideally would use a host-specific type)
+                echo "uint64_t"
+            fi
+            ;;
         *)          echo "$1"       ;;
     esac
 }
 
+tcg_compat_type()
+{
+    case "$1" in
+        "uint8_t") echo "uint32_t" ;;
+        *)         echo "$1" ;;
+    esac
+}
+
+tcg_type()
+{
+    local tcg_compat_type
+    tcg_compat_type=`tcg_compat_type "$1"`
+    case "$tcg_compat_type" in
+        "uint32_t") echo "TCGv_i32" ;;
+        "uint64_t") echo "TCGv_i64" ;;
+        "void*")    echo "TCGv_ptr" ;;
+        "TCGv"*)    echo "$1"       ;;
+        *)          echo "Don't know how to translate type $1 into a TCG type" >&2
+                    exit 1
+                    ;;
+    esac
+}
+
+tcg_helper_decl_type()
+{
+    local type
+    type=`tcg_type "$1"`
+    case "$type" in
+        "TCGv")     echo "tl"  ;;
+        "TCGv_ptr") echo "ptr" ;;
+        "TCGv_i32") echo "i32" ;;
+        "TCGv_i64") echo "i64" ;;
+        *)          echo "Don't know how to translate type $1 into a TCG helper declaration type" >&2
+                    exit 1
+                    ;;
+    esac
+}
+
 
 # Get the argument name list of a trace event
 get_argnames()
@@ -662,6 +708,127 @@ linetostap_end_dtrace()
     return
 }
 
+linetotcg_h_nop()
+{
+    local has_tcg has_tcg_vcpu
+    has_property "$1" "tcg" && has_tcg=1
+    has_property "$1" "tcg-vcpu" && has_tcg_vcpu=1
+    if [ "$has_tcg" != "1" -a "$has_tcg_vcpu" != "1" ]; then
+        return
+    fi
+
+    local api
+    api=$(get_api_name "$1")
+
+    cat <<EOF
+#if GEN_HELPER_CODE == 1
+static inline void gen_helper_${api}($(get_args "$1"))
+{
+}
+#endif
+EOF
+}
+
+tcg_temp_new_type()
+{
+    local compat_type
+    compat_type=`tcg_compat_type "$1"`
+    case "$compat_type" in
+        "uint32_t") echo "tcg_const_i32" ;;
+        "uint64_t") echo "tcg_const_i64" ;;
+        "void *")   echo "tcg_cont_ptr" ;;
+        *) echo "" ;;
+    esac
+}
+
+tcg_temp_free_type()
+{
+    local compat_type
+    compat_type=`tcg_compat_type "$1"`
+    case "$compat_type" in
+        "uint32_t") echo "tcg_temp_free_i32" ;;
+        "uint64_t") echo "tcg_temp_free_i64" ;;
+        "void *")   echo "tcg_temp_free_ptr" ;;
+        # do nothing on non-temp values
+        *)          echo "tcg_temp_noop" ;;
+    esac
+}
+
+linetotcg_h_tcg()
+{
+    local has_tcg has_tcg_vcpu
+    has_property "$1" "tcg" && has_tcg=1
+    has_property "$1" "tcg-vcpu" && has_tcg_vcpu=1
+    if [ "$has_tcg" != "1" -a "$has_tcg_vcpu" != "1" ]; then
+        return
+    fi
+
+    local api argc
+    api=$(get_api_name "$1")
+    argc=$(get_argc "$1")
+
+    # TCG helper proxy declaration
+    local proxy_argtypes
+    if [ $argc -ne 0 ]; then
+        proxy_argtypes=$(get_argtypes "$1" tcg_helper_decl_type)
+        proxy_argtypes=", $proxy_argtypes"
+    fi
+    if [ "$has_tcg_vcpu" = "1" ]; then
+        if [ "$has_tcg" = "1" ]; then
+            echo "Cannot have both \"tcg\" and \"tcg-vcpu\" properties" >&2
+            exit 1
+        fi
+        echo "DEF_HELPER_$argc(${api}_proxy, void$proxy_argtypes)"
+    else
+        echo "DEF_HELPER_FLAGS_$argc(${api}_proxy, TCG_CALL_CONST, void$proxy_argtypes)"
+    fi
+
+    # mixed-type to TCG helper bridge
+    local argnames argname temps_names
+    local temps_tcg_new temps_argtypes temps_new
+    local temps_tcg_free temps_free
+    if [ $argc -ne 0 ]; then
+        argnames=$(get_argnames "$1" ",")
+        temps_names=""
+        for argname in $argnames; do
+            temps_names="${temps_names} __${argname}"
+        done
+
+        temps_tcg_new=$(get_argtypes "$1" tcg_temp_new_type)
+        temps_new=$(zip_lists "$temps_tcg_new" "$argnames" "%s(%s), ")
+        temps_new=$(zip_lists "$temps_names" "$temps_new" "%s =%s, ")
+        temps_argtypes=$(get_argtypes "$1" tcg_type)
+        temps_new=$(zip_lists "$temps_argtypes" "$temps_new" "%s %s;")
+
+        tcg_temp_free=$(get_argtypes "$1" tcg_temp_free_type)
+        temps_free=$(zip_lists "$tcg_temp_free" "$temps_names" "%s(%s);")
+    fi
+    cat <<EOF
+#if GEN_HELPER_CODE == 1
+static inline void gen_helper_${api}($(get_args "$1"))
+{
+    $temps_new
+    gen_helper_${api}_proxy($temps_names);
+    $temps_free
+}
+#endif
+EOF
+}
+
+linetotcg_h_begin_tcg()
+{
+    cat <<EOF
+/* This file is autogenerated by tracetool, do not edit. */
+
+#define tcg_temp_noop(v)
+EOF
+}
+
+linetotcg_h_end_tcg()
+{
+    return
+}
+
 # Process stdin by calling begin, line, and end functions for the backend
 convert()
 {
@@ -744,6 +911,20 @@ tracetostap()
     convert stap
 }
 
+tracetotcg_h()
+{
+    if [ $backend != "tcg" ]; then
+        echo "TCG helper generator not applicable to $backend backend" >&2
+        exit 1
+    fi
+    convert tcg_h
+    cat <<EOF
+#if GEN_HELPER_CODE == 1
+#include "trace.h"
+#endif
+EOF
+}
+
 
 backend=
 output=
@@ -756,7 +937,9 @@ probeprefix=
 until [ -z "$1" ]
 do
   case "$1" in
-    "--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace") backend="${1#--}" ;;
+    "--nop" | "--simple" | "--stderr" | "--ust" | "--dtrace" | "--tcg")
+          backend="${1#--}"
+          ;;
 
     "--binary") shift ; binary="$1" ;;
     "--target-arch") shift ; targetarch="$1" ;;
@@ -765,6 +948,7 @@ do
 
     "-h" | "-c" | "-d") output="${1#-}" ;;
     "--stap") output="${1#--}" ;;
+    "--tcg-h") output="tcg_h" ;;
 
     "--check-backend") exit 0 ;; # used by ./configure to test for backend
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing helper routines
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (7 preceding siblings ...)
  2011-12-08 22:49 ` [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines Lluís Vilanova
@ 2011-12-08 22:50 ` Lluís Vilanova
  2011-12-08 22:50 ` [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers Lluís Vilanova
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:50 UTC (permalink / raw)
  To: qemu-devel

Generate the necessary TCG helper routines for tracing events in guest code.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 .gitignore        |    1 +
 Makefile          |    2 +-
 Makefile.objs     |    8 +++++++
 Makefile.target   |    2 ++
 scripts/tracetool |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index d47b586..1a6de79 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ trace.c
 trace-dtrace.h
 trace-dtrace.dtrace
 trace-tcg-helper.h
+trace-tcg-helper.c
 *-timestamp
 *-softmmu
 *-darwin-user
diff --git a/Makefile b/Makefile
index 516622a..b1d1249 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ GENERATED_HEADERS += trace.h trace-tcg-helper.h
 ifeq ($(TRACE_BACKEND),dtrace)
 GENERATED_HEADERS += trace-dtrace.h
 endif
-GENERATED_SOURCES += trace.c
+GENERATED_SOURCES += trace.c trace-tcg-helper.c
 
 GENERATED_HEADERS += qmp-commands.h qapi-types.h qapi-visit.h
 GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c
diff --git a/Makefile.objs b/Makefile.objs
index 8f97709..f153fa5 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -406,6 +406,14 @@ trace-tcg-helper.h-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.
 
 trace-tcg-helper.h: trace-tcg-helper.h-timestamp
 
+trace-tcg-helper.c-timestamp: $(SRC_PATH)/trace-events $(BUILD_DIR)/config-host.mak
+	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool $(TRACETOOL_EXTRA) --tcg --tcg-c < $< > $@,"  GEN   $(TARGET_DIR)trace-tcg-helper.c")
+	@cmp -s $@ trace-tcg-helper.c || cp $@ trace-tcg-helper.c
+
+trace-tcg-helper.c: trace-tcg-helper.c-timestamp
+
+trace-tcg-helper.o: trace-tcg-helper.c $(GENERATED_HEADERS)
+
 ######################################################################
 # smartcard
 
diff --git a/Makefile.target b/Makefile.target
index a111521..8b3ffd6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -90,6 +90,8 @@ libobj-$(CONFIG_TCI_DIS) += tci-dis.o
 
 tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci
 
+libobj-y += trace-tcg-helper.o
+
 $(libobj-y): $(GENERATED_HEADERS)
 
 # libqemu
diff --git a/scripts/tracetool b/scripts/tracetool
index 5431f2d..197739a 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -30,6 +30,7 @@ Output formats:
   -d      Generate .d file (DTrace only)
   --stap  Generate .stp file (DTrace with SystemTAP only)
   --tcg-h Generate trace-tcg-helper.h file (tcg only)
+  --tcg-c Generate trace-tcg-helper.c file (tcg only)
 
 Options:
   --binary       [path]    Full path to QEMU binary
@@ -241,6 +242,13 @@ tcg_compat_type()
     esac
 }
 
+host_tcg_compat_type()
+{
+    local tcg_compat_type
+    tcg_compat_type=`tcg_compat_type "$1"`
+    host_type "$tcg_compat_type"
+}
+
 tcg_type()
 {
     local tcg_compat_type
@@ -829,6 +837,53 @@ linetotcg_h_end_tcg()
     return
 }
 
+linetotcg_c_nop()
+{
+    return
+}
+
+linetotcg_c_tcg()
+{
+    local has_tcg has_tcg_vcpu
+    has_property "$1" "tcg" && has_tcg=1
+    has_property "$1" "tcg-vcpu" && has_tcg_vcpu=1
+    if [ "$has_tcg" != "1" -a "$has_tcg_vcpu" != "1" ]; then
+        return
+    fi
+
+    # TCG-compatible to actual type conversion bridge
+    local api args argtypes argnames values
+    api=$(get_api_name "$1")
+    args=$(get_args "$1" host_tcg_compat_type)
+    argnames=$(get_argnames "$1" ",")
+    argtypes=$(get_argtypes "$1" host_type)
+    values=$(zip_lists "$argtypes" "$argnames" "(%s)%s, ")
+    values=${values%, }
+
+    cat <<EOF
+void helper_${api}_proxy($args)
+{
+    ${api}($values);
+}
+EOF
+}
+
+linetotcg_c_begin_tcg()
+{
+    cat <<EOF
+/* This file is autogenerated by tracetool, do not edit. */
+
+#define TRACE_TCG_HELPER
+#include "trace.h"
+#include "helper.h"
+EOF
+}
+
+linetotcg_c_end_tcg()
+{
+    return
+}
+
 # Process stdin by calling begin, line, and end functions for the backend
 convert()
 {
@@ -925,6 +980,15 @@ tracetotcg_h()
 EOF
 }
 
+tracetotcg_c()
+{
+    if [ $backend != "tcg" ]; then
+        echo "TCG helper generator not applicable to $backend backend" >&2
+        exit 1
+    fi
+    convert tcg_c
+}
+
 
 backend=
 output=
@@ -949,6 +1013,7 @@ do
     "-h" | "-c" | "-d") output="${1#-}" ;;
     "--stap") output="${1#--}" ;;
     "--tcg-h") output="tcg_h" ;;
+    "--tcg-c") output="tcg_c" ;;
 
     "--check-backend") exit 0 ;; # used by ./configure to test for backend
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers
  2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
                   ` (8 preceding siblings ...)
  2011-12-08 22:50 ` [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define " Lluís Vilanova
@ 2011-12-08 22:50 ` Lluís Vilanova
  9 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-08 22:50 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target-alpha/helper.h      |    2 ++
 target-arm/helper.h        |    2 ++
 target-cris/helper.h       |    2 ++
 target-i386/helper.h       |    2 ++
 target-lm32/helper.h       |    2 ++
 target-m68k/helper.h       |    2 ++
 target-microblaze/helper.h |    2 ++
 target-mips/helper.h       |    2 ++
 target-ppc/helper.h        |    2 ++
 target-s390x/helper.h      |    2 ++
 target-sh4/helper.h        |    2 ++
 target-sparc/helper.h      |    2 ++
 target-unicore32/helper.h  |    2 ++
 target-xtensa/helper.h     |    2 ++
 14 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/target-alpha/helper.h b/target-alpha/helper.h
index b693cee..e7ebed9 100644
--- a/target-alpha/helper.h
+++ b/target-alpha/helper.h
@@ -120,4 +120,6 @@ DEF_HELPER_FLAGS_0(get_time, TCG_CALL_CONST, i64)
 DEF_HELPER_FLAGS_1(set_alarm, TCG_CALL_CONST, void, i64)
 #endif
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-arm/helper.h b/target-arm/helper.h
index 16dd5fc..7ab33b4 100644
--- a/target-arm/helper.h
+++ b/target-arm/helper.h
@@ -472,4 +472,6 @@ DEF_HELPER_3(neon_qzip8, void, env, i32, i32)
 DEF_HELPER_3(neon_qzip16, void, env, i32, i32)
 DEF_HELPER_3(neon_qzip32, void, env, i32, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-cris/helper.h b/target-cris/helper.h
index 093063a..9bfb144 100644
--- a/target-cris/helper.h
+++ b/target-cris/helper.h
@@ -23,4 +23,6 @@ DEF_HELPER_FLAGS_2(evaluate_flags_move_2, TCG_CALL_PURE, i32, i32, i32)
 DEF_HELPER_0(evaluate_flags, void)
 DEF_HELPER_0(top_evaluate_flags, void)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-i386/helper.h b/target-i386/helper.h
index 6b518ad..68747aa 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
@@ -217,4 +217,6 @@ DEF_HELPER_2(rclq, tl, tl, tl)
 DEF_HELPER_2(rcrq, tl, tl, tl)
 #endif
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-lm32/helper.h b/target-lm32/helper.h
index 9d335ef..52a310b 100644
--- a/target-lm32/helper.h
+++ b/target-lm32/helper.h
@@ -11,4 +11,6 @@ DEF_HELPER_0(rcsr_ip, i32)
 DEF_HELPER_0(rcsr_jtx, i32)
 DEF_HELPER_0(rcsr_jrx, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-m68k/helper.h b/target-m68k/helper.h
index cb8a0c7..dc149c7 100644
--- a/target-m68k/helper.h
+++ b/target-m68k/helper.h
@@ -51,4 +51,6 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
 DEF_HELPER_2(flush_flags, void, env, i32)
 DEF_HELPER_1(raise_exception, void, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-microblaze/helper.h b/target-microblaze/helper.h
index b92aa34..729ffd3 100644
--- a/target-microblaze/helper.h
+++ b/target-microblaze/helper.h
@@ -36,4 +36,6 @@ DEF_HELPER_4(memalign, void, i32, i32, i32, i32)
 DEF_HELPER_2(get, i32, i32, i32)
 DEF_HELPER_3(put, void, i32, i32, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-mips/helper.h b/target-mips/helper.h
index 442f684..d977b6b 100644
--- a/target-mips/helper.h
+++ b/target-mips/helper.h
@@ -297,4 +297,6 @@ DEF_HELPER_0(rdhwr_ccres, tl)
 DEF_HELPER_1(pmon, void, int)
 DEF_HELPER_0(wait, void)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 470e42f..86f6e8a 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -408,4 +408,6 @@ DEF_HELPER_2(store_601_batl, void, i32, tl)
 DEF_HELPER_2(store_601_batu, void, i32, tl)
 #endif
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-s390x/helper.h b/target-s390x/helper.h
index 01c8d0e..d702605 100644
--- a/target-s390x/helper.h
+++ b/target-s390x/helper.h
@@ -149,4 +149,6 @@ DEF_HELPER_2(cksm, void, i32, i32)
 DEF_HELPER_FLAGS_4(calc_cc, TCG_CALL_PURE|TCG_CALL_CONST,
                    i32, i32, i64, i64, i64)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-sh4/helper.h b/target-sh4/helper.h
index 95e3c7c..2ea76fa 100644
--- a/target-sh4/helper.h
+++ b/target-sh4/helper.h
@@ -51,4 +51,6 @@ DEF_HELPER_1(ftrc_DT, i32, f64)
 DEF_HELPER_2(fipr, void, i32, i32)
 DEF_HELPER_1(ftrv, void, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-sparc/helper.h b/target-sparc/helper.h
index 1f67b08..a4fa61a 100644
--- a/target-sparc/helper.h
+++ b/target-sparc/helper.h
@@ -167,4 +167,6 @@ VIS_CMPHELPER(cmpne);
 DEF_HELPER_1(compute_psr, void, env);
 DEF_HELPER_1(compute_C_icc, i32, env);
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-unicore32/helper.h b/target-unicore32/helper.h
index 615de2a..63b8260 100644
--- a/target-unicore32/helper.h
+++ b/target-unicore32/helper.h
@@ -67,4 +67,6 @@ DEF_HELPER_2(ucf64_si2df, f64, f32, env)
 DEF_HELPER_2(ucf64_sf2si, f32, f32, env)
 DEF_HELPER_2(ucf64_df2si, f32, f64, env)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"
diff --git a/target-xtensa/helper.h b/target-xtensa/helper.h
index 09ab332..6f1dba6 100644
--- a/target-xtensa/helper.h
+++ b/target-xtensa/helper.h
@@ -29,4 +29,6 @@ DEF_HELPER_2(itlb, void, i32, i32)
 DEF_HELPER_2(ptlb, i32, i32, i32)
 DEF_HELPER_3(wtlb, void, i32, i32, i32)
 
+#include "trace-tcg-helper.h"
+
 #include "def-helper.h"

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section
  2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
@ 2011-12-09 20:08   ` Lluís Vilanova
  0 siblings, 0 replies; 12+ messages in thread
From: Lluís Vilanova @ 2011-12-09 20:08 UTC (permalink / raw)
  To: qemu-devel

This series must be updated to apply on top of the patch recently accepted by
Stefan into the tracing tree [1].

[1] http://lists.gnu.org/archive/html/qemu-devel/2011-12/msg00763.html


Lluis

Lluís Vilanova writes:

> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  docs/tracing.txt |   22 ++++++++++++++++------
>  1 files changed, 16 insertions(+), 6 deletions(-)

> diff --git a/docs/tracing.txt b/docs/tracing.txt
> index ea29f2c..853cbf8 100644
> --- a/docs/tracing.txt
> +++ b/docs/tracing.txt
> @@ -98,12 +98,6 @@ respectively.  This ensures portability between 32- and 64-bit platforms.
>  4. Name trace events after their function.  If there are multiple trace events
>     in one function, append a unique distinguisher at the end of the name.
 
> -5. If specific trace events are going to be called a huge number of times, this
> -   might have a noticeable performance impact even when the trace events are
> -   programmatically disabled. In this case you should declare the trace event
> -   with the "disable" property, which will effectively disable it at compile
> -   time (using the "nop" backend).
> -
>  == Generic interface and monitor commands ==
 
>  You can programmatically query and control the dynamic state of trace events
> @@ -234,3 +228,19 @@ probes:
>                        --target-type system \
>                        --target-arch x86_64 \
>                        <trace-events >qemu.stp
> +
> +== Trace event properties ==
> +
> +Each event in the "trace-events" file can be prefixed with a space-separated
> +list of zero or more of the following event properties.
> +
> +=== "disable" ===
> +
> +If a specific trace event is going to be invoked a huge number of times, this
> +might have a noticeable performance impact even when the event is
> +programmatically disabled.
> +
> +In this case you should declare such event with the "disable" property. This
> +will effectively disable the event at compile time (by using the "nop" backend),
> +thus having no performance impact at all on regular builds (i.e., unless you
> +edit the "trace-events" file).



-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-09 20:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
2011-12-09 20:08   ` Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines Lluís Vilanova
2011-12-08 22:50 ` [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define " Lluís Vilanova
2011-12-08 22:50 ` [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers Lluís Vilanova

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.