From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mUD-0005F5-0a for qemu-devel@nongnu.org; Wed, 09 Jul 2014 03:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4mU9-0000lE-53 for qemu-devel@nongnu.org; Wed, 09 Jul 2014 03:40:16 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:63407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4mU8-0000l6-RX for qemu-devel@nongnu.org; Wed, 09 Jul 2014 03:40:13 -0400 Received: by mail-wg0-f47.google.com with SMTP id y10so1621204wgg.6 for ; Wed, 09 Jul 2014 00:40:12 -0700 (PDT) Date: Wed, 9 Jul 2014 09:40:09 +0200 From: Stefan Hajnoczi Message-ID: <20140709074009.GB9875@stefanha-thinkpad.redhat.com> References: <20140530121117.6581.71271.stgit@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aVD9QWMuhilNxW9f" Content-Disposition: inline In-Reply-To: <20140530121117.6581.71271.stgit@fimbulvetr.bsc.es> Subject: Re: [Qemu-devel] [PATCH v5 00/11] trace: [tcg] Allow tracing guest events in TCG-generated code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Llu=EDs?= Vilanova Cc: Peter Maydell , qemu-devel@nongnu.org, Stefan Hajnoczi , Richard Henderson --aVD9QWMuhilNxW9f Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 30, 2014 at 02:11:20PM +0200, Llu=EDs Vilanova wrote: > NOTE: TCG code for execution-time event tracing is always generated, rega= rdless > of wether the event has been dynamically disabled or not (unless th= e event > has the static "disable" property). >=20 > This approach keeps this series simple, and a future series will ha= ndle > the case of having per-CPU tracing states for these events, and only > generate the code if the event is dynamicaly enabled. >=20 > 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 prope= ry). >=20 > An event with that property actually generates two independent events > "${name}_trans" and "${name}_exec", and a set of conveniency functions. H= aving > 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 mo= re > information on its usage. >=20 > Files generating guest code (TCG) must include "trace-tcg.h". >=20 > The flow of the generated routines is (convenience wrappers are inlined): >=20 >=20 > [At translation time] >=20 > * trace_${name}_tcg(bool, TCGv) > Declared: "trace/generated-tcg-tracers.h" > Defined : "trace/generated-tcg-tracers.h" >=20 > Invokes "trace_${name}_trans" (with all non-TCG arguments) and > "gen_helper_trace_${name}_exec" (with all arguments). >=20 > * trace_${name}_trans(bool) > Declared: "trace/generated-tracers.h" > Defined : "trace/generated-tracers.h" >=20 > Invokes the actual tracing backends for the translation-time event. >=20 > * gen_helper_trace_${name}_exec_wrapper(bool, TCGv) > Declared: "trace/generated-helpers-wrappers.h" > Defined : "trace/generated-helpers-wrappers.h" >=20 > Convenience wrapper that will allocate (and free) TCG temporaries for a= ll > non-TCG arguments before calling "gen_helper_trace_${name}_exec_proxy". >=20 > * gen_helper_trace_${name}_exec_proxy(TCGi32, TCGv) > Declared: "trace/generated-helpers.h" > Defined : "trace/generated-helpers.h" (using helper machinery) >=20 > The actual TCG helper function, created using QEMU's TCG helper machine= ry. >=20 >=20 > [At execution time] >=20 > * helper_trace_${name}_exec_proxy(uint32_t, uint64_t) > Declared: "trace/generated-helpers.h" > Defined : "trace/generated-helpers.c" >=20 > Convenience wrapper that casts arguments to the appropriate type before > calling "trace_${name}_exec". >=20 > This is necessary because TCG helpers can only receive a limited number= of > argument types (e.g., must use 'uint32_t' instead of 'bool'). >=20 > * trace_${name}_exec(bool, uint64_t) > Declared: "trace/generated-tracers.h" > Defined : "trace/generated-tracers.h" >=20 > Invokes the actual tracing backends for the execution-time event. >=20 > Signed-off-by: Llu=EDs Vilanova > --- >=20 > Changes in v5: >=20 > * Rename 'gen_helper_trace_${name}_exec' as > 'gen_helper_trace_${name}_exec_wrapper'. > * Split generation of 'gen_helper_trace_${name}_exec_wrapper' into a sepa= rate > file ("trace/generated-helpers-wrappers.h"), using the new > 'tcg-helper-wrapper-h' tracetool backend. >=20 > Changes in v4: >=20 > * Rebase on d7d3d60 (use new helper header machinery). >=20 > Changes in v3: >=20 > * None (re-send with cover). >=20 > Changes in v2: >=20 > * 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). >=20 >=20 > Llu=EDs 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 >=20 >=20 > .gitignore | 4 + > Makefile | 6 + > Makefile.objs | 7 + > Makefile.target | 5 + > docs/tracing.txt | 40 +++++ > include/exec/helper-gen.h | 2=20 > include/exec/helper-proto.h | 1=20 > include/exec/helper-tcg.h | 1=20 > include/trace-tcg.h | 7 + > include/trace.h | 1=20 > 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=20 > target-arm/translate-a64.c | 2=20 > target-arm/translate.c | 3=20 > target-cris/translate.c | 3=20 > target-i386/translate.c | 3=20 > target-lm32/translate.c | 3=20 > target-m68k/translate.c | 3=20 > target-microblaze/translate.c | 3=20 > target-mips/translate.c | 3=20 > target-openrisc/translate.c | 3=20 > target-ppc/translate.c | 3=20 > target-s390x/translate.c | 2=20 > target-sh4/translate.c | 3=20 > target-sparc/translate.c | 3=20 > target-unicore32/translate.c | 3=20 > target-xtensa/translate.c | 3=20 > 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 >=20 >=20 > To: qemu-devel@nongnu.org > Cc: Stefan Hajnoczi > Cc: Richard Henderson > Cc: Peter Maydell >=20 Merged for QEMU 2.2. Thanks, applied to my tracing-next tree: https://github.com/stefanha/qemu/commits/tracing-next Stefan --aVD9QWMuhilNxW9f Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTvPHZAAoJEJykq7OBq3PIibQH/irddnNZqktc+/XT0EynIiYy /SKv2dm2MQVkKtYxHhaG9RYGruSdsibj1whWFgvGmoXcya4WSk7b0tjfp5OnJkse OVfz+43ycxUDI/4ou1wE3pcY63GE4oblTChRqDxowFxa2u7u3Ukntq3juBschF9a zDMyZ8ndAwigW02oEclntzMOx8g2Puy5GhPUJXp1bjpjayxzD0B1KVKPL8+LnYc3 Tyi0thQOeia11pgms31NZnNvK9oRqK+078Vs2FYQj6T0/umB03vqpSWSvN6PgH2N TGbgMBchuyzu2prGxEjqp06Ih/wMLctEAqO9yUol4GlfXA3PVoOsCqq8ZDWfvKk= =g69E -----END PGP SIGNATURE----- --aVD9QWMuhilNxW9f--