bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE
@ 2019-08-20 21:48 Daniel Xu
  2019-08-20 21:48 ` [PATCH v4 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl Daniel Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel Xu @ 2019-08-20 21:48 UTC (permalink / raw)
  To: bpf, songliubraving, yhs, andriin, peterz, mingo, acme
  Cc: Daniel Xu, ast, alexander.shishkin, jolsa, namhyung,
	linux-kernel, kernel-team

It's useful to know [uk]probe's nmissed and nhit stats. 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
retrieve information about FD-based probes.

This patch adds a new ioctl that lets users query nmissed (as well as
nhit for completeness). We currently only add support for [uk]probes
but leave the possibility open for other probes like tracepoint.

v3 -> v4:
- Make kernel code set size field on ioctl arg
- Update selftests to check size field
- Remove unnecessary function stubs

v2 -> v3:
- Introduce bpf_link_type and associated getter to track underlying link
  types
- Add back size field in perf_event_query_probe for forward/backwards
  compat
- Remove NULL checks, fix typos

v1 -> v2:
- More descriptive cover letter
- Make API more generic and support uprobes as well
- Use casters/getters for libbpf instead of single getter
- Fix typos
- Remove size field from ioctl struct
- Split out libbpf.h sync to tools dir to separate commit

Daniel Xu (4):
  tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl
  libbpf: Add helpers to extract perf fd from bpf_link
  tracing/probe: Sync perf_event.h to tools
  tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE

 include/linux/trace_events.h                  |   2 +
 include/uapi/linux/perf_event.h               |  23 ++++
 kernel/events/core.c                          |  20 +++
 kernel/trace/trace_kprobe.c                   |  25 ++++
 kernel/trace/trace_uprobe.c                   |  25 ++++
 tools/include/uapi/linux/perf_event.h         |  23 ++++
 tools/lib/bpf/libbpf.c                        |  21 ++++
 tools/lib/bpf/libbpf.h                        |  13 ++
 tools/lib/bpf/libbpf.map                      |   3 +
 .../selftests/bpf/prog_tests/attach_probe.c   | 115 ++++++++++++++++++
 10 files changed, 270 insertions(+)

-- 
2.21.0


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

end of thread, other threads:[~2019-08-20 21:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 21:48 [PATCH v4 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE Daniel Xu
2019-08-20 21:48 ` [PATCH v4 bpf-next 1/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl Daniel Xu
2019-08-20 21:48 ` [PATCH v4 bpf-next 2/4] libbpf: Add helpers to extract perf fd from bpf_link Daniel Xu
2019-08-20 21:48 ` [PATCH v4 bpf-next 3/4] tracing/probe: Sync perf_event.h to tools Daniel Xu
2019-08-20 21:48 ` [PATCH v4 bpf-next 4/4] tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE 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).