Re: [PATCH] perf trace: Refactor augmented_raw_syscalls using bpf_loop

From: Namhyung Kim

Date: Wed Jun 24 2026 - 15:24:40 EST


On Wed, Jun 24, 2026 at 08:47:38AM +0200, Viktor Malik wrote:
> On 6/23/26 19:10, Namhyung Kim wrote:
> > Hello,
> >
> > On Tue, Jun 23, 2026 at 08:27:39AM -0700, Alexei Starovoitov wrote:
> >> On Tue Jun 23, 2026 at 4:25 AM PDT, Viktor Malik wrote:
[SNIP]
> >>> + struct args_loop_ctx loop_ctx = {
> >>> + .args = args,
> >>> + .beauty_map = beauty_map,
> >>> + .payload_offset = payload_offset,
> >>> + .value_size = value_size,
> >>> + .output = &output,
> >>> + .do_output = &do_output
> >>> + };
> >>> + iters = bpf_loop(6, process_arg_cb, &loop_ctx, 0);
> >>
> >> bpf_loop() is old and generally not recommended.
> >> Please use bpf_for() then the diff will be one line change and
> >> can scale to any number of args. Not just 6.
>
> Thanks Alexei, I didn't know about this preference.
>
> > One thing we should take care is to support old kernels. The oldest
> > LTS kernel in the kernel.org is 5.10 and bpf_loop() was introduced in
> > 5.17 and bpf_for (bpf_iter_num) was 6.4.
>
> The problematic loop was introduced in 6.12 by a68fd6a6cdd3 ("perf
> trace: Collect augmented data using BPF") so we should be good using
> bpf_for. Or is perf from 7.2 supposed to work on 5.10 LTS kernels?

Yep, we'd like to support old kernels.

Thanks,
Namhyung