From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3] perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations
Date: Sun, 06 Dec 2026 01:14:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-252023@kernel.org> (raw)
In-Reply-To: <20261206010021.2830750-1-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf: unresolved maintainer objection to ten bpf-gcc workaround
flags
--
commit 01cc9ea53169f37881bab27710483ce98ca56d3e
Author: Ian Rogers <irogers@google.com>
perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations
This commit disables ten GCC optimization passes and adds -std=gnu11 for
bpf-gcc builds in tools/perf/bpf_skel.mak, and updates lock_contention.bpf.c
and sample_filter.bpf.c to emit CO-RE relocations accepted by libbpf and the
kernel verifier.
> diff --git a/tools/perf/bpf_skel.mak b/tools/perf/bpf_skel.mak
> index 7b7edf5065091..ea158fb47b848 100644
> --- a/tools/perf/bpf_skel.mak
> +++ b/tools/perf/bpf_skel.mak
> @@ -32,7 +32,25 @@ ifeq ($(CONFIG_PERF_BPF_SKEL_BPF_GCC),y)
> QUIET_BPF_CC = $(QUIET_BPF_GCC)
> IS_LITTLE_ENDIAN := $(shell $(CC) -dM -E - </dev/null | \
> grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
> - BPF_OPTIONS = -Wall -mcpu=v3 -fno-ident -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes \
> + # Disable GCC passes that emit BPF code rejected by libbpf or the verifier:
> + # - -fno-ivopts: keep scalar loop counters instead of pointer-equality
> + # latches (PTR_TO_MAP_VALUE / PTR_TO_STACK) that is_branch_taken() cannot
> + # bound.
> + # - -fno-ipa-sra -fno-partial-inlining: avoid .isra/.part subprogram clones
> + # that omit .BTF.ext func_info records.
> + # - -fno-tree-loop-im -fno-move-loop-invariants: keep CO-RE relocations
> + # inside bpf_core_field_exists() guards instead of hoisting them into loop
> + # preheaders where libbpf poisons missing-field relocations.
> + # - -fno-if-conversion -fno-if-conversion2 -fno-ssa-phiopt
> + # -fno-schedule-insns -fno-schedule-insns2: prevent converting pointer
> + # NULL checks into branchless (-ptr | ptr) >> 63 pointer ALU or hoisting
> + # pointer arithmetic above NULL / bounds checks.
> + BPF_OPTIONS = -Wall -mcpu=v3 -fno-ident \
> + -fno-ivopts -fno-ipa-sra -fno-partial-inlining \
> + -fno-tree-loop-im -fno-move-loop-invariants \
> + -fno-if-conversion -fno-if-conversion2 -fno-ssa-phiopt \
> + -fno-schedule-insns -fno-schedule-insns2 \
> + -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes \
> -D__TARGET_ARCH_$(SRCARCH) $(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
> BPF_SYS_INCLUDES = $(call get_sys_includes,$(CC),)
> else
[Severity: Low]
As reported by Namhyung Kim on v2 [1], carrying ten GCC optimization-pass
disabling flags in BPF_OPTIONS raises maintainability concerns while
tools/perf/Makefile.config still keeps bpf-gcc preferred by default on GCC
builds (prefer_bpf_gcc := $(CC_NO_CLANG)).
Unlike test_progs-bpf_gcc in tools/testing/selftests/bpf/Makefile, which
treats bpf-gcc as an optional flavor without global pass-disabling flags,
this disables ivopts, ipa-sra, partial-inlining, loop invariant motion,
if-conversion, phiopt, and instruction scheduling for all perf skeletons.
Should bpf-gcc be made opt-in until GCC fixes these codegen issues instead
of carrying these flags?
[1] https://lore.kernel.org/r/axO9dKDMajQkON36@google.com
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206010021.2830750-1-irogers@google.com?part=1
prev parent reply other threads:[~2026-12-06 1:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 1:00 [PATCH v3] perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations Ian Rogers
2026-12-06 1:14 ` sashiko-bot [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=sashiko-outbox-252023@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=irogers@google.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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