Thread (13 messages) 13 messages, 3 authors, 2025-07-21

Re: [PATCH v1 2/7] bpf: Add bpf_perf_event_aux_pause kfunc

From: Leo Yan <leo.yan@arm.com>
Date: 2025-07-18 15:38:04
Also in: bpf, linux-perf-users, lkml

Hi Yonghong,

On Tue, Jul 15, 2025 at 10:12:02AM -0700, Yonghong Song wrote:

[...]
quoted
I'm not certain whether using __bpf_kfunc is appropriate here, or if I
should stick to BPF_CALL to ensure support for accessing bpf_map
pointers?
Using helpers (BPF_CALL) is not an option as the whole bpf ecosystem
moves to kfunc mechanism. You can certainly use kfunc with 'struct bpf_map *'
as the argument. For example the following kfunc:
  __bpf_kfunc s64 bpf_map_sum_elem_count(const struct bpf_map *map)
in kernel/bpf/map_iter.c
Thanks a lot for suggestion. I followed the idea to refactor the patch
with kfunc, see the new version:
https://lore.kernel.org/linux-perf-users/20250718-perf_aux_pause_resume_bpf_rebase-v2-0-992557b8fb16@arm.com/T/#m27a72255c93fa672e164cb87a322b979fe8f9408 (local)

Just clarify one thing, I defined the kfunc in new patch:

  int bpf_perf_event_aux_pause(void *p__map, u64 flags, u32 pause)

Unlike your suggestion, I defined the first parameter as "void
*p__map" (I refers to bpf_arena_alloc_pages()) rather than
"struct bpf_map *map". This is because the BPF program will pass a
variable from the map section, rather than passing a map pointer.

TBH, I do not watch closely the BPF mailing list, so I may not be
fully following the conventions. If anything is incorrect, please
correct it as needed.

Thank you,

Leo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help