From: sashiko-bot@kernel.org
To: "Chen Pei" <cp0613@linux.alibaba.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf] bpf, riscv: Make arena support depend on ZACAS
Date: Tue, 01 Sep 2026 13:26:49 +0000 [thread overview]
Message-ID: <20260901132649.F24591F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901131132.16241-1-cp0613@linux.alibaba.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The unconditional use of `system_has_cmpxchg128()` in `bpf_jit_supports_arena()` causes a build failure when `CONFIG_RISCV_ISA_ZACAS` or `CONFIG_TOOLCHAIN_HAS_ZACAS` is disabled.
--
commit c73d679b84188e98d5cff0171b751fa3f4ce5627
Author: Chen Pei <cp0613@linux.alibaba.com>
bpf, riscv: Make arena support depend on ZACAS
This patch updates bpf_jit_supports_arena() to return the result of
system_has_cmpxchg128(). This ensures that BPF arena map creation fails
with -EOPNOTSUPP on RISC-V systems that do not have the ZACAS extension.
> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index e7378be171a9f..a5870d386f983 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c
> @@ -2141,7 +2141,11 @@ bool bpf_jit_supports_ptr_xchg(void)
>
> bool bpf_jit_supports_arena(void)
> {
> - return true;
> + /*
> + * The arena range tree uses kmalloc_nolock(), which needs
> + * cmpxchg128, provided by ZACAS on riscv.
> + */
> + return system_has_cmpxchg128();
[Severity: Low]
Does this code cause a build regression when compiling without ZACAS support?
Looking at arch/riscv/include/asm/cmpxchg.h, system_has_cmpxchg128() is
conditionally defined without a fallback:
#if defined(CONFIG_64BIT) && defined(CONFIG_RISCV_ISA_ZACAS) && defined(CONFIG_TOOLCHAIN_HAS_ZACAS)
#define system_has_cmpxchg128() riscv_has_extension_unlikely(...)
...
#endif
If a kernel is built with CONFIG_BPF_JIT=y but CONFIG_RISCV_ISA_ZACAS=n
(or CONFIG_TOOLCHAIN_HAS_ZACAS=n), will the unconditional use of
system_has_cmpxchg128() in bpf_jit_supports_arena() result in an implicit
declaration error?
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901131132.16241-1-cp0613@linux.alibaba.com?part=1
prev parent reply other threads:[~2026-09-01 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 13:11 [PATCH bpf] bpf, riscv: Make arena support depend on ZACAS Chen Pei
2026-09-01 13:11 ` Chen Pei
2026-09-01 13:26 ` 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=20260901132649.F24591F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cp0613@linux.alibaba.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.