Andi Kleen 77d0871c76 perf bpf: Tighten detection of BPF events
perf stat -e cpu/uops_executed.core,cmask=1/

would be detected as a BPF source event because the .c matches the .c
source BPF pattern.

v2:

Originally I tried to use lex lookahead, but it doesn't seem to work.

This now extends the BPF pattern to match longer events, but then does
an extra check in the C code to reject BPF matches that do not end with
.c/.o/.obj

This uses REJECT, which makes the flex scanner slower, but that
shouldn't be a big problem for the perf events.

Committer testing:

  # perf trace -e write -e /home/acme/bpf/tracepoint.c cat /etc/passwd > /dev/null
     0.000 ( 0.006 ms): cat/18485 write(fd: 1, buf: 0x7f59eebe1000, count: 3494                         ) ...
     0.006 (         ): raw_syscalls:sys_enter:NR 1 (1, 7f59eebe1000, da6, 22, 7f59eebe0010, 0))
     0.008 (         ): perf_bpf_probe:_write:(ffffffff9626b2c0))
     0.000 ( 0.010 ms): cat/18485  ... [continued]: write()) = 3494
  #

It continues doing what was expected, i.e. identifying
/home/acme/bpf/tracepoint.c as a BPF event and activates the clang
machinery to build an eBPF object and then uses sys_bpf() to hook it up
to the raw_syscalls:sys_enter tracepoint, etc.

Andi forgot to add Wang to the CC list, fix it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170811232634.30465-4-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-08-22 11:56:22 -03:00
..
2017-07-25 11:23:50 -03:00
2017-04-24 13:43:32 -03:00
2016-06-28 10:54:56 -03:00
2017-07-18 23:14:11 -03:00
2017-07-18 23:14:11 -03:00
2017-04-19 13:01:51 -03:00
2016-10-24 11:07:39 -03:00
2017-06-19 15:27:05 -03:00
2016-07-12 15:19:55 -03:00
2017-07-18 23:14:08 -03:00
2017-07-26 14:21:59 -03:00
2017-07-26 14:21:59 -03:00
2016-08-23 15:37:33 -03:00
2016-04-28 09:58:58 -03:00
2017-06-27 11:49:13 -03:00
2017-08-22 11:51:28 -03:00
2017-08-22 11:51:28 -03:00