[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240726-overflow_check_libperf-v2-0-7d154dcf6bea@rivosinc.com>
Date: Fri, 26 Jul 2024 22:29:30 -0700
From: Charlie Jenkins <charlie@...osinc.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Andrii Nakryiko <andrii@...nel.org>, Eduard Zingerman <eddyz87@...il.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, Charlie Jenkins <charlie@...osinc.com>,
Shunsuke Nakamura <nakamura.shun@...itsu.com>
Subject: [PATCH v2 0/8] libperf: Add interface for overflow check of
sampling events
I was going to send a similar series but after looking through the
mailing list found this approach which fits my use-case exactly. I have
rebased the series and applied the suggestions from Namhyung. The
original cover letter with minor changes follows.
This patch series adds interface for overflow check of sampling events
to libperf.
First patch move 'open_flags' from tools/perf to evsel::open_flags.
Second patch extracts out the opts used by BPF into a common header to
be used by perf.
Third patch introduce perf_{evsel, evlist}__open_opt() with extensible
structure opts.
Fourth patch adds support for overflow handling of sampling events.
Fifth patch adds a interface to check overflowed events.
Sixth patch adds a interface to perform IOC_REFRESH and IOC_PERIOD.
Seventh and eighth patch adds tests.
Signed-off-by: Charlie Jenkins <charlie@...osinc.com>
---
Previous version at:
https://lore.kernel.org/lkml/20220422093833.340873-1-nakamura.shun@fujitsu.com/
Changes in v2:
- Rebase onto v6.10
- Add a patch to move BPF opts helpers into a global include
- Renamed flags to fcntl_flags
- Changed signal type to int
- Add comment to owner_type member
- Add _cpu to perf_evsel__run_fcntl
- Rename sig to sigact
- Remove "!" from owner.type check
- Removed _GNU_SOURCE addition
- Removed null check for perf_evsel__attr()
- Make timeouts consistent between test-evlist.c and test-evsel.c
Changes in v1:
- Move initialization/reference of evsel->open_flags from the first
patch to the second patch
- Move signal-related handling and related fields of the opts
structure from the second patch to the third patch
- Move _GNU_SOURCE from test-evlist.c to Makefile
- Delete *_cpu() function
- Refactor the fourth patch
- Fix test to use real-time signals instead of standard signals
Changes in RFC v2:
- Delete perf_evsel__set_close_on_exec() function
- Introduce perf_{evsel, evlist}__open_opt() with extensible structure
opts
- Fix perf_evsel__set_signal() to a internal function
- Add bool type argument to perf_evsel__check_{fd, fd_cpu}() to indicate
overflow results
---
Charlie Jenkins (1):
libbpf: Move opts code into dedicated header
Shunsuke Nakamura (7):
libperf: Move 'open_flags' from tools/perf to evsel::open_flags
libperf: Introduce perf_{evsel, evlist}__open_opt with extensible struct opts
libperf: Add support for overflow handling of sampling events
libperf: Add perf_evsel__has_fd() functions
libperf: Add perf_evsel__{refresh, period}() functions
libperf test: Add test_stat_overflow()
libperf test: Add test_stat_overflow_event()
tools/include/tools/opts.h | 68 +++++++++++++
tools/lib/bpf/bpf.c | 1 +
tools/lib/bpf/btf.c | 1 +
tools/lib/bpf/btf_dump.c | 1 +
tools/lib/bpf/libbpf.c | 3 +-
tools/lib/bpf/libbpf_internal.h | 48 ---------
tools/lib/bpf/linker.c | 1 +
tools/lib/bpf/netlink.c | 1 +
tools/lib/bpf/ringbuf.c | 1 +
tools/lib/perf/Documentation/libperf.txt | 17 ++++
tools/lib/perf/Makefile | 1 +
tools/lib/perf/evlist.c | 20 ++++
tools/lib/perf/evsel.c | 169 +++++++++++++++++++++++++++++--
tools/lib/perf/include/internal/evsel.h | 2 +
tools/lib/perf/include/perf/evlist.h | 3 +
tools/lib/perf/include/perf/evsel.h | 30 ++++++
tools/lib/perf/libperf.map | 5 +
tools/lib/perf/tests/test-evlist.c | 112 +++++++++++++++++++-
tools/lib/perf/tests/test-evsel.c | 107 +++++++++++++++++++
tools/perf/util/evsel.c | 16 +--
tools/perf/util/evsel.h | 1 -
21 files changed, 541 insertions(+), 67 deletions(-)
---
base-commit: 0c3836482481200ead7b416ca80c68a29cfdaabd
change-id: 20240726-overflow_check_libperf-88ad144d4dca
--
- Charlie
Powered by blists - more mailing lists