Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Viktor Malik <vmalik@redhat.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	linux-perf-users@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	Howard Chu <howardchu95@gmail.com>,
	linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
	Michael Petlan <mpetlan@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] perf trace: Refactor augmented_raw_syscalls using bpf_loop
Date: Wed, 1 Jul 2026 17:00:33 -0700	[thread overview]
Message-ID: <akWqIfWPMCdaGgGg@google.com> (raw)
In-Reply-To: <360bfd5c-b023-4952-9e24-53fcc26690d3@redhat.com>

On Wed, Jul 01, 2026 at 08:12:06AM +0200, Viktor Malik wrote:
> On 6/30/26 07:42, Viktor Malik wrote:
> > On 6/29/26 22:35, Namhyung Kim wrote:
> >> On Thu, Jun 25, 2026 at 02:05:29PM +0200, Viktor Malik wrote:
> >>> On 6/24/26 21:24, Namhyung Kim wrote:
> >>>> 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.
> >>>
> >>> How much strict are you on this requirement? IMHO, the very least we
> >>> need to fix the verifier issue is bpf_loop, so that would still not work
> >>> on 5.10 and 5.15 LTS kernels.
> >>
> >> I don't think it's an absolute requirement, but I think we don't want to
> >> break any existing working setup (old kernel + old compiler).
> >>
> >>>
> >>> We could probably keep the open-coded loop in case bpf_loop is not
> >>> available but `perf trace` would still fail on kernels without bpf_loop
> >>> for new perf built with Clang>=22. Also, the code would be a bit ugly
> >>> and I'm not sure how well the feature check for helpers (bpf_loop) works
> >>> on old kernels.
> >>  
> >> Any chance process_arg_cb() can be called directly in the regular for
> >> loop on old kernels?
> > 
> > That's my thinking, too. Should be pretty straightforward, I'm going to
> > give it a try in v2.
> 
> Btw, I just noticed that util/bpf_skel/lock_contention.bpf.c already
> uses bpf_loop without any fallback so newer perf (at least `perf lock`)
> won't be usable on kernels without bpf_loop anyways.
 
IIUC the lock contention tracepoints were added to v5.19 so it won't
work on old kernels anyway. :)

Thanks,
Namhyung


      reply	other threads:[~2026-07-02  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 11:25 [PATCH] perf trace: Refactor augmented_raw_syscalls using bpf_loop Viktor Malik
2026-06-23 11:39 ` sashiko-bot
2026-06-23 15:27 ` Alexei Starovoitov
2026-06-23 17:10   ` Namhyung Kim
2026-06-24  6:47     ` Viktor Malik
2026-06-24 10:27       ` Viktor Malik
2026-06-24 17:19         ` Andrii Nakryiko
2026-06-25 11:58           ` Viktor Malik
2026-06-25 17:55             ` Andrii Nakryiko
2026-06-26  6:04               ` Viktor Malik
2026-07-01 18:06                 ` Andrii Nakryiko
2026-06-24 19:24       ` Namhyung Kim
2026-06-25 12:05         ` Viktor Malik
2026-06-29 20:35           ` Namhyung Kim
2026-06-30  5:42             ` Viktor Malik
2026-07-01  6:12               ` Viktor Malik
2026-07-02  0:00                 ` Namhyung Kim [this message]

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=akWqIfWPMCdaGgGg@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=howardchu95@gmail.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=vmalik@redhat.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