From: Stefan Hajnoczi <stefanha@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC][PATCH v3 00/24] instrument: Let the user wrap/override specific event tracing routines
Date: Thu, 25 Apr 2013 14:39:00 +0200 [thread overview]
Message-ID: <20130425123900.GA8160@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <871ua05dil.fsf@fimbulvetr.bsc.es>
On Wed, Apr 24, 2013 at 02:17:22PM +0200, Lluís Vilanova wrote:
> Stefan Hajnoczi writes:
>
> > On Sun, Apr 21, 2013 at 09:11:30PM +0200, Lluís Vilanova wrote:
> >> TODO: Operations 'instr_load' and 'instr_unload' are not thread safe.
> >> (qemu_cpu_kick?)
> >>
> >> TODO: Do cmdline actions have to be implemented on top of QMP routines?
> >>
> >> TODO: HMP and QMP interfaces only accept one argument to "instr-load".
> >>
> >> TODO: Replace programmatic 'InstrLoadError' in favour of QAPI's 'InstrLoadCode'?
> >> (harder to find using code navigation tools, as it's auto-generated; but
> >> provides a single point to manage the enumeration values, which is less
> >> error-prone)
> >>
> >>
> >> The whole set of patch series is available at:
> >> https://projects.gso.ac.upc.edu/projects/qemu-dbi
> >>
> >> Adds the "instrument" event property to declare which tracing events in QEMU
> >> must be instrumentable. Still, in case the user only wants to wrap around the
> >> tracing events, the original tracing implementation is accessible through the
> >> appropriate routines.
> >>
> >> The instrumentation can be performed either through a dynamically-loaded library
> >> or through user-provided code that is compiled into QEMU itself (useful when
> >> instrumenting high-frequency events, as the fast-path of the instrumentation can
> >> be inlined into QEMU).
> >>
> >> As a side-effect this series adds an API for the instrumentation code to have
> >> some basic interaction with QEMU.
> >>
> >> See the documentation added in the first patch for more information.
> >>
> >> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> >> ---
>
> > If I understand correctly this series allows trace events to be exported
> > as a shared library API. It can be used with instrumentation libraries
> > (shared objects), which avoids rebuilding QEMU for each instrumentation
> > set.
>
> > I'm skeptical of the effort required to do this (and maintain it) when
> > it's easy to keep several git branches - one for each instrumentation
> > set - and rebuild.
>
> > Trace events are not an API. They are not stable. Therefore these
> > dynamic instrumentation libraries would be broken when QEMU changes.
>
> > Maybe I don't understand the application well enough to see the benefit?
>
> True, changing QEMU's tracing events will break the instrumentation libraries,
> and the user should be completely aware of that, given that the library is
> actually instrumenting specific tracing events (not just some well-established
> API). You can think of this as yet another tracing backend, with the ability to
> interact with QEMU.
>
> The actually interesting part is in the following series (which are also
> publicly available on the url of the cover), which adds some generic tracing
> events that should not change between versions, and can thus be safely assumed.
> Such events are related to the guest code, including (but not limited to) guest
> memory accesses or instruction execution. As we discussed in some very old try
> at this, what all of this provides is the ability to instrument guest code for
> all architectures supported by QEMU.
>
> In fact, the ability to instrument all tracing events could be seen as just a
> side-effect of the implementation; but one that can come in handy in certain
> cases when developing ad-hoc trace analyses.
>
> Does this make more sense now?
Thanks for explaining.
People doing this level of instrumentation probably need to do QEMU
hacking anyway for deep analysis, perhaps pausing and resuming the
guest, checking other guest RAM locations, grabbing device state, maybe
snapshotting the guest.
Is it worth building and maintain a stable API? It means that folks
working on TCG, for example, do not have the freedom to change/delete
trace events. They are now stuck maintaining trace event semantics no
matter how TCG will evolve in the future.
It would be nice to make TCG multi-threaded soon. How will
instrumentation libraries handle this? Existing ones probably won't,
they'll break unless QEMU restricts itself back to single-threaded mode.
Given that the group of users for this feature is so small while the
burden of supporting this is rather large, it seems like writing
instrumentation code straight in a QEMU source tree is the most powerful
and viable solution.
Basically I think putting a stable API in place here isn't going to fly.
In terms of the tracing subsystem I don't mind, but I think it's a
question for the larger QEMU community.
Stefan
next prev parent reply other threads:[~2013-04-25 12:39 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-21 19:11 [Qemu-devel] [RFC][PATCH v3 00/24] instrument: Let the user wrap/override specific event tracing routines Lluís Vilanova
2013-04-21 19:11 ` [Qemu-devel] [PATCH v3 01/24] instrument: Add documentation Lluís Vilanova
2013-04-21 19:11 ` [Qemu-devel] [PATCH v3 02/24] trace: [simple] Do not include "trace/simple.h" in generated tracer headers Lluís Vilanova
2013-04-21 19:11 ` [Qemu-devel] [PATCH v3 03/24] trace: Let the user specify her own trace-events file Lluís Vilanova
2013-04-26 15:21 ` Paolo Bonzini
2013-04-26 18:28 ` Lluís Vilanova
2013-04-21 19:11 ` [Qemu-devel] [PATCH v3 04/24] tracetool: Use method 'Event.api' to get the name of public routines Lluís Vilanova
2013-04-21 19:11 ` [Qemu-devel] [PATCH v3 05/24] trace: Minimize inclusions of "qemu-common.h" to avoid inclusion loops Lluís Vilanova
2013-04-26 15:23 ` Paolo Bonzini
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 06/24] instrument: [none] Add null instrumentation Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 07/24] system: [linux] Use absolute include path for linux-headers Lluís Vilanova
2013-04-26 15:17 ` Paolo Bonzini
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 08/24] instrument: [static] Call statically linked user-provided routines Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 09/24] build: Add variable 'tools-obj-y' for tool-only files Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 10/24] instrument: [dynamic] Call dynamically linked user-provided routines Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 11/24] qapi: Add a primitive to include other files from a QAPI schema file Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 12/24] qapi: [trivial] Set the input root directory when parsing QAPI files Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 13/24] qapi: [trivial] Allow user to use 'args' as an argument name Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 14/24] instrument: Add internal control interface Lluís Vilanova
2013-04-26 14:08 ` Eric Blake
2013-04-26 15:11 ` Paolo Bonzini
2013-04-26 15:25 ` Lluís Vilanova
2013-04-26 15:27 ` Paolo Bonzini
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 15/24] instrument: [qmp, qapi] Add " Lluís Vilanova
2013-04-21 19:12 ` [Qemu-devel] [PATCH v3 16/24] instrument: [hmp] " Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 17/24] Let makefiles add entries to the set of target architecture objects Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 18/24] instrument: Add commandline options to start with an instrumentation library Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 19/24] instrument: Add client-side API to enumerate events Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 20/24] instrument: Add client-side API to control tracing state of events Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 21/24] instrument: Add client-side API to control event instrumentation Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 22/24] build: Fix installation of target-dependant files Lluís Vilanova
2013-04-26 15:24 ` Paolo Bonzini
2013-04-26 15:27 ` Peter Maydell
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 23/24] instrument: Install headers for dynamic instrumentation clients Lluís Vilanova
2013-04-21 19:13 ` [Qemu-devel] [PATCH v3 24/24] trace: Do not use the word 'new' in event arguments Lluís Vilanova
2013-04-24 11:17 ` [Qemu-devel] [RFC][PATCH v3 00/24] instrument: Let the user wrap/override specific event tracing routines Stefan Hajnoczi
2013-04-24 12:17 ` Lluís Vilanova
2013-04-25 12:39 ` Stefan Hajnoczi [this message]
2013-04-26 12:15 ` Lluís Vilanova
2013-04-26 15:10 ` Stefan Hajnoczi
2013-04-28 19:25 ` Lluís Vilanova
2013-05-01 11:54 ` Stefan Hajnoczi
2013-05-01 14:34 ` Lluís Vilanova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130425123900.GA8160@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).