Re: [PATCH bpf-next v2 2/2] bpf, mips: Add support for BPF_SDIV and BPF_SMOD

Nicholas Dudar <[email protected]>
Newsgroups org.kernel.vger.bpf,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips
Message-ID <CAJZwKkgXoHhaej_hkBfytY_6N0PdpwfGMt+GUcHJGyaH0+e7RA@mail.gmail.com>
Hi Johan,

Thanks for having a look.

> Let me know if you are already working on the remaining v4 support,
> otherwise I could look into it.

I'm working on separate MOVSX and MEMSX patches. Would you be willing to
take BSWAP and JMP32_JA? If you've already started with a different split,
let me know.

> Consider making the uasm additions a separate patch.

Agreed. I plan to structure v3 as:
  1. Factor the existing DIV/MOD emission into helpers.
  2. Add the signed DIV/MOD uasm emitters separately.
  3. Add SDIV/SMOD support in the MIPS BPF JITs.

> Should not "quot" be s64?

Yes. I will make quot s64 so the remainder calculation stays in signed
arithmetic.

> Please propagate the raw offset value and do the interpretation in the
> div/mod helpers instead.

I'll pass the raw s16 off value through immediate validation and
register emission, and interpret off == 1 only in DIV/MOD-specific paths.
That leaves MOVSX free to interpret off as its source width.

I will validate each series boundary on MIPS32r2, MIPS64r2, MIPS32r6, and
MIPS64r6, and build the complete v3 together with the MOVSX and MEMSX
candidates before posting it.

Does that sound ok?

Thanks,
Nicholas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.