linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/2] Introduce perf-stat -b for BPF programs
@ 2020-11-19  4:50 Song Liu
  2020-11-19  4:50 ` [RFC 1/2] perf: support build BPF skeletons with perf Song Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Song Liu @ 2020-11-19  4:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-team, peterz, mingo, acme, mark.rutland,
	alexander.shishkin, jolsa, namhyung, Song Liu

This set introduces perf-stat -b option to count events for BPF programs.
This is similar to bpftool-prog-profile. But perf-stat makes it much more
flexible.

Sending as RFC because I would like comments on some key design choices:
  1. We are using BPF skeletons here, which is by far the easiest way to
     write and ship BPF programs. However, this requires bpftool, which
     makes building perf slower.
  2. A Makefile is added to tools/perf/util/bpf_skel/ to build bpftool,
     and BPF skeletons. This keeps main perf Makefiles simple. But we may
     not like it for some reason?

Some known limitations (or work to be done):
  1. Only counting events for one BPF program at a time.
  2. Need extra logic in target__validate().

Song Liu (2):
  perf: support build BPF skeletons with perf
  perf-stat: enable counting events for BPF programs

 tools/build/Makefile.feature                  |   3 +-
 tools/perf/Makefile.config                    |   8 +
 tools/perf/Makefile.perf                      |  15 +-
 tools/perf/builtin-stat.c                     |  59 ++++-
 tools/perf/util/Build                         |   1 +
 tools/perf/util/bpf_counter.c                 | 215 ++++++++++++++++++
 tools/perf/util/bpf_counter.h                 |  71 ++++++
 tools/perf/util/bpf_skel/.gitignore           |   3 +
 tools/perf/util/bpf_skel/Makefile             |  71 ++++++
 .../util/bpf_skel/bpf_prog_profiler.bpf.c     |  96 ++++++++
 tools/perf/util/bpf_skel/dummy.bpf.c          |  19 ++
 tools/perf/util/evsel.c                       |  10 +
 tools/perf/util/evsel.h                       |   5 +
 tools/perf/util/target.h                      |   6 +
 14 files changed, 571 insertions(+), 11 deletions(-)
 create mode 100644 tools/perf/util/bpf_counter.c
 create mode 100644 tools/perf/util/bpf_counter.h
 create mode 100644 tools/perf/util/bpf_skel/.gitignore
 create mode 100644 tools/perf/util/bpf_skel/Makefile
 create mode 100644 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
 create mode 100644 tools/perf/util/bpf_skel/dummy.bpf.c

--
2.24.1

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-11-25 16:44 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19  4:50 [RFC 0/2] Introduce perf-stat -b for BPF programs Song Liu
2020-11-19  4:50 ` [RFC 1/2] perf: support build BPF skeletons with perf Song Liu
2020-11-22 23:27   ` Jiri Olsa
2020-11-24 23:47     ` Song Liu
2020-11-25 16:38       ` Jiri Olsa
2020-11-22 23:32   ` Jiri Olsa
2020-11-24 23:51     ` Song Liu
2020-11-22 23:35   ` Jiri Olsa
2020-11-24 23:52     ` Song Liu
2020-11-25 16:40       ` Jiri Olsa
2020-11-24 19:51   ` Jiri Olsa
2020-11-24 23:59     ` Song Liu
2020-11-24 19:51   ` Jiri Olsa
2020-11-24 23:53     ` Song Liu
2020-11-19  4:50 ` [RFC 2/2] perf-stat: enable counting events for BPF programs Song Liu
2020-11-23 23:47   ` Jiri Olsa
2020-11-24 23:31     ` Song Liu
2020-11-25 16:42       ` Jiri Olsa
2020-11-24 19:51   ` Jiri Olsa
2020-11-24 23:43     ` Song Liu
2020-11-25  0:02       ` Song Liu
2020-11-25 16:43         ` Jiri Olsa
2020-11-19 14:52 ` [RFC 0/2] Introduce perf-stat -b " Arnaldo Carvalho de Melo

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).