linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Hemant Kumar <hemant@linux.vnet.ibm.com>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Subject: Re: [PATCH perf/core v12 00/16] perf-probe --cache and SDT support
Date: Sat, 25 Jun 2016 08:46:34 +0900	[thread overview]
Message-ID: <20160625084634.70216a48cf528d0964c0ceab@kernel.org> (raw)
In-Reply-To: <CAE40pdfwDrUPgV_X4TQqs8mNL185+vGaKSoOEQnp0g__ue0vgA@mail.gmail.com>

On Fri, 24 Jun 2016 13:25:20 -0700
Brendan Gregg <brendan.d.gregg@gmail.com> wrote:

> On Fri, Jun 24, 2016 at 2:05 AM, Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > Hi,
> >
> > Here is the 12th version of the patchset for probe-cache and
> > initial SDT support.
> >
> > Here is the previous v11: https://lkml.org/lkml/2016/6/14/1041
> >
> > In this version I just rename strlist__for_each to
> > strlist__for_each_entry, and change some patch description.
> >
> 
> I tested it on Node.js (and applied to acme's perf/core), and it works. Thanks!
> 
> # perf script
>             node 36750 [006]  3080.761533:
> sdt_node:http__server__request: (da8b0c)
>             node 36750 [006]  3081.368771:
> sdt_node:http__server__request: (da8b0c)
>             node 36750 [006]  3081.592925:
> sdt_node:http__server__request: (da8b0c)
>             node 36750 [006]  3081.976802:
> sdt_node:http__server__request: (da8b0c)
>             node 36750 [006]  3082.296709:
> sdt_node:http__server__request: (da8b0c)
> 
> Since it doesn't set the is-enabled semaphore yet, I had to do that
> manually for the probes that use it. I know that will be a latter
> addition.

Yes, I'd like to support it. However, the question is who should enable it.

To enable it from perf, perf must attach the target running processes
and change the semaphore. If we run "perf record -a", it has to check
all the running process and tweak it. Moreover, it may have to hook
the execve syscall.

To enable it from kernel, hooking the target process is easier, since
we already did it in uprobes. However, it means we'll introduce a
special functionality to tweak user binary, and of course it may
need to understand SDT section to find out the semaphore.

So, one possible solution is, adding a semaphore option(like an address)
to uprobe events and enable it via ftrace. On this way, perf just
analyzes SDT and pass the semaphore address to ftrace when defining
a probe, and ftrace set 1 to the semaphre address.

> 
> # perf list | grep sdt
>   sdt_node:http__client__request                     [Tracepoint event]
>   sdt_node:http__server__request                     [Tracepoint event]
>   sdt_node:gc__done                                  [SDT event]
>   sdt_node:gc__start                                 [SDT event]
>   sdt_node:http__client__request                     [SDT event]
>   sdt_node:http__client__response                    [SDT event]
>   sdt_node:http__server__request                     [SDT event]
>   sdt_node:http__server__response                    [SDT event]
>   sdt_node:net__server__connection                   [SDT event]
>   sdt_node:net__stream__end                          [SDT event]
> 
> It's also a bit weird to see these listed twice, but I understand
> what's happening. If this continues to prove confusing, I guess later
> on we could change it to exclude listing SDT events that have been
> promoted to Tracepoint events, or not list SDT events in "perf list"
> at all, leaving them for "perf probe --cache --list".

Ah, right. Hmm, at this point, I'd like latter method, since perf
record doesn't support SDT directly yet. So we just need to drop
08/16 and 09/16. It should be implemented with perf-record support.

Thank you!

> 
> Anyway, this is great as is, and thanks again.
> 
> Brendan
> 
> 
> > Thank you,
> >
> > ---
> >
> > Hemant Kumar (1):
> >       perf/sdt: ELF support for SDT
> >
> > Masami Hiramatsu (15):
> >       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
> >       perf-list: Show SDT and pre-cached events
> >       perf-list: Skip SDTs placed in invalid binaries
> >       perf: probe-cache: Add for_each_probe_cache_entry() wrapper
> >       perf probe: Allow wildcard for cached events
> >       perf probe: Search SDT/cached event from all probe caches
> >       perf probe: Support @BUILDID or @FILE suffix for SDT events
> >       perf probe: Support a special SDT probe format
> >       perf build: Add sdt feature detection
> >       perf-test: Add a test case for SDT event
> >
> >
> >  tools/perf/Documentation/perf-buildid-cache.txt |    3
> >  tools/perf/Documentation/perf-probe.txt         |   30 +-
> >  tools/perf/Makefile.perf                        |    3
> >  tools/perf/builtin-list.c                       |    6
> >  tools/perf/builtin-probe.c                      |   31 ++
> >  tools/perf/config/Makefile                      |   10 +
> >  tools/perf/tests/Build                          |    1
> >  tools/perf/tests/builtin-test.c                 |    4
> >  tools/perf/tests/make                           |    3
> >  tools/perf/tests/sdt.c                          |  115 +++++++
> >  tools/perf/tests/tests.h                        |    1
> >  tools/perf/util/build-id.c                      |  212 +++++++++++++
> >  tools/perf/util/build-id.h                      |    4
> >  tools/perf/util/parse-events.c                  |   82 +++++
> >  tools/perf/util/parse-events.h                  |    2
> >  tools/perf/util/probe-event.c                   |  366 +++++++++++++++++++++--
> >  tools/perf/util/probe-event.h                   |    1
> >  tools/perf/util/probe-file.c                    |  226 +++++++++++++-
> >  tools/perf/util/probe-file.h                    |   24 +-
> >  tools/perf/util/symbol-elf.c                    |  252 ++++++++++++++++
> >  tools/perf/util/symbol.h                        |   22 +
> >  21 files changed, 1333 insertions(+), 65 deletions(-)
> >  create mode 100644 tools/perf/tests/sdt.c
> >
> > --
> > Masami Hiramatsu


-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2016-06-24 23:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24  9:05 [PATCH perf/core v12 00/16] perf-probe --cache and SDT support Masami Hiramatsu
2016-06-24  9:05 ` [PATCH perf/core v12 01/16] perf probe: Use cache entry if possible Masami Hiramatsu
2016-06-24  9:05 ` [PATCH perf/core v12 02/16] perf probe: Show all cached probes Masami Hiramatsu
2016-06-24  9:05 ` [PATCH perf/core v12 03/16] perf probe: Remove caches when --cache is given Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 04/16] perf/sdt: ELF support for SDT Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 05/16] perf probe: Add group name support Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 06/16] perf buildid-cache: Scan and import user SDT events to probe cache Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 07/16] perf probe: Accept %sdt and %cached event name Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 08/16] perf-list: Show SDT and pre-cached events Masami Hiramatsu
2016-07-14  7:07   ` [tip:perf/core] perf list: " tip-bot for Masami Hiramatsu
2016-06-24  9:06 ` [PATCH perf/core v12 09/16] perf-list: Skip SDTs placed in invalid binaries Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 10/16] perf: probe-cache: Add for_each_probe_cache_entry() wrapper Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 11/16] perf probe: Allow wildcard for cached events Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 12/16] perf probe: Search SDT/cached event from all probe caches Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 13/16] perf probe: Support @BUILDID or @FILE suffix for SDT events Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 14/16] perf probe: Support a special SDT probe format Masami Hiramatsu
2016-06-24  9:07 ` [PATCH perf/core v12 15/16] perf build: Add sdt feature detection Masami Hiramatsu
2016-06-24  9:08 ` [PATCH perf/core v12 16/16] perf-test: Add a test case for SDT event Masami Hiramatsu
2016-06-24 20:25 ` [PATCH perf/core v12 00/16] perf-probe --cache and SDT support Brendan Gregg
2016-06-24 23:46   ` Masami Hiramatsu [this message]

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=20160625084634.70216a48cf528d0964c0ceab@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=acme@kernel.org \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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).