From: Pu Lehui <pulehui@huawei.com>
To: Kuan-Wei Chiu <visitorckw@gmail.com>, <ast@kernel.org>,
<daniel@iogearbox.net>, <andrii@kernel.org>, <eddyz87@gmail.com>,
<memxor@gmail.com>, <luke.r.nels@gmail.com>, <xi.wang@gmail.com>,
<pjw@kernel.org>, <palmer@dabbelt.com>, <aou@eecs.berkeley.edu>
Cc: <martin.lau@linux.dev>, <song@kernel.org>,
<yonghong.song@linux.dev>, <jolsa@kernel.org>,
<emil@etsalapatis.com>, <alex@ghiti.fr>, <jserv@ccns.ncku.edu.tw>,
<eleanor15x@gmail.com>, <marscheng@google.com>,
<bpf@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v4 0/3] riscv, bpf: Add support for signed operations and 32-bit atomics
Date: Tue, 14 Jul 2026 10:37:10 +0800 [thread overview]
Message-ID: <66bbcfac-7fe8-4823-bf30-dccd8adbe2f4@huawei.com> (raw)
In-Reply-To: <20260714002451.4091139-1-visitorckw@gmail.com>
On 2026/7/14 8:24, Kuan-Wei Chiu wrote:
> Add support for missing signed operations and 32-bit atomics in the
> RV32 BPF JIT compiler.
>
> The current implementation lacks support for BPF_SDIV, BPF_SMOD, and
> BPF_MOVSX, ignoring the instruction offset field and treating them as
> unsigned or zero-extended. Introduce support for these operations by
> checking the offset field and emitting the corresponding instructions.
>
> Additionally, we leverage the mandatory A extension to natively support
> 32-bit BPF atomics (and, or, xor, xchg) by mapping them directly to
> amo*.w instructions. BPF_CMPXCHG continues to fall back to the
> interpreter.
>
> As a result, test_bpf.ko now runs with 0 failures, and the total number
> of successfully JIT'ed test cases increases from 843 to 902.
> ---
> Changes in v4:
> - Add a 'dst' param to emit_bpf_atomic().
>
> Changes in v3:
> - Pass insn directly to emit_alu_r32().
> - Remove the Fixes: tag and update title.
> - Consolidate size, mode, and off into insn for emit_store_r64().
>
> Changes in v2:
> - Add missing Fixes tags.
> - Fix memory ordering by emitting aq=1, rl=1
>
> Kuan-Wei Chiu (3):
> riscv, bpf: Add support for BPF_SDIV and BPF_SMOD in RV32 JIT
> riscv, bpf: Add support for BPF_MOVSX in RV32 JIT
> riscv, bpf: Add 32 bit atomic operations to RV32 JIT
>
> arch/riscv/net/bpf_jit_comp32.c | 111 +++++++++++++++++++++++++++-----
> 1 file changed, 95 insertions(+), 16 deletions(-)
>
before:
test_bpf: Summary: 846 PASSED, 216 FAILED, [847/847 JIT'ed]
after:
test_bpf: Summary: 918 PASSED, 144 FAILED, [906/906 JIT'ed]
Tested-by: Pu Lehui <pulehui@huawei.com>
prev parent reply other threads:[~2026-07-14 2:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 0:24 Kuan-Wei Chiu
2026-07-14 0:24 ` [PATCH bpf-next v4 1/3] riscv, bpf: Add support for BPF_SDIV and BPF_SMOD in RV32 JIT Kuan-Wei Chiu
2026-07-14 0:24 ` [PATCH bpf-next v4 2/3] riscv, bpf: Add support for BPF_MOVSX " Kuan-Wei Chiu
2026-07-14 0:24 ` [PATCH bpf-next v4 3/3] riscv, bpf: Add 32 bit atomic operations to " Kuan-Wei Chiu
2026-07-14 2:34 ` Pu Lehui
2026-07-14 2:37 ` Pu Lehui [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=66bbcfac-7fe8-4823-bf30-dccd8adbe2f4@huawei.com \
--to=pulehui@huawei.com \
--cc=alex@ghiti.fr \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=eleanor15x@gmail.com \
--cc=emil@etsalapatis.com \
--cc=jolsa@kernel.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luke.r.nels@gmail.com \
--cc=marscheng@google.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=song@kernel.org \
--cc=visitorckw@gmail.com \
--cc=xi.wang@gmail.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
Powered by JetHome