BPF List
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Viktor Malik <vmalik@redhat.com>, Andrii Nakryiko <andrii@kernel.org>
Cc: 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>
Subject: Re: [PATCH v4 0/2] perf trace: Refactor augmented_raw_syscalls using bpf_for
Date: Mon, 13 Jul 2026 11:00:51 -0700	[thread overview]
Message-ID: <alUn0-W-2mIDs9GE@google.com> (raw)
In-Reply-To: <cover.1783406979.git.vmalik@redhat.com>

Hello,

On Tue, Jul 07, 2026 at 08:52:45AM +0200, Viktor Malik wrote:
> The loop for processing syscall args in augment_raw_syscalls has a
> history of breaking with Clang updates. In the past, we've seen it break
> (i.e. stop passing the BPF verifier) between Clang 15 and 16 and now a
> similar thing happened between Clang 21 and 22. While the issue is
> mitigated on the main line by a recent verifier update, it remains
> broken on the 6.12 and 6.18 stable branches, effectively breaking
> `perf trace`.
> 
> The reason is that the loop is quite complex and the BPF verifier often
> struggles to prove that it terminates.
> 
> This series fixes the issue by replacing the standard for loop by the
> bpf_for macro, which uses numeric BPF iterator. This should prevent
> future breakages of this kind since the verifier has much easier job
> proving that the loop terminates. Small adjustments were necessary for
> the loop to make it work, see the second commit message for details.
> 
> To keep perf compatible with older kernels, the first commit factors out
> the loop body into a function, which is then called either from bpf_for
> or from a standard for loop, depending on whether BPF numeric iterators
> are available.
> 
> Changes from v3:
> - v3: https://lore.kernel.org/bpf/cover.1783339165.git.vmalik@redhat.com/
> - Do not remove any hacks from the BPF program to keep it backwards
>   compatible with older kernels and Clang versions (Sashiko).
> 
> Changes from v2:
> - v2: https://lore.kernel.org/bpf/cover.1783070132.git.vmalik@redhat.com/T/
> - Small refactoring suggested by Namhhyung
> - Make `size` in augment_arg() an int (found by Sashiko)
> - Keep the original way of clamping aug_size to TRACE_AUG_MAX_BUF (found
>   by Sashiko)
> 
> Changes from v1:
> - v1: https://lore.kernel.org/bpf/akWqIfWPMCdaGgGg@google.com/T/
> - Use bpf_for instead of bpf_loop (suggested by Alexei and Andrii)
> - Keep the change backwards compatible with older kernels (required by
>   Namhyung)

Andrii, are you ok with this?

Thanks,
Namhyung

> 
> Viktor Malik (2):
>   perf trace: Factor out BPF loop body
>   perf trace: Refactor augmented_raw_syscalls using bpf_for
> 
>  .../bpf_skel/augmented_raw_syscalls.bpf.c     | 155 +++++++++++-------
>  1 file changed, 98 insertions(+), 57 deletions(-)
> 
> -- 
> 2.54.0
> 

      parent reply	other threads:[~2026-07-13 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  6:52 [PATCH v4 0/2] perf trace: Refactor augmented_raw_syscalls using bpf_for Viktor Malik
2026-07-07  6:52 ` [PATCH v4 1/2] perf trace: Factor out BPF loop body Viktor Malik
2026-07-07  6:52 ` [PATCH v4 2/2] perf trace: Refactor augmented_raw_syscalls using bpf_for Viktor Malik
2026-07-13 18: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=alUn0-W-2mIDs9GE@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii@kernel.org \
    --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=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