mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: main.kalliope@gmail.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com,tsbogend@alpha.franken.de,johan.almbladh@anyfinetworks.com,paulburton@kernel.org
Cc: martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,philmd@oss.qualcomm.com,visitorckw@gmail.com,bpf@vger.kernel.org,linux-mips@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 1/2] bpf, mips: Factor out div/mod emission helpers
Date: Wed, 29 Jul 2026 17:10:20 +0000 (UTC)	[thread overview]
Message-ID: <c517c61555d5ac0e7dda77c6f9a4e3624ef8ed742d6372ab3d5af4879291ec4f@mail.kernel.org> (raw)
In-Reply-To: <20260729162931.2369353-2-main.kalliope@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2077 bytes --]

> diff --git a/arch/mips/net/bpf_jit_comp.c b/arch/mips/net/bpf_jit_comp.c
> index 6ee4abe6a1f7..f99bb5705d00 100644
> --- a/arch/mips/net/bpf_jit_comp.c
> +++ b/arch/mips/net/bpf_jit_comp.c
> @@ -338,6 +338,26 @@ void emit_alu_i(struct jit_context *ctx, u8 dst, s32 imm, u8 op)
>  	clobber_reg(ctx, dst);
>  }
>
> +static void emit_div(struct jit_context *ctx, u8 dst, u8 src)
> +{
> +	if (cpu_has_mips32r6) {
> +		emit(ctx, divu_r6, dst, dst, src);
> +	} else {
> +		emit(ctx, divu, dst, src);
> +		emit(ctx, mflo, dst);
> +	}
> +}
> +
> +static void emit_mod(struct jit_context *ctx, u8 dst, u8 src)
> +{
> +	if (cpu_has_mips32r6) {
> +		emit(ctx, modu, dst, dst, src);
> +	} else {
> +		emit(ctx, divu, dst, src);
> +		emit(ctx, mfhi, dst);
> +	}
> +}

This isn't a bug, but would a short header comment on emit_div() and
emit_mod(), in the style of the neighbouring '/* ALU register operation
(32-bit) */', keep these consistent with the rest of the file? Every
other emitter here carries one.

[ ... ]

> diff --git a/arch/mips/net/bpf_jit_comp64.c b/arch/mips/net/bpf_jit_comp64.c
> index fa7e9aa37f49..befeb63ae447 100644
> --- a/arch/mips/net/bpf_jit_comp64.c
> +++ b/arch/mips/net/bpf_jit_comp64.c
> @@ -197,6 +197,26 @@ static void emit_alu_i64(struct jit_context *ctx, u8 dst, s32 imm, u8 op)
>  	clobber_reg(ctx, dst);
>  }
>
> +static void emit_div64(struct jit_context *ctx, u8 dst, u8 src)
> +{
> +	if (cpu_has_mips64r6) {
> +		emit(ctx, ddivu_r6, dst, dst, src);
> +	} else {
> +		emit(ctx, ddivu, dst, src);
> +		emit(ctx, mflo, dst);
> +	}
> +}
> +
> +static void emit_mod64(struct jit_context *ctx, u8 dst, u8 src)
> +{
> +	if (cpu_has_mips64r6) {
> +		emit(ctx, dmodu, dst, dst, src);
> +	} else {
> +		emit(ctx, ddivu, dst, src);
> +		emit(ctx, mfhi, dst);
> +	}
> +}

Same for emit_div64() and emit_mod64() here.


---
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/30472129214

  reply	other threads:[~2026-07-29 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 16:29 [PATCH bpf-next v2 0/2] bpf, mips: Add signed div/mod support Nicholas Dudar
2026-07-29 16:29 ` [PATCH bpf-next v2 1/2] bpf, mips: Factor out div/mod emission helpers Nicholas Dudar
2026-07-29 17:10   ` bot+bpf-ci [this message]
2026-07-29 18:54     ` Nicholas Dudar
2026-07-30  8:11       ` Philippe Mathieu-Daudé
2026-07-29 16:29 ` [PATCH bpf-next v2 2/2] bpf, mips: Add support for BPF_SDIV and BPF_SMOD Nicholas Dudar
2026-07-31 11:11   ` Johan Almbladh
2026-07-31 15:53     ` Nicholas Dudar
2026-08-01  9:44       ` Johan Almbladh

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=c517c61555d5ac0e7dda77c6f9a4e3624ef8ed742d6372ab3d5af4879291ec4f@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=johan.almbladh@anyfinetworks.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=main.kalliope@gmail.com \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=paulburton@kernel.org \
    --cc=philmd@oss.qualcomm.com \
    --cc=song@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --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®