bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/5] Add PERF_FORMAT_LOST read_format
@ 2019-09-17 13:30 Daniel Xu
  2019-09-17 13:30 ` [PATCH bpf-next 1/5] perf/core: " Daniel Xu
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Daniel Xu @ 2019-09-17 13:30 UTC (permalink / raw)
  To: bpf, songliubraving, yhs, andriin, peterz, mingo, acme
  Cc: Daniel Xu, ast, alexander.shishkin, jolsa, namhyung,
	linux-kernel, netdev, kernel-team

It's useful to know kprobe's nmissed count. For example with tracing
tools, it's important to know when events may have been lost.  debugfs
currently exposes a control file to get this information, but it is not
compatible with probes registered with the perf API.

While bpf programs may be able to manually count nhit, there is no way
to gather nmissed. In other words, it is currently not possible to this
retrieve information about FD-based probes.

This patch adds a new field to perf's read_format that lets users query
misses. Misses include both misses from the underlying kprobe
infrastructure and misses from ringbuffer infrastructure.

I studied the code various code paths for perf software events and perf
tracepoints and it does not look like anything can "miss" in the same
way kprobes can. They can all, however, suffer from ringbuffer misses.
It's possible I missed something while reading the code so please let
me know if I am mistaken.

Daniel Xu (5):
  perf/core: Add PERF_FORMAT_LOST read_format
  perf/core: Sync perf_event.h to tools
  libbpf: Add helpers to extract perf fd from bpf_link
  libbpf: Set read_format PERF_FORMAT_LOST on kprobe perf fds
  libbpf: Add selftest for PERF_FORMAT_LOST perf read_format

 include/linux/trace_events.h                  |  1 +
 include/uapi/linux/perf_event.h               |  5 ++-
 kernel/events/core.c                          | 39 +++++++++++++++++--
 kernel/trace/trace_kprobe.c                   |  8 ++++
 tools/include/uapi/linux/perf_event.h         |  5 ++-
 tools/lib/bpf/libbpf.c                        | 30 ++++++++++++--
 tools/lib/bpf/libbpf.h                        | 13 +++++++
 tools/lib/bpf/libbpf.map                      |  3 ++
 .../selftests/bpf/prog_tests/attach_probe.c   | 32 ++++++++++++++-
 9 files changed, 127 insertions(+), 9 deletions(-)

-- 
2.21.0


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

end of thread, other threads:[~2023-03-08 12:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 13:30 [PATCH bpf-next 0/5] Add PERF_FORMAT_LOST read_format Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 1/5] perf/core: " Daniel Xu
2019-09-17 14:32   ` kbuild test robot
2019-09-17 15:22   ` kbuild test robot
2019-09-24  8:33   ` Jiri Olsa
2019-09-27 21:28     ` Daniel Xu
2019-10-25 18:19       ` Daniel Xu
2019-10-28  9:12     ` Peter Zijlstra
2023-03-08 12:20       ` Lorenz Bauer
2019-09-17 13:30 ` [PATCH bpf-next 2/5] perf/core: Sync perf_event.h to tools Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 3/5] libbpf: Add helpers to extract perf fd from bpf_link Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 4/5] libbpf: Set read_format PERF_FORMAT_LOST on kprobe perf fds Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 5/5] libbpf: Add selftest for PERF_FORMAT_LOST perf read_format Daniel Xu

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