[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <80f412f1-a060-463b-9034-3128906e6929@linux.dev>
Date: Mon, 16 Dec 2024 09:21:15 -0800
From: Yonghong Song <yonghong.song@...ux.dev>
To: Leo Yan <leo.yan@....com>, Arnaldo Carvalho de Melo <acme@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
James Clark <james.clark@...aro.org>, "Liang, Kan"
<kan.liang@...ux.intel.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman
<eddyz87@...il.com>, Song Liu <song@...nel.org>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Matt Bobrowski <mattbobrowski@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>, Masami Hiramatsu
<mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
bpf@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Suzuki K Poulose <suzuki.poulose@....com>, Mike Leach <mike.leach@...aro.org>
Subject: Re: [PATCH v1 2/7] bpf: Add bpf_perf_event_aux_pause kfunc
On 12/15/24 11:34 AM, Leo Yan wrote:
> The bpf_perf_event_aux_pause kfunc will be used to control the Perf AUX
> area to pause or resume.
>
> An example use-case is attaching eBPF to Ftrace tracepoints. When a
> tracepoint is hit, the associated eBPF program will be executed. The
> eBPF program can invoke bpf_perf_event_aux_pause() to pause or resume
> AUX trace. This is useful for fine-grained tracing by combining
> Perf and eBPF.
>
> This commit implements the bpf_perf_event_aux_pause kfunc, and make it
> pass the eBPF verifier.
The subject and commit message mentions to implement a kfunc,
but actually you implemented a uapi helper. Please implement a kfunc
instead (searching __bpf_kfunc in kernel/bpf directory).
>
> Signed-off-by: Leo Yan <leo.yan@....com>
> ---
> include/uapi/linux/bpf.h | 21 ++++++++++++++++
> kernel/bpf/verifier.c | 2 ++
> kernel/trace/bpf_trace.c | 52 ++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 75 insertions(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 4162afc6b5d0..678278c91ce2 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -5795,6 +5795,26 @@ union bpf_attr {
> * 0 on success.
> *
> * **-ENOENT** if the bpf_local_storage cannot be found.
> + *
> + * long bpf_perf_event_aux_pause(struct bpf_map *map, u64 flags, u32 pause)
> + * Description
> + * Pause or resume an AUX area trace associated to the perf event.
> + *
> + * The *flags* argument is specified as the key value for
> + * retrieving event pointer from the passed *map*.
> + *
> + * The *pause* argument controls AUX trace pause or resume.
> + * Non-zero values (true) are to pause the AUX trace and the zero
> + * value (false) is for re-enabling the AUX trace.
> + * Return
> + * 0 on success.
> + *
> + * **-ENOENT** if not found event in the events map.
> + *
> + * **-E2BIG** if the event index passed in the *flags* parameter
> + * is out-of-range of the map.
> + *
> + * **-EINVAL** if the flags passed is an invalid value.
> */
> #define ___BPF_FUNC_MAPPER(FN, ctx...) \
> FN(unspec, 0, ##ctx) \
> @@ -6009,6 +6029,7 @@ union bpf_attr {
> FN(user_ringbuf_drain, 209, ##ctx) \
> FN(cgrp_storage_get, 210, ##ctx) \
> FN(cgrp_storage_delete, 211, ##ctx) \
> + FN(perf_event_aux_pause, 212, ##ctx) \
> /* */
>
> /* backwards-compatibility macros for users of __BPF_FUNC_MAPPER that don't
>
[...]
Powered by blists - more mailing lists