[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190809214642.12078-1-dxu@dxuuu.xyz>
Date: Fri, 9 Aug 2019 14:46:38 -0700
From: Daniel Xu <dxu@...uu.xyz>
To: songliubraving@...com, yhs@...com, andriin@...com,
peterz@...raded.org, mingo@...hat.com, acme@...nel.org
Cc: Daniel Xu <dxu@...uu.xyz>, ast@...com,
alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
namhyung@...nel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 bpf-next 0/4] tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE
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.
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 | 12 +++
include/uapi/linux/perf_event.h | 19 ++++
kernel/events/core.c | 20 ++++
kernel/trace/trace_kprobe.c | 23 ++++
kernel/trace/trace_uprobe.c | 23 ++++
tools/include/uapi/linux/perf_event.h | 19 ++++
tools/lib/bpf/libbpf.c | 19 ++++
tools/lib/bpf/libbpf.h | 8 ++
tools/lib/bpf/libbpf.map | 6 ++
.../selftests/bpf/prog_tests/attach_probe.c | 102 ++++++++++++++++++
10 files changed, 251 insertions(+)
--
2.20.1
Powered by blists - more mailing lists