Linux Perf Users
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Suchit Karunakaran <suchitkarunakaran@gmail.com>,
	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, 14 May 2026 20:52:28 -0300	[thread overview]
Message-ID: <agZgPBrlKZ655KdO@x1> (raw)
In-Reply-To: <agAqESWvLdIJBErN@google.com>

On Sat, May 09, 2026 at 11:47:45PM -0700, Namhyung Kim wrote:
> Hi Arnaldo,
> 
> On Thu, May 07, 2026 at 11:49:59PM +0000, sashiko-bot@kernel.org wrote:
> > 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.
> 
> I think it's old enough and we can move on to ensure v3 instructions.

Can I take this as an Reviewed-by or Acked-by?

- Arnaldo
 
> Thanks,
> Namhyung
> 
> > 
> > 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-14 23:52 UTC|newest]

Thread overview: 5+ 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
2026-05-10  6:47     ` Namhyung Kim
2026-05-14 23:52       ` Arnaldo Carvalho de Melo [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=agZgPBrlKZ655KdO@x1 \
    --to=acme@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --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