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] perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations
Date: Thu, 03 Dec 2026 22:34:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-248746@kernel.org> (raw)
In-Reply-To: <20261203221459.1567050-1-irogers@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf: undocumented __clang__ guard on mem_hops check in
perf_get_sample()
--
commit c2700c3fd451a5a8cebb067313708ff938102232
Author: Ian Rogers <irogers@google.com>
perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations
This commit disables several GCC optimization passes in bpf_skel.mak and
adjusts CO-RE relocations in lock_contention.bpf.c and sample_filter.bpf.c
so perf BPF skeletons built with bpf-gcc pass libbpf relocation and kernel
verification.
> diff --git a/tools/perf/util/bpf_skel/sample_filter.bpf.c b/tools/perf/util/bpf_skel/sample_filter.bpf.c
> index e5666d4c17228..9ddac8e5cd789 100644
> --- a/tools/perf/util/bpf_skel/sample_filter.bpf.c
> +++ b/tools/perf/util/bpf_skel/sample_filter.bpf.c
[ ... ]
> @@ -142,35 +147,44 @@ static inline __u64 perf_get_sample(struct bpf_perf_event_data_kern *kctx,
[ ... ]
> if (entry->part == 8) {
> + union perf_mem_data_src___new src_new = {
> + .val = src.val,
> + };
> +#ifdef __clang__
> union perf_mem_data_src___new *data = (void *)&kctx->data->data_src;
>
> - if (__builtin_preserve_field_info(data->mem_hops, BPF_FIELD_EXISTS))
> - return data->mem_hops;
> -
> - return 0;
> + if (!__builtin_preserve_field_info(data->mem_hops, BPF_FIELD_EXISTS))
> + return 0;
> +#endif
> + return src_new.mem_hops;
> }
[Severity: Low]
Is this #ifdef __clang__ guard around the mem_hops check needed, or should
it be documented?
Commit 4fc844347ec1 ("perf bpf: Use __builtin_preserve_field_info for GCC
compatibility") switched this check to __builtin_preserve_field_info() for
GCC, and this patch disables it on bpf-gcc without a comment or mention in
the commit message.
Because perf_sample_filter() calls bpf_cast_to_kern_ctx() and
perf_get_sample() checks data->sample_flags, pre-5.16 kernels lacking
mem_hops cannot reach this path. Either drop this check for both compilers
or briefly document the #ifdef __clang__ guard here and in the changelog.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203221459.1567050-1-irogers@google.com?part=1
prev parent reply other threads:[~2026-12-03 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 22:14 [PATCH] perf build: Fix bpf-gcc skeleton codegen and CO-RE relocations Ian Rogers
2026-12-03 22:34 ` 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-248746@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