linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Leo Yan <leo.yan@arm.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Ian Rogers <irogers@google.com>,
	James Clark <james.clark@linaro.org>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Matt Bobrowski <mattbobrowski@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@linaro.org>
Subject: Re: [PATCH v1 2/7] bpf: Add bpf_perf_event_aux_pause kfunc
Date: Mon, 16 Dec 2024 09:21:15 -0800	[thread overview]
Message-ID: <80f412f1-a060-463b-9034-3128906e6929@linux.dev> (raw)
In-Reply-To: <20241215193436.275278-3-leo.yan@arm.com>




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@arm.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
>
[...]

  reply	other threads:[~2024-12-16 17:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15 19:34 [PATCH v1 0/7] perf auxtrace: Support AUX pause with BPF backend Leo Yan
2024-12-15 19:34 ` [PATCH v1 1/7] perf/core: Make perf_event_aux_pause() as external function Leo Yan
2024-12-15 19:34 ` [PATCH v1 2/7] bpf: Add bpf_perf_event_aux_pause kfunc Leo Yan
2024-12-16 17:21   ` Yonghong Song [this message]
2025-07-14 17:45     ` Leo Yan
2025-07-15 17:12       ` Yonghong Song
2025-07-18 15:38         ` Leo Yan
2025-07-21 22:32           ` Eduard Zingerman
2024-12-15 19:34 ` [PATCH v1 3/7] bpf: Sync bpf_perf_event_aux_pause in tools UAPI bpf.h Leo Yan
2024-12-15 19:34 ` [PATCH v1 4/7] perf: auxtrace: Introduce eBPF program for AUX pause Leo Yan
2024-12-15 19:34 ` [PATCH v1 5/7] perf: auxtrace: Support BPF backend " Leo Yan
2024-12-15 19:34 ` [PATCH v1 6/7] perf record: Support AUX pause with BPF Leo Yan
2024-12-15 19:34 ` [PATCH v1 7/7] perf docs: Document " Leo Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80f412f1-a060-463b-9034-3128906e6929@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kpsingh@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).