From: bot+bpf-ci@kernel.org
To: visitorckw@gmail.com,corbet@lwn.net,skhan@linuxfoundation.org,geert@linux-m68k.org,ast@kernel.org,daniel@iogearbox.net,eddyz87@gmail.com,memxor@gmail.com,andrii@kernel.org,gerg@linux-m68k.org
Cc: rdunlap@infradead.org,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,jserv@ccns.ncku.edu.tw,marscheng@google.com,eleanor15x@gmail.com,linux-doc@vger.kernel.org,linux-kernel@vger.kernel.org,linux-m68k@lists.linux-m68k.org,bpf@vger.kernel.org,visitorckw@gmail.com,daniel@thingy.jp,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 v9] m68k, bpf: Add initial BPF JIT compiler support
Date: Sun, 11 Oct 2026 08:40:10 +0000 (UTC) [thread overview]
Message-ID: <e81d8aa1c5fef5135717607342f2564d58907fb0e8e7bd9c32eea76b2eb2b2d9@mail.kernel.org> (raw)
In-Reply-To: <20261011072930.3879724-1-visitorckw@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2225 bytes --]
> m68k, bpf: Add initial BPF JIT compiler support
TL;DR: Nit only: in the m68k JIT's emit_math_call(), the BPF_CLASS checks on
the signed div/mod selection look redundant given is_64, and could be folded
into the switch cases. Not a bug.
> diff --git a/arch/m68k/net/bpf_jit_comp.c b/arch/m68k/net/bpf_jit_comp.c
> new file mode 100644
> index 000000000000..e585cbcd7564
> --- /dev/null
> +++ b/arch/m68k/net/bpf_jit_comp.c
[ ... ]
> +static void emit_math_call(const struct bpf_insn *insn, struct jit_ctx *ctx, bool is_64)
> +{
[ ... ]
> + if (is_64) {
> + switch (op) {
> + case BPF_MUL:
> + func = (void *)jit_mul64;
> + break;
> + case BPF_DIV:
> + func = (void *)jit_div64;
> + break;
> + case BPF_MOD:
> + func = (void *)jit_mod64;
> + break;
> + }
> + if (BPF_CLASS(insn->code) == BPF_ALU64 && op == BPF_DIV && insn->off == 1)
> + func = (void *)jit_sdiv64;
> + if (BPF_CLASS(insn->code) == BPF_ALU64 && op == BPF_MOD && insn->off == 1)
> + func = (void *)jit_smod64;
> + } else {
> + switch (op) {
> + case BPF_MUL:
> + func = (void *)jit_mul32;
> + break;
> + case BPF_DIV:
> + func = (void *)jit_div32;
> + break;
> + case BPF_MOD:
> + func = (void *)jit_mod32;
> + break;
> + }
> + if (BPF_CLASS(insn->code) == BPF_ALU && op == BPF_DIV && insn->off == 1)
> + func = (void *)jit_sdiv32;
> + if (BPF_CLASS(insn->code) == BPF_ALU && op == BPF_MOD && insn->off == 1)
> + func = (void *)jit_smod32;
> + }
This isn't a bug, but since is_64 already encodes the instruction class, are
the BPF_CLASS(insn->code) == BPF_ALU64 and BPF_CLASS(insn->code) == BPF_ALU
tests in these four conditions always true?
Could the signed/unsigned choice be made inside the BPF_DIV and BPF_MOD cases
of the switch instead, for example:
case BPF_DIV:
func = insn->off ? (void *)jit_sdiv64 : (void *)jit_div64;
break;
That would drop the redundant class checks and the second assignment that
overrides the one made in the switch.
[ ... ]
---
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/38122863281
prev parent reply other threads:[~2026-10-11 8:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 7:29 Kuan-Wei Chiu
2026-10-11 8:40 ` bot+bpf-ci [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=e81d8aa1c5fef5135717607342f2564d58907fb0e8e7bd9c32eea76b2eb2b2d9@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=daniel@thingy.jp \
--cc=eddyz87@gmail.com \
--cc=eleanor15x@gmail.com \
--cc=emil@etsalapatis.com \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=marscheng@google.com \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mason@kernel.org \
--cc=memxor@gmail.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=song@kernel.org \
--cc=visitorckw@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
all inboxes | Powered by JetHome®