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


Groups > linux.kernel > #1258902 > unrolled thread

Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2015-10-29 17:30 +0100
Last post2015-10-30 00:00 +0100
Articles 3 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when  passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-29 17:30 +0100
    Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when  passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-29 17:40 +0100
      Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when  passing '.c' to --event Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-30 00:00 +0100

#1258902 — Re: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-10-29 17:30 +0100
SubjectRe: [PATCH 09/31] perf tools: Compile scriptlets to BPF objects when passing '.c' to --event
Message-ID<qoYfo-2xI-5@gated-at.bofh.it>
Em Wed, Oct 14, 2015 at 12:41:20PM +0000, Wang Nan escreveu:
> This patch provides infrastructure for passing source files to --event
> directly using:
> 
>  # perf record --event bpf-file.c command
> 
> This patch does following works:
> 
>  1) Allow passing '.c' file to '--event'. parse_events_load_bpf() is
>     expanded to allow caller tell it whether the passed file is source
>     file or object.
> 
>  2) llvm__compile_bpf() is called to compile the '.c' file, the result
>     is saved into memory. Use bpf_object__open_buffer() to load the
>     in-memory object.
> 
> Introduces a bpf-script-example.c so we can manually test it:
> 
>  # perf record --clang-opt "-DLINUX_VERSION_CODE=0x40200" --event ./bpf-script-example.c sleep 1
> 
> Note that '--clang-opt' must put before '--event'.
> 
> Futher patches will merge it into a testcase so can be tested automatically.

Not working here... humm, perhaps the version again...

[root@felicio linux]# perf record --clang-opt "-DLINUX_VERSION_CODE=0x40200" --event tools/perf/tests/bpf-script-example.c sleep 1
libbpf: load bpf program failed: Invalid argument
libbpf: -- BEGIN DUMP LOG ---
libbpf: 

libbpf: -- END LOG --
libbpf: failed to load program 'func=sys_epoll_pwait'

Yeah, as soon as I used:

# perf record --clang-opt "-DLINUX_VERSION_CODE=0x40300" --event tools/perf/tests/bpf-script-example.c sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data ]
[root@felicio linux]# 

I think we should provide some stuff like this LINUX_VERSION_CODE
automagically, right?

And also check the version in a .o file, to make sure we don't ask the
kernel to load something with a mismatch in that version.

And you could've provided something that would actually do something
meaningful, i.e.  a filter that would capture some samples for a given event
while discarding something not that important...

I.e. show the value provided at the time we build that patch.

I'll try to come up with something like that after I have lunch, but so far
so good, I think I'll be able to send this to Ingo today, and that is a major
milestone!

Great work, thanks a lot for doing this!

- Arnaldo

P.S.: If we pass a .c ending string to 'trace', 'record', 'top', etc, I think
we could do away with that pesky --event/-e, i.e.:

	trace cool_stuff.c

Would do the right thing, i.e. be equivalent to:

	trace --event cool_stuff.c
--
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/

[toc] | [next] | [standalone]


#1258909

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-10-29 17:40 +0100
Message-ID<qoYp4-2B4-11@gated-at.bofh.it>
In reply to#1258902
Em Thu, Oct 29, 2015 at 01:25:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> And you could've provided something that would actually do something
> meaningful, i.e.  a filter that would capture some samples for a given event
> while discarding something not that important...
> 
> I.e. show the value provided at the time we build that patch.
> 
> I'll try to come up with something like that after I have lunch.

Ok, what I have is at my perf/core branch, will continue after having
some food,

- Arnaldo
--
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/

[toc] | [prev] | [next] | [standalone]


#1259070

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-10-30 00:00 +0100
Message-ID<qp4kO-6fZ-9@gated-at.bofh.it>
In reply to#1258909
Em Thu, Oct 29, 2015 at 01:30:27PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Oct 29, 2015 at 01:25:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> > And you could've provided something that would actually do something
> > meaningful, i.e.  a filter that would capture some samples for a given event
> > while discarding something not that important...
> > 
> > I.e. show the value provided at the time we build that patch.
> > 
> > I'll try to come up with something like that after I have lunch.
> 
> Ok, what I have is at my perf/core branch, will continue after having
> some food,

Oh well, more interesting things require that we access the function
arguments and that is not yet possible, requires that PROLOGUE + dwarf
bits that comes later, reading those patches...

- Arnaldo
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web