From: bot+bpf-ci@kernel.org
To: leon.hwang@linux.dev,bpf@vger.kernel.org
Cc: ast@kernel.org,daniel@iogearbox.net,john.fastabend@gmail.com,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,qmo@kernel.org,shuah@kernel.org,leon.hwang@linux.dev,yatsenko@meta.com,avinash.duduskar@gmail.com,a.s.protopopov@gmail.com,ameryhung@gmail.com,jordan@jrife.io,rongtao@cestc.cn,eyal.birger@gmail.com,pulehui@huawei.com,tanjingguo@huawei.com,malin89@huawei.com,linux-kernel@vger.kernel.org,linux-trace-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 08/21] bpf: Move helpers out of CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS guard in trampoline
Date: Mon, 12 Oct 2026 16:11:50 +0000 (UTC) [thread overview]
Message-ID: <6dde27849db2f38caae71422579693dde1a24c280e22c3174a770be74f877787@mail.kernel.org> (raw)
In-Reply-To: <20261012154024.29423-9-leon.hwang@linux.dev>
[-- Attachment #1: Type: text/plain, Size: 3086 bytes --]
> bpf: Move helpers out of CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS guard in trampoline
TL;DR: Moved trampoline helpers may trigger unused-function warnings (build
failure with CONFIG_WERROR) on non-x86_64 configs with CONFIG_BPF_SYSCALL
until a later patch adds callers; only this commit is affected.
> diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c
> index a2fd0bd8c685..bb832af8703f 100644
> --- a/kernel/bpf/trampoline.c
> +++ b/kernel/bpf/trampoline.c
> @@ -60,6 +60,32 @@ static void trampoline_unlock(struct bpf_trampoline *tr)
> mutex_unlock(select_trampoline_lock(tr));
> }
>
> +#ifdef CONFIG_BPF_SYSCALL
> +
> +static void trampoline_lock_all(void)
> +{
> + int i;
> +
> + for (i = 0; i < TRAMPOLINE_LOCKS_TABLE_SIZE; i++)
> + mutex_lock(&trampoline_locks[i].mutex);
> +}
> +
> +static void trampoline_unlock_all(void)
> +{
> + int i;
> +
> + for (i = 0; i < TRAMPOLINE_LOCKS_TABLE_SIZE; i++)
> + mutex_unlock(&trampoline_locks[i].mutex);
> +}
> +
> +static void bpf_trampoline_multi_attach_init(struct bpf_trampoline *tr)
> +{
> + tr->multi_attach.old_image = tr->cur_image;
> + tr->multi_attach.old_flags = tr->flags;
> +}
> +
> +#endif /* CONFIG_BPF_SYSCALL */
> +
Can this add a new "defined but not used" warning on configs that have
CONFIG_BPF_SYSCALL but not CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS?
These three helpers are static and are now guarded only by
CONFIG_BPF_SYSCALL, but their only callers at this point in the series,
bpf_trampoline_multi_attach() and bpf_trampoline_multi_detach(), are still
inside:
#if defined(CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS) && \
defined(CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS) && \
defined(CONFIG_BPF_SYSCALL)
trampoline.o is built for CONFIG_BPF_JIT, and only x86_64 selects
HAVE_SINGLE_FTRACE_DIRECT_OPS. On arm64, riscv, s390, x86_32, or x86_64
without DYNAMIC_FTRACE_WITH_DIRECT_CALLS, a CONFIG_BPF_JIT=y,
CONFIG_BPF_SYSCALL=y build would define trampoline_lock_all(),
trampoline_unlock_all() and bpf_trampoline_multi_attach_init() with no users,
and -Wunused-function would warn for each of them. With CONFIG_WERROR=y that
becomes a build failure.
The commit message says the CONFIG_BPF_SYSCALL guard is kept "to avoid
compiling warning when CONFIG_BPF_SYSCALL is disabled", but this seems to
trade that warning for the same kind of warning when CONFIG_BPF_SYSCALL is
enabled.
The helpers only get callers outside the old guard in a later patch of the
series, commit 59e80b53cc6b ("bpf: Add
bpf_trampoline_multi_prog_attach/detach()"), which adds users under
#ifdef CONFIG_BPF_SYSCALL. So the final state looks
fine, but this commit on its own does not build warning-free on those configs.
Would it make sense to fold this move into that later patch, or mark the
helpers __maybe_unused for the interim, so each commit in the series builds
cleanly?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/38273555988
next prev parent reply other threads:[~2026-10-12 16:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 15:40 [PATCH bpf-next v2 00/21] bpf: Add tracing_multi link support for bpf progs Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 01/21] bpf: Initialize ftrace_managed in bpf_trampoline_get() Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 02/21] bpf: Drop unnecessary ftrace_location() in register/unregister/modify_fentry_multi() Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 03/21] bpf, x86: Factor out bpf_arch_text_poke_prepare_insns() helper on x86_64 Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 04/21] bpf, x86: Factor out bpf_arch_text_poke_check_ip() " Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 05/21] bpf, x86: Introduce bpf_arch_text_poke_batch() " Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 06/21] bpf: Add bpf_text_poke_batch() helper in trampoline Leon Hwang
2026-10-12 16:11 ` bot+bpf-ci
2026-10-12 15:40 ` [PATCH bpf-next v2 07/21] bpf: Check tgt_prog before is_tracing_multi_id() in verifier Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 08/21] bpf: Move helpers out of CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS guard in trampoline Leon Hwang
2026-10-12 16:11 ` bot+bpf-ci [this message]
2026-10-12 15:40 ` [PATCH bpf-next v2 09/21] bpf: Add bpf_trampoline_multi_prog_attach/detach() Leon Hwang
2026-10-12 16:33 ` bot+bpf-ci
2026-10-12 15:40 ` [PATCH bpf-next v2 10/21] bpf: Shrink CONFIG_HAVE_SINGLE_FTRACE_DIRECT_OPS guard scope for bpf_tracing_multi_attach() Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 11/21] bpf: Add tracing_multi link support for bpf progs Leon Hwang
2026-10-12 16:33 ` bot+bpf-ci
2026-10-12 15:40 ` [PATCH bpf-next v2 12/21] libbpf: " Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 13/21] bpf: Add tracing_multi link fdinfo " Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 14/21] bpf: Add tracing_multi link info " Leon Hwang
2026-10-12 16:33 ` bot+bpf-ci
2026-10-12 15:40 ` [PATCH bpf-next v2 15/21] selftests/bpf: Add tracing_multi bpf prog attach test Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 16/21] selftests/bpf: Add tracing_multi bpf prog attach failure tests Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 17/21] selftests/bpf: Add tracing_multi bpf prog cookie test Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 18/21] selftests/bpf: Add tracing_multi bpf prog rollback test Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 19/21] selftests/bpf: Add tracing_multi bpf prog link info test Leon Hwang
2026-10-12 16:11 ` bot+bpf-ci
2026-10-12 15:40 ` [PATCH bpf-next v2 20/21] selftests/bpf: Test tailcall with fentry.multi Leon Hwang
2026-10-12 15:40 ` [PATCH bpf-next v2 21/21] selftests/bpf: Benchmark tracing_multi bpf progs attachment Leon Hwang
2026-10-12 16:33 ` bot+bpf-ci
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=6dde27849db2f38caae71422579693dde1a24c280e22c3174a770be74f877787@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=a.s.protopopov@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=avinash.duduskar@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=eyal.birger@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jordan@jrife.io \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=malin89@huawei.com \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=pulehui@huawei.com \
--cc=qmo@kernel.org \
--cc=rongtao@cestc.cn \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tanjingguo@huawei.com \
--cc=yatsenko@meta.com \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®