public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: shenghao yuan <shenghaoyuan0928@163.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Yazhou Tang <tangyazhou@zju.edu.cn>
Cc: Eduard Zingerman <eddyz87@gmail.com>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Kernel Team <kernel-team@fb.com>,
	Yonghong Song <yonghong.song@linux.dev>,
	Shung-Hsi Yu <shung-hsi.yu@suse.com>,
	Paul Chaignon <paul.chaignon@gmail.com>,
	Harishankar Vishwanathan <harishankar.vishwanathan@gmail.com>,
	Tianci Cao <ziye@zju.edu.cn>
Subject: Re: [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64}
Date: Thu, 23 Apr 2026 19:23:56 +0800	[thread overview]
Message-ID: <b67c42e6-27d4-455b-9db6-7eed719e007c@163.com> (raw)
In-Reply-To: <CAADnVQ+2O2zgdy11+vxE6dOp+3Br4zZBysHF-Hne7cP+eeucnQ@mail.gmail.com>

Hi Alexei,

On 2026/4/23 0:13, Alexei Starovoitov wrote:
> On Wed, Apr 22, 2026 at 8:32 AM Yazhou Tang <tangyazhou@zju.edu.cn> wrote:
>>
>> Hi Alexei,
>>
>> Thanks for the quick response!
>>
>> On 4/22/26 11:03 PM, Alexei Starovoitov wrote:
>>> On Wed Apr 22, 2026 at 7:50 AM PDT, Yazhou Tang wrote:
>>>> This was built for potential integration into Solana BPF and is
>>>
>>> we were thinking about adding these insns as well
>>>
>>> uhmul64_imm   dst = ((u128)dst * (u128)imm)>>64       0x77    BPF_PQR BPF_UHMUL | BPF_K       v2
>>> uhmul64_reg   dst = ((u128)dst * (u128)src)>>64       0x7f    BPF_PQR BPF_UHMUL | BPF_X       v2
>>> shmul64_imm   dst = ((i128)dst * (i128)imm)>>64       0x87    BPF_PQR BPF_SHMUL | BPF_K       v2
>>> shmul64_reg   dst = ((i128)dst * (i128)src)>>64       0x8f    BPF_PQR BPF_SHMUL | BPF_X       v2
>>>
>>> if you have kernel patches for that please share.
>>
>> We haven't implemented the interpreter and JIT backends for these
>> new uhmul64 and shmul64 instructions yet. However, we are actually
>> very familiar with these specific high-half multiplication
>> instructions, as they are already implemented in Solana BPF
>> (which we work closely with).
>>
>> We would absolutely love to take this on for the Linux kernel.
>> We can prepare the implementation across several RFC patchsets,
>> which will include:
>>
>> 1. Verifier: The value analysis for these new uhmul/shmul instructions
>>      using tnum and the upcoming cnum, backed by our formal proofs.
>> 2. Interpreter: The core implementation in kernel/bpf/core.c for
>>      these 4 instructions.
>> 3. JIT support starting with x86_64 (and subsequently arm64, etc.).
>>
>> (Note: We assume the LLVM frontend/backend support for emitting
>> these instructions might be handled separately, but we are happy
>> to provide the kernel-side implementation first).
>>
>> For the initial RFC, we plan to focus on the first two parts
>> (the Interpreter and Verifier semantics) to establish the groundwork.
> 
> We need to see end-to-end first. Which means LLVM + x86 JIT.
> You can skip the interpreter completely.
> The verifier needs to check safety of the operations,
> but updates to cnum/tnum should be conservative. Just mark as unbounded.
> No need for formal proofs or cnum work.

Regarding new eBPF insns topic, we will give an end-to-end solution in the
next RFC proposal once a prototype is ready. Please let me know if there
are any additional points you would like to highlight, discuss, or share.

Alternatively, we can have a deeper discussion when the prototype is ready.

Best wishes,
Shenghao and Yazhou


  reply	other threads:[~2026-04-23 11:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 10:28 [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 1/4] bpf: representation and basic operations on circular numbers Eduard Zingerman
2026-04-21 11:16   ` bot+bpf-ci
2026-04-21 17:18   ` sashiko-bot
2026-04-21 17:45     ` Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 2/4] bpf: use accessor functions for bpf_reg_state min/max fields Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 3/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-21 11:16   ` bot+bpf-ci
2026-04-21 16:23   ` Alexei Starovoitov
2026-04-21 16:48     ` Eduard Zingerman
2026-04-21 17:16       ` Alexei Starovoitov
2026-04-21 17:20         ` Eduard Zingerman
2026-04-21 18:06   ` sashiko-bot
2026-04-21 18:31     ` Eduard Zingerman
2026-04-21 10:28 ` [PATCH RFC bpf-next 4/4] selftests/bpf: new cases handled by 32->64 range refinements Eduard Zingerman
2026-04-21 16:10 ` [PATCH RFC bpf-next 0/4] bpf: replace min/max fields with struct cnum{32,64} Alexei Starovoitov
2026-04-21 16:33   ` Eduard Zingerman
2026-04-21 17:14     ` Alexei Starovoitov
2026-04-21 23:45 ` Eduard Zingerman
2026-04-22 14:50 ` Yazhou Tang
2026-04-22 15:03   ` Alexei Starovoitov
2026-04-22 15:32     ` Yazhou Tang
2026-04-22 16:13       ` Alexei Starovoitov
2026-04-23 11:23         ` shenghao yuan [this message]
2026-04-22 19:05   ` Eduard Zingerman
2026-04-23 11:45     ` shenghao yuan
2026-04-23 14:18       ` Yazhou Tang

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=b67c42e6-27d4-455b-9db6-7eed719e007c@163.com \
    --to=shenghaoyuan0928@163.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=harishankar.vishwanathan@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=paul.chaignon@gmail.com \
    --cc=shung-hsi.yu@suse.com \
    --cc=tangyazhou@zju.edu.cn \
    --cc=yonghong.song@linux.dev \
    --cc=ziye@zju.edu.cn \
    /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