BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Suchit Karunakaran" <suchitkarunakaran@gmail.com>
Cc: linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH 2/2] perf build: compile BPF skeletons with -mcpu=v3
Date: Thu, 07 May 2026 23:49:59 +0000	[thread overview]
Message-ID: <20260507234959.EEC5BC2BCB8@smtp.kernel.org> (raw)
In-Reply-To: <20260507184238.65280-2-suchitkarunakaran@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Adding `-mcpu=v3` to `CLANG_OPTIONS` forces all BPF skeletons to use the BPF v3 ISA, breaking backward compatibility for perf tools designed to run on older kernels.
--

commit 2e8791aeccf694e1ae9ed9fda46e3a6f73332838
Author: Suchit Karunakaran <suchitkarunakaran@gmail.com>

perf build: compile BPF skeletons with -mcpu=v3

This commit adds -mcpu=v3 to CLANG_OPTIONS to support the atomic
cmpxchg instruction required by the lock_contention BPF program.
This forces Clang to emit BPF ISA v3 instructions during skeleton
compilation.

> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index cee19c923c060..a9a8c84b6b006 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf

[ ... ]

> @@ -1195,7 +1195,7 @@ ifneq ($(CROSS_COMPILE),)
>  CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
>  endif
>  
> -CLANG_OPTIONS = -Wall
> +CLANG_OPTIONS = -Wall -mcpu=v3

Does this change break backward compatibility for other perf tools running
on older kernels?

Since CLANG_OPTIONS is used in the pattern rule for compiling all BPF
skeletons, this forces every BPF program in perf (such as
augmented_raw_syscalls.bpf.c and off_cpu.bpf.c) to target the BPF ISA v3.

Kernels older than 5.1 do not support v3 instructions and will reject
these programs during the verifier load phase.

Should the -mcpu=v3 flag be restricted exclusively to the target that
needs it, perhaps using a target-specific append for lock_contention.bpf.o?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260507184238.65280-1-suchitkarunakaran@gmail.com?part=2

  reply	other threads:[~2026-05-07 23:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 18:42 [PATCH 1/2] perf/lock: Fix non-atomic max/time and min_time updates in contention_data Suchit Karunakaran
2026-05-07 18:42 ` [PATCH 2/2] perf build: compile BPF skeletons with -mcpu=v3 Suchit Karunakaran
2026-05-07 23:49   ` sashiko-bot [this message]
2026-05-10  6:47     ` Namhyung Kim

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=20260507234959.EEC5BC2BCB8@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    --cc=suchitkarunakaran@gmail.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