linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/7] perf auxtrace: Support AUX pause with BPF backend
@ 2024-12-15 19:34 Leo Yan
  2024-12-15 19:34 ` [PATCH v1 1/7] perf/core: Make perf_event_aux_pause() as external function Leo Yan
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Leo Yan @ 2024-12-15 19:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Adrian Hunter, Namhyung Kim, Jiri Olsa,
	Ian Rogers, James Clark, Liang, Kan, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
	Eduard Zingerman, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Matt Bobrowski,
	Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
	linux-perf-users, bpf, linux-trace-kernel, Suzuki K Poulose,
	Mike Leach
  Cc: Leo Yan

This series extends Perf's ability for fine-grained tracing by attaching
specific trace events to eBPF programs. As the first step, this series
supports kprobe, kretprobe, and tracepoints for dynamically pausing and
resuming AUX trace.

The first two patches expose a BPF API from kernel so the AUX pause and
resume can be invoked from a BPF kernel program.

Syncing UAPI headers between kernel and tools is finished in patch 03.

The main changes in the Perf tool for implementing eBPF skeleton
program, hooking BPF program in a perf record session, and attaching
trace events with BPF programs are finished in patches 04 ~ 06.

The patch 07 updates documentation for usage of the new introduced
option '--bpf-aux-pause'.

This series has been tested on TC platform with ETE / TRBE with
commands:

  perf record -e cs_etm/aux-action=start-paused/ \
  --bpf-aux-pause="kretprobe:__arm64_sys_openat:p,kprobe:__arm64_sys_openat:r,tp:sched:sched_switch:r" -a -- ls

  perf record -e cs_etm/aux-action=start-paused/ \
  --bpf-aux-pause="kretprobe:__arm64_sys_openat:p,kprobe:__arm64_sys_openat:r,tp:sched:sched_switch:r" -i -- ls

Note, as the AUX pause operation cannot be inherited by child tasks, it
requires to specify the '-i' option for default trace mode and
per-thread mode.


Leo Yan (7):
  perf/core: Make perf_event_aux_pause() as external function
  bpf: Add bpf_perf_event_aux_pause kfunc
  bpf: Sync bpf_perf_event_aux_pause in tools UAPI bpf.h
  perf: auxtrace: Introduce eBPF program for AUX pause
  perf: auxtrace: Support BPF backend for AUX pause
  perf record: Support AUX pause with BPF
  perf docs: Document AUX pause with BPF

 include/linux/perf_event.h                    |   1 +
 include/uapi/linux/bpf.h                      |  21 +
 kernel/bpf/verifier.c                         |   2 +
 kernel/events/core.c                          |   2 +-
 kernel/trace/bpf_trace.c                      |  52 +++
 tools/include/uapi/linux/bpf.h                |  21 +
 tools/perf/Documentation/perf-record.txt      |  40 ++
 tools/perf/Makefile.perf                      |   1 +
 tools/perf/builtin-record.c                   |  18 +-
 tools/perf/util/Build                         |   4 +
 tools/perf/util/auxtrace.h                    |  43 ++
 tools/perf/util/bpf_auxtrace_pause.c          | 385 ++++++++++++++++++
 tools/perf/util/bpf_skel/auxtrace_pause.bpf.c | 135 ++++++
 tools/perf/util/evsel.c                       |   6 +
 tools/perf/util/record.h                      |   1 +
 15 files changed, 730 insertions(+), 2 deletions(-)
 create mode 100644 tools/perf/util/bpf_auxtrace_pause.c
 create mode 100644 tools/perf/util/bpf_skel/auxtrace_pause.bpf.c

-- 
2.34.1


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

end of thread, other threads:[~2025-07-21 22:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 19:34 [PATCH v1 0/7] perf auxtrace: Support AUX pause with BPF backend Leo Yan
2024-12-15 19:34 ` [PATCH v1 1/7] perf/core: Make perf_event_aux_pause() as external function Leo Yan
2024-12-15 19:34 ` [PATCH v1 2/7] bpf: Add bpf_perf_event_aux_pause kfunc Leo Yan
2024-12-16 17:21   ` Yonghong Song
2025-07-14 17:45     ` Leo Yan
2025-07-15 17:12       ` Yonghong Song
2025-07-18 15:38         ` Leo Yan
2025-07-21 22:32           ` Eduard Zingerman
2024-12-15 19:34 ` [PATCH v1 3/7] bpf: Sync bpf_perf_event_aux_pause in tools UAPI bpf.h Leo Yan
2024-12-15 19:34 ` [PATCH v1 4/7] perf: auxtrace: Introduce eBPF program for AUX pause Leo Yan
2024-12-15 19:34 ` [PATCH v1 5/7] perf: auxtrace: Support BPF backend " Leo Yan
2024-12-15 19:34 ` [PATCH v1 6/7] perf record: Support AUX pause with BPF Leo Yan
2024-12-15 19:34 ` [PATCH v1 7/7] perf docs: Document " Leo Yan

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