[Qemu-devel] [PATCH 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST

Stefan Hajnoczi posted 2 patches 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170728092053.10122-1-stefanha@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
There is a newer version of this series
trace/control.h                       | 20 ++++++++++++++++++--
scripts/tracetool/__init__.py         |  1 +
scripts/tracetool/backend/__init__.py |  3 +++
scripts/tracetool/backend/dtrace.py   | 12 ++++++++++++
scripts/tracetool/backend/ftrace.py   |  2 +-
scripts/tracetool/backend/log.py      |  3 ++-
scripts/tracetool/backend/simple.py   |  2 +-
scripts/tracetool/backend/syslog.py   |  3 ++-
scripts/tracetool/backend/ust.py      |  5 +++++
scripts/tracetool/format/h.py         | 10 ++++++++++
10 files changed, 55 insertions(+), 6 deletions(-)
[Qemu-devel] [PATCH 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST
Posted by Stefan Hajnoczi 6 years, 9 months ago
Trace events that compute their arguments can affect performance.  The
following idom can be used to avoid computing arguments when the trace event is
disabled:

  if (trace_event_get_state(TRACE_MY_EVENT)) {
      char *str = g_strdup_printf("Expensive string ...", ...);
      trace_my_event(str);
      g_free(str);
  }

Unfortunately this breaks the trace event for SystemTap and LTTng UST since
those tracers manage their own enabled/disabled state.

These patches add per-backend dstate to trace_event_get_state() so that the
trace event fires as expected when enabled via SystemTap or LTTng UST.

Stefan Hajnoczi (2):
  trace: add TRACE_<event>_BACKEND_DSTATE()
  trace: check backend dstate in trace_event_get_state()

 trace/control.h                       | 20 ++++++++++++++++++--
 scripts/tracetool/__init__.py         |  1 +
 scripts/tracetool/backend/__init__.py |  3 +++
 scripts/tracetool/backend/dtrace.py   | 12 ++++++++++++
 scripts/tracetool/backend/ftrace.py   |  2 +-
 scripts/tracetool/backend/log.py      |  3 ++-
 scripts/tracetool/backend/simple.py   |  2 +-
 scripts/tracetool/backend/syslog.py   |  3 ++-
 scripts/tracetool/backend/ust.py      |  5 +++++
 scripts/tracetool/format/h.py         | 10 ++++++++++
 10 files changed, 55 insertions(+), 6 deletions(-)

-- 
2.13.3


Re: [Qemu-devel] [PATCH 0/2] trace: fix trace_event_get_state() for SystemTap and LTTng UST
Posted by Denis V. Lunev 6 years, 9 months ago
On 07/28/2017 12:20 PM, Stefan Hajnoczi wrote:
> Trace events that compute their arguments can affect performance.  The
> following idom can be used to avoid computing arguments when the trace event is
> disabled:
>
>   if (trace_event_get_state(TRACE_MY_EVENT)) {
>       char *str = g_strdup_printf("Expensive string ...", ...);
>       trace_my_event(str);
>       g_free(str);
>   }
>
> Unfortunately this breaks the trace event for SystemTap and LTTng UST since
> those tracers manage their own enabled/disabled state.
>
> These patches add per-backend dstate to trace_event_get_state() so that the
> trace event fires as expected when enabled via SystemTap or LTTng UST.
>
> Stefan Hajnoczi (2):
>   trace: add TRACE_<event>_BACKEND_DSTATE()
>   trace: check backend dstate in trace_event_get_state()
>
>  trace/control.h                       | 20 ++++++++++++++++++--
>  scripts/tracetool/__init__.py         |  1 +
>  scripts/tracetool/backend/__init__.py |  3 +++
>  scripts/tracetool/backend/dtrace.py   | 12 ++++++++++++
>  scripts/tracetool/backend/ftrace.py   |  2 +-
>  scripts/tracetool/backend/log.py      |  3 ++-
>  scripts/tracetool/backend/simple.py   |  2 +-
>  scripts/tracetool/backend/syslog.py   |  3 ++-
>  scripts/tracetool/backend/ust.py      |  5 +++++
>  scripts/tracetool/format/h.py         | 10 ++++++++++
>  10 files changed, 55 insertions(+), 6 deletions(-)
>
looks good to me!

This also fixes the same issue not only in my code, but in

static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
and in colo code.

Reviewed-by: Denis V. Lunev <den@openvz.org>