qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, "Denis V. Lunev" <den@openvz.org>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>
Subject: Re: [Qemu-devel] [PATCH v2 1/2] trace: add TRACE_<event>_BACKEND_DSTATE()
Date: Mon, 31 Jul 2017 16:16:39 +0100	[thread overview]
Message-ID: <20170731151639.GE21310@redhat.com> (raw)
In-Reply-To: <20170731140718.22010-2-stefanha@redhat.com>

On Mon, Jul 31, 2017 at 03:07:17PM +0100, Stefan Hajnoczi wrote:
> QEMU keeps track of trace event enabled/disabled state and provides
> monitor commands to inspect and modify the "dstate".  SystemTap and
> LTTng UST maintain independent enabled/disabled states for each trace
> event, the other backends rely on QEMU dstate.
> 
> Introduce a new per-event macro that combines backend-specific dstate
> like this:
> 
>   #define TRACE_MY_EVENT_BACKEND_DSTATE() ( \
>       QEMU_MY_EVENT_ENABLED() || /* SystemTap */ \
>       tracepoint_enabled(qemu, my_event) /* LTTng UST */ || \
>       false)
> 
> This will be used to extend trace_event_get_state() in the next patch.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


> diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
> index c6812b70a2..17f902cc62 100644
> --- a/scripts/tracetool/backend/dtrace.py
> +++ b/scripts/tracetool/backend/dtrace.py
> @@ -44,8 +44,20 @@ def generate_h_begin(events, group):
>      out('#include "%s"' % header,
>          '')
>  
> +    # SystemTap defines <provider>_<name>_ENABLED() but other DTrace
> +    # implementations might not.
> +    for e in events:
> +        out('#ifndef QEMU_%(uppername)s_ENABLED',
> +            '#define QEMU_%(uppername)s_ENABLED() false',
> +            '#endif',
> +            uppername=e.name.upper())


IIUC, this means that on other DTrace impls, any trace points guarded by
QEMU_*_ENABLED() will never run, even if DTrace probes are set. Having
some trace points silently never run makes it pretty useless IMHO.

IOW, you need the opposite, #define it to true. The probe will still
only be executed if DTrace has enabled it, but you'll have to take the
hit of evaluating the probe arguments regardless. Not as optimized
performance-wise, but functionally correct at least.

>  
>  def generate_h(event, group):
>      out('    QEMU_%(uppername)s(%(argnames)s);',
>          uppername=event.name.upper(),
>          argnames=", ".join(event.args.names()))
> +
> +
> +def generate_h_backend_dstate(event, group):
> +    out('    QEMU_%(uppername)s_ENABLED() || \\',
> +        uppername=event.name.upper())

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2017-07-31 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 14:07 [Qemu-devel] [PATCH v2 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST Stefan Hajnoczi
2017-07-31 14:07 ` [Qemu-devel] [PATCH v2 1/2] trace: add TRACE_<event>_BACKEND_DSTATE() Stefan Hajnoczi
2017-07-31 15:16   ` Daniel P. Berrange [this message]
2017-07-31 16:35     ` Stefan Hajnoczi
2017-08-01  9:23       ` Daniel P. Berrange
2017-07-31 14:07 ` [Qemu-devel] [PATCH v2 2/2] trace: add trace_event_get_state_backends() Stefan Hajnoczi
2017-07-31 15:09   ` Lluís Vilanova
2017-07-31 16:33     ` Stefan Hajnoczi
2017-07-31 17:39       ` Lluís Vilanova
2017-08-01  9:27   ` Daniel P. Berrange
2017-08-01  9:38 ` [Qemu-devel] [PATCH v2 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST Stefan Hajnoczi

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=20170731151639.GE21310@redhat.com \
    --to=berrange@redhat.com \
    --cc=den@openvz.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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).