linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alexei Starovoitov <ast@plumgrid.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>,
	paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com,
	jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net,
	brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com,
	lizefan@huawei.com, linux-kernel@vger.kernel.org,
	pi3orama@163.com
Subject: Re: [RFC PATCH v3 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs.
Date: Tue, 19 May 2015 18:10:33 -0300	[thread overview]
Message-ID: <20150519211033.GF19921@kernel.org> (raw)
In-Reply-To: <555BA112.6090505@plumgrid.com>

Em Tue, May 19, 2015 at 01:46:10PM -0700, Alexei Starovoitov escreveu:
> On 5/19/15 9:40 AM, Arnaldo Carvalho de Melo wrote:
> >Em Wed, May 20, 2015 at 01:04:48AM +0900, Namhyung Kim escreveu:
> >>If we go with 'perf record' rather than 'perf bpf record', I agree
> >>that --event option is more natural than --filter.  The --event option
> >>says that it will record - or enable, at least - a (kprobe) event for
> >>bpf programs in it and then do something with it. :)
> >>
> >>Maybe something like this?
> >>
> >>   perf record --event bpf:/path/to/object
> >
> >The syntax maybe one of many, say if it sees a ".o" suffix in the even
> >name, look if the provided event name is a file and if this file has the
> >ELF header, whatever.
> 
> agree. 'bpf:' prefix is redundant.

I would say unnecessarily exposing an implementation detail :-)

> To me the following syntax is fine:
> perf record --event bpf_file.o

Agreed, for something pre-compiled.

> In the future it can support automatically:
> perf record --event bpf_file.c

Right, to compile it, then use the resulting bpf_file.o just like in the
first case, then, on another patch, cache it and next time just check
that the contents of the file hasn't changed, so the .o file can be
used, i.e. ccache like stuff.
 
> Wang, thoughts?
> 
> >>Oh, this looks like an interesting approach.. are you saying something
> >>like below?
> >
> >No, those are way too many steps :-)
> >
> >What 'perf script' does? Right now you can ask for a script to run and
> >it will both start 'perf record' with the proper events, and then
> >"immediately" consume it, piping the output of the 'record' "script" to
> >the consumer, that is 'perf script' itself running an interpreter, perl
> >or python.
> 
> if you're proposing to do something like:
> perf script bpf_file.c
> that will do event creation, filtering, aggregation, reporting
> and printing results, then it's fine.
> This is pretty much what I thought 'perf bpf run' will do.

Agreed, that is what I think should be done, parts of what is in
bpf.file.c are related to the data collection, some are for filtering,
and parts are for reporting, etc.

This all should use infrastructure in perf for symbol resolving,
callcahins, etc.
 
> >I.e. the first part, say, failed-syscalls-record, would be done
> >internally, loading the bpf object, etc, the second part would be the
> >event massaging, but done in a C subset :-)
> 
> not sure that's doable. The task (perf) that loaded the program in the

Well,perhaps in this part I wasn't clear, but what I think should be
fone is what is above, i.e. end goal should be "perf script bpf_file.c"
does it all.

> step one should be still alive when 2nd part is running.
> For 'perf bpf run' use case, the whole record/report split is
> artificial. There is no need for perf.data.

Right, but if we do a:

perf script -i perf.data bpf_file.c 

Then there would be a short circuit effect of just doing the
aggregation and/or reporting.

> In my mind 'perf bpf run file.c' suppose to quickly compile .c,
> hook into kernel, collect and print something, then Ctrl-C of
> 'perf bpf run' should automatically stop everything.

That is what I thought about 'perf script file.c'. That would be stopped
either because it finishes due to some condition in the kernel, in the
reporting or by means of control+C, either by design or because it is
taking too long, etc.

> No perf.data anywhere. It should be quick single step
> tool for live debugging.

Well, we could have a tee like mode where perf.data file could be
generated so that we could run it again after doing some change on the
aggregation code, so that we wouldn't have to re-run the data collection
parts, that could be about some condition hard to capture, etc.

> At the same time 'perf record --event bpf_file.o' plus generic
> 'perf report' model works very well as well.
> They are different use cases.

Right.
 
> I guess I'm saying let's not get too much ahead of ourselves ;)

No problem, but then we need to talk at this moment not to add new stuff
that we think should not be added, like 'perf bpf' :-)

> I think Wang's current patchset is close enough to make
> 'perf record --event bpf_file.o' to be useful.
> Let's take this first step.

- Arnaldo

  reply	other threads:[~2015-05-19 21:10 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17 10:56 [RFC PATCH v3 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 01/37] perf/events/core: fix race in bpf program unregister Wang Nan
2015-05-18 16:59   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 02/37] perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit Wang Nan
2015-05-18 17:01   ` Alexei Starovoitov
2015-05-18 20:28     ` Arnaldo Carvalho de Melo
2015-05-20 12:25   ` [tip:perf/core] " tip-bot for Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 03/37] tools lib traceevent: Install libtraceevent.a into libdir Wang Nan
2015-05-18 14:28   ` Jiri Olsa
2015-05-20 12:26   ` [tip:perf/core] " tip-bot for Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 04/37] tools: Change FEATURE_TESTS and FEATURE_DISPLAY to weak binding Wang Nan
2015-05-18 14:30   ` Jiri Olsa
2015-05-20 12:26   ` [tip:perf/core] tools build: " tip-bot for Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 05/37] tools: Add __aligned_u64 to types.h Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 06/37] bpf tools: Introduce 'bpf' library to tools Wang Nan
2015-05-18 17:35   ` Alexei Starovoitov
2015-05-20  3:48     ` Wangnan (F)
2015-05-20  5:24       ` Alexei Starovoitov
2015-05-21  0:24         ` Wangnan (F)
2015-05-21 17:53           ` Alexei Starovoitov
2015-05-21  7:10     ` Wangnan (F)
2015-05-17 10:56 ` [RFC PATCH v3 07/37] bpf tools: Allow caller to set printing function Wang Nan
2015-05-18 17:55   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 08/37] bpf tools: Define basic interface Wang Nan
2015-05-18 17:57   ` Alexei Starovoitov
2015-05-22 17:22     ` Jiri Olsa
2015-05-17 10:56 ` [RFC PATCH v3 09/37] bpf tools: Open eBPF object file and do basic validation Wang Nan
2015-05-18 18:06   ` Alexei Starovoitov
2015-05-22 17:22   ` Jiri Olsa
2015-05-22 17:23   ` Jiri Olsa
2015-05-23  1:00     ` Alexei Starovoitov
2015-05-25 13:30       ` Arnaldo Carvalho de Melo
2015-05-26  0:05         ` Wangnan (F)
2015-05-26  0:41           ` Arnaldo Carvalho de Melo
2015-05-17 10:56 ` [RFC PATCH v3 10/37] bpf tools: Check endianess and set swap flag according to EHDR Wang Nan
2015-05-18 18:19   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 11/37] bpf tools: Iterate over ELF sections to collect information Wang Nan
2015-05-18 18:21   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 12/37] bpf tools: Collect version and license from ELF sections Wang Nan
2015-05-18 18:27   ` Alexei Starovoitov
2015-05-18 20:34     ` Arnaldo Carvalho de Melo
2015-05-18 20:51       ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 13/37] bpf tools: Collect map definitions from 'maps' section Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 14/37] bpf tools: Collect config string from 'config' section Wang Nan
2015-05-18 18:30   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 15/37] bpf tools: Collect symbol table from SHT_SYMTAB section Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections Wang Nan
2015-05-18 12:29   ` Namhyung Kim
2015-05-18 12:47     ` Wangnan (F)
2015-05-18 18:32       ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 17/37] bpf tools: Collect relocation sections from SHT_REL sections Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 18/37] bpf tools: Record map accessing instructions for each program Wang Nan
2015-05-18 18:34   ` Alexei Starovoitov
2015-05-25  7:39     ` Wangnan (F)
2015-05-17 10:56 ` [RFC PATCH v3 19/37] bpf tools: Clear libelf and ELF parsing resrouce to finish opening Wang Nan
2015-05-18 18:36   ` Alexei Starovoitov
2015-05-18 20:35     ` Arnaldo Carvalho de Melo
2015-05-17 10:56 ` [RFC PATCH v3 20/37] bpf tools: Add bpf.c/h for common bpf operations Wang Nan
2015-05-18 18:39   ` Alexei Starovoitov
2015-05-22 17:24   ` Jiri Olsa
2015-05-17 10:56 ` [RFC PATCH v3 21/37] bpf tools: Create eBPF maps defined in an object file Wang Nan
2015-05-18 18:48   ` Alexei Starovoitov
2015-05-18 20:37     ` Arnaldo Carvalho de Melo
2015-05-25  9:23     ` Wangnan (F)
2015-05-22 17:23   ` Jiri Olsa
2015-05-17 10:56 ` [RFC PATCH v3 22/37] bpf tools: Relocate eBPF programs Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 23/37] bpf tools: Introduce bpf_load_program() to bpf.c Wang Nan
2015-05-18 18:52   ` Alexei Starovoitov
2015-05-18 20:37     ` Arnaldo Carvalho de Melo
2015-05-17 10:56 ` [RFC PATCH v3 24/37] bpf tools: Load eBPF programs in object files into kernel Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 25/37] bpf tools: Introduce accessors for struct bpf_program Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 26/37] bpf tools: Introduce accessors for struct bpf_object Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 27/37] perf tools: Add new 'perf bpf' command Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 28/37] perf tools: Make perf depend on libbpf Wang Nan
2015-05-22 17:24   ` Jiri Olsa
2015-05-17 10:56 ` [RFC PATCH v3 29/37] perf bpf: Add 'perf bpf record' subcommand Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 30/37] perf bpf: Add bpf-loader and open ELF object files Wang Nan
2015-05-22 17:24   ` Jiri Olsa
2015-05-25 11:47     ` Wangnan (F)
2015-05-25 13:00     ` Arnaldo Carvalho de Melo
2015-05-17 10:56 ` [RFC PATCH v3 31/37] perf bpf: Collect all eBPF programs Wang Nan
2015-05-17 10:56 ` [RFC PATCH v3 32/37] perf bpf: Parse probe points of eBPF programs during preparation Wang Nan
2015-05-22 17:24   ` Jiri Olsa
2015-05-17 10:56 ` [RFC PATCH v3 33/37] perf bpf: Probe at kprobe points Wang Nan
2015-05-18 19:25   ` Alexei Starovoitov
2015-05-17 10:56 ` [RFC PATCH v3 34/37] perf bpf: Load all eBPF object into kernel Wang Nan
2015-05-17 10:57 ` [RFC PATCH v3 35/37] perf tools: Add a bpf_wrapper global flag Wang Nan
2015-05-17 10:57 ` [RFC PATCH v3 36/37] perf tools: Add bpf_fd field to evsel and config it Wang Nan
2015-05-17 10:57 ` [RFC PATCH v3 37/37] perf tools: Attach eBPF program to perf event Wang Nan
2015-05-18 19:38 ` [RFC PATCH v3 00/37] perf tools: introduce 'perf bpf' command to load eBPF programs Alexei Starovoitov
2015-05-18 20:44   ` Arnaldo Carvalho de Melo
2015-05-18 21:05     ` Alexei Starovoitov
2015-05-18 21:20       ` Arnaldo Carvalho de Melo
2015-05-18 21:45         ` Alexei Starovoitov
2015-05-19 13:44           ` Arnaldo Carvalho de Melo
2015-05-19 16:04             ` Namhyung Kim
2015-05-19 16:40               ` Arnaldo Carvalho de Melo
2015-05-19 20:46                 ` Alexei Starovoitov
2015-05-19 21:10                   ` Arnaldo Carvalho de Melo [this message]
2015-05-19 21:42                     ` Alexei Starovoitov
2015-05-19 22:05                       ` Arnaldo Carvalho de Melo
2015-05-20  1:02                         ` Alexei Starovoitov
2015-05-20  1:14                           ` Arnaldo Carvalho de Melo
2015-05-20  0:30                     ` Namhyung Kim
2015-05-20  0:43                       ` Arnaldo Carvalho de Melo
2015-05-26  6:22                   ` Wangnan (F)
2015-05-20  0:23                 ` Namhyung Kim
2015-05-20  0:37                   ` Arnaldo Carvalho de Melo

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=20150519211033.GF19921@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ast@plumgrid.com \
    --cc=brendan.d.gregg@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    /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).