BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	martin.lau@kernel.org, peterz@infradead.org, song@kernel.org
Subject: Re: [PATCH bpf-next 1/3] bpf: make bpf_get_branch_snapshot() architecture-agnostic
Date: Thu, 21 Mar 2024 22:08:02 +0100	[thread overview]
Message-ID: <ZfyhspVTGeEB-p2Q@krava> (raw)
In-Reply-To: <20240321180501.734779-2-andrii@kernel.org>

On Thu, Mar 21, 2024 at 11:04:59AM -0700, Andrii Nakryiko wrote:
> perf_snapshot_branch_stack is set up in an architecture-agnostic way, so
> there is no reason for BPF subsystem to keep track of which
> architectures do support LBR or not. E.g., it looks like ARM64 might soon
> get support for BRBE ([0]), which (with proper integration) should be
> possible to utilize using this BPF helper.
> 
> perf_snapshot_branch_stack static call will point to
> __static_call_return0() by default, which just returns zero, which will
> lead to -ENOENT, as expected. So no need to guard anything here.
> 
>   [0] https://lore.kernel.org/linux-arm-kernel/20240125094119.2542332-1-anshuman.khandual@arm.com/
> 
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
>  kernel/trace/bpf_trace.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 434e3ece6688..6d000332b17b 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1182,9 +1182,6 @@ static const struct bpf_func_proto bpf_get_attach_cookie_proto_tracing = {
>  
>  BPF_CALL_3(bpf_get_branch_snapshot, void *, buf, u32, size, u64, flags)
>  {
> -#ifndef CONFIG_X86
> -	return -ENOENT;
> -#else
>  	static const u32 br_entry_size = sizeof(struct perf_branch_entry);
>  	u32 entry_cnt = size / br_entry_size;
>  
> @@ -1197,7 +1194,6 @@ BPF_CALL_3(bpf_get_branch_snapshot, void *, buf, u32, size, u64, flags)
>  		return -ENOENT;
>  
>  	return entry_cnt * br_entry_size;
> -#endif
>  }
>  
>  static const struct bpf_func_proto bpf_get_branch_snapshot_proto = {
> -- 
> 2.43.0
> 
> 

  reply	other threads:[~2024-03-21 21:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 18:04 [PATCH bpf-next 0/3] Inline two LBR-related helpers Andrii Nakryiko
2024-03-21 18:04 ` [PATCH bpf-next 1/3] bpf: make bpf_get_branch_snapshot() architecture-agnostic Andrii Nakryiko
2024-03-21 21:08   ` Jiri Olsa [this message]
2024-03-21 18:05 ` [PATCH bpf-next 2/3] bpf: inline bpf_get_branch_snapshot() helper Andrii Nakryiko
2024-03-21 21:08   ` Jiri Olsa
2024-03-21 21:27     ` Andrii Nakryiko
2024-03-21 18:05 ` [PATCH bpf-next 3/3] bpf,x86: inline bpf_get_smp_processor_id() on x86-64 Andrii Nakryiko
2024-03-21 21:08   ` Jiri Olsa
2024-03-21 21:09     ` Andrii Nakryiko
2024-03-21 22:57       ` Jiri Olsa
2024-03-21 23:38         ` Andrii Nakryiko
2024-03-21 23:49   ` Alexei Starovoitov
2024-03-22 16:45     ` Andrii Nakryiko
2024-03-25  3:28       ` Alexei Starovoitov
2024-03-25 17:01         ` Andrii Nakryiko
2024-03-21 23:46 ` [PATCH bpf-next 0/3] Inline two LBR-related helpers Alexei Starovoitov
2024-03-22 16:45   ` Andrii Nakryiko
2024-03-25  2:05     ` Alexei Starovoitov
2024-03-25 17:20       ` Andrii Nakryiko
2024-03-26  3:13         ` Alexei Starovoitov
2024-03-26 16:50           ` Andrii Nakryiko
2024-03-27 21:59             ` Alexei Starovoitov
2024-03-28 22:53               ` Andrii Nakryiko

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=ZfyhspVTGeEB-p2Q@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@kernel.org \
    --cc=peterz@infradead.org \
    --cc=song@kernel.org \
    /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