Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1184459

[RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support

From Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Newsgroups linux.kernel
Subject [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support
Date 2015-07-15 11:20 +0200
Message-ID <pMr17-36Z-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Here is the 2nd version of the patchset for probe-cache and 
initial SDT support which are going to be perf-cache finally.

The perf-probe is useful for debugging, but it strongly depends
on the debuginfo. Without debuginfo, it is just a frontend of
ftrace's dynamic events. This can usually happen in server
farms or on cloud system, since no one wants to distribute
big debuginfo packages.

To solve this issue, I had tried to make a pre-analyzed probes
( https://lkml.org/lkml/2014/10/31/207 ) but it has a problm
that we can't ensure the probed binary is same as what we analyzed.
Arnaldo gave me an idea to reuse build-id cache for that perpose
and this series is the first prototype of that.

At the same time, Hemant has started to support SDT probes which
also use the cache file of SDT info. So I decided to merge this
into the same build-id cache.
In this version, SDT support is still very limited, it works
as a part of probe-cache.

In this version, perf probe supports --cache option which means
that perf probe manipulate probe caches, for example,

  # perf probe --cache --add "probe-desc"

does not only add probe events but also add "probe-desc" and
it's result on the cache. (Note that the cached entry is always
referred even without --cache)
The --list and --del commands also support --cache. Note that
both are only manipulate caches, not real events.

To use SDT, we have to scan the target binary at first by using
perf-buildid-cache, e.g.

  # perf buildid-cache --add /lib/libc-2.17.so 

And perf probe --cache --list shows what SDTs are scanned.

  # perf probe --cache --list
  /usr/lib/libc-2.17.so (a6fb821bdf53660eb2c29f778757aef294d3d392):
  libc:setjmp=setjmp
  libc:longjmp=longjmp
  libc:longjmp_target=longjmp_target
  libc:memory_heap_new=memory_heap_new
  libc:memory_sbrk_less=memory_sbrk_less
  libc:memory_arena_reuse_free_list=memory_arena_reuse_free_list
  libc:memory_arena_reuse=memory_arena_reuse
  ...

To use the SDT events, perf probe -x BIN %SDTEVENT allows you to
add a probe on SDTEVENT@BIN.

  # perf probe -x /lib/libc-2.17.so %memory_heap_new

If you define a cached probe with event name, you can also reuse
it as same as SDT events.

  # perf probe -x ./perf --cache -n 'myevent=dso__load $params'

(Note that "-n" option only updates caches)
To use the above "myevent", you just have to add "%myevent".

  # perf probe -x ./perf %myevent


TODOs:
 - Show available cached/SDT events by perf-list
 - Allow perf-record to use cached/SDT events directly

Thank you,

---

Hemant Kumar (1):
      perf/sdt: ELF support for SDT

Masami Hiramatsu (15):
      perf probe: Simplify __add_probe_trace_events code
      perf probe: Move ftrace probe-event operations to probe-file.c
      perf probe: Use strbuf for making strings in probe-event.c
      perf-buildid-cache: Use path/to/bin/buildid/elf instead of path/to/bin/buildid
      perf buildid: Use SBUILD_ID_SIZE macro
      perf buildid: Introduce sysfs/filename__sprintf_build_id
      perf: Add lsdir to read a directory
      perf-buildid-cache: Use lsdir for looking up buildid caches
      perf probe: Add --cache option to cache the probe definitions
      perf probe: Use cache entry if possible
      perf probe: Show all cached probes
      perf probe: Remove caches when --cache is given
      perf probe: Add group name support
      perf buildid-cache: Scan and import user SDT events to probe cache
      perf probe: Accept %sdt and %cached event name


 tools/perf/Documentation/perf-probe.txt |   14 
 tools/perf/builtin-buildid-cache.c      |   22 -
 tools/perf/builtin-buildid-list.c       |   28 -
 tools/perf/builtin-probe.c              |    3 
 tools/perf/util/Build                   |    1 
 tools/perf/util/build-id.c              |  230 ++++++--
 tools/perf/util/build-id.h              |   11 
 tools/perf/util/dso.h                   |    5 
 tools/perf/util/probe-event.c           |  918 ++++++++++++++-----------------
 tools/perf/util/probe-event.h           |   16 -
 tools/perf/util/probe-file.c            |  763 ++++++++++++++++++++++++++
 tools/perf/util/probe-file.h            |   46 ++
 tools/perf/util/probe-finder.c          |   10 
 tools/perf/util/symbol-elf.c            |  252 +++++++++
 tools/perf/util/symbol.c                |    2 
 tools/perf/util/symbol.h                |   22 +
 tools/perf/util/util.c                  |   34 +
 tools/perf/util/util.h                  |    4 
 18 files changed, 1781 insertions(+), 600 deletions(-)
 create mode 100644 tools/perf/util/probe-file.c
 create mode 100644 tools/perf/util/probe-file.h


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering 
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 08/16] perf-buildid-cache: Use lsdir for  looking up buildid caches Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 11/16] perf probe: Show all cached probes Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 10/16] perf probe: Use cache entry if  possible Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 03/16] perf probe: Use strbuf for making  strings in probe-event.c Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
    Re: [RFC PATCH perf/core v2 03/16] perf probe: Use strbuf for making  strings in probe-event.c Namhyung Kim <namhyung@kernel.org> - 2015-07-17 10:00 +0200
      Re: Re: [RFC PATCH perf/core v2 03/16] perf probe: Use strbuf  for making strings in probe-event.c Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-17 12:20 +0200
  [RFC PATCH perf/core v2 07/16] perf: Add lsdir to read a directory Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 13/16] perf/sdt: ELF support for SDT Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:20 +0200
  [RFC PATCH perf/core v2 16/16] perf probe: Accept %sdt and %cached  event name Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:30 +0200
    Re: [RFC PATCH perf/core v2 16/16] perf probe: Accept %sdt and  %cached event name Namhyung Kim <namhyung@kernel.org> - 2015-07-19 13:00 +0200
  [RFC PATCH perf/core v2 15/16] perf buildid-cache: Scan and import  user SDT events to probe cache Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-15 11:30 +0200
    Re: [RFC PATCH perf/core v2 15/16] perf buildid-cache: Scan and  import user SDT events to probe cache Namhyung Kim <namhyung@kernel.org> - 2015-07-19 12:50 +0200
  Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-07-16 05:20 +0200
    Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Hemant Kumar <hemant@linux.vnet.ibm.com> - 2015-07-22 16:20 +0200
  Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-20 20:40 +0200
    Re: [RFC PATCH perf/core v2 00/16] perf-probe --cache and SDT support Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-20 20:50 +0200

csiph-web