From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Yazhou Tang" <tangyazhou@zju.edu.cn>, <bpf@vger.kernel.org>,
<eddyz87@gmail.com>
Cc: <daniel@iogearbox.net>, <john.fastabend@gmail.com>,
<andrii@kernel.org>, <martin.lau@linux.dev>, <song@kernel.org>,
<yonghong.song@linux.dev>, <kpsingh@kernel.org>,
<sdf@fomichev.me>, <haoluo@google.com>, <jolsa@kernel.org>,
<tangyazhou518@outlook.com>, <shenghaoyuan0928@163.com>,
<ziye@zju.edu.cn>
Subject: Re: [PATCH bpf-next 1/8] bpf: Add UHMUL and SHMUL instructions
Date: Thu, 17 Sep 2026 17:04:22 +0000 [thread overview]
Message-ID: <DLHR6BTEODXE.2J7T8ZSDTAVNF@gmail.com> (raw)
In-Reply-To: <20260917041712.1860722-2-tangyazhou@zju.edu.cn>
On Thu, Sep 17, 2026 at 12:17 PM Yazhou Tang <tangyazhou@zju.edu.cn> wrote:
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 732b35cc08d1..845eee536198 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -34,6 +34,16 @@
> #define BPF_FROM_LE BPF_TO_LE
> #define BPF_FROM_BE BPF_TO_BE
>
> +/*
> + * BPF_MUL variants selected by the off field.
> + * UHMUL and SHMUL are only valid for BPF_ALU64.
> + */
> +enum bpf_mul_variant {
> + BPF_MUL_VARIANT_LO = 0,
> + BPF_MUL_VARIANT_UHMUL = 1,
> + BPF_MUL_VARIANT_SHMUL = 2,
> +};
Slept on it and imo it's too verbose for uapi.
Maybe just BPF_UHMUL = 1, BPF_SHMUL = 2 ?
No need to name zero, sdiv doesn't.
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 4e208cc94752..4f746973481b 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
[...]
> + ALU_MUL_X:
> + if (OFF != BPF_MUL_VARIANT_LO)
> + goto default_label;
> + DST = (u32) DST * (u32)
SRC;
> + CONT;
The verifier already rejected these. Interpreter doesn't
need to re-validate.
pw-bot: cr
next prev parent reply other threads:[~2026-09-17 17:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 4:17 [PATCH bpf-next 0/8] bpf: Add UHMUL and SHMUL instructions Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 1/8] " Yazhou Tang
2026-09-17 5:22 ` bot+bpf-ci
2026-09-17 6:43 ` Yazhou Tang
2026-09-17 17:04 ` Alexei Starovoitov [this message]
2026-09-18 9:26 ` Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 2/8] bpf, x86: JIT UHMUL and SHMUL on x86-64 Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 3/8] bpf, arm64: JIT UHMUL and SHMUL Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 4/8] bpf, riscv: JIT UHMUL and SHMUL on RV64 Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 5/8] bpf: Reject UHMUL/SHMUL in unsupported backends Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 6/8] bpf: Refactor ALU instruction variant validation Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 7/8] bpf: Add verifier support for UHMUL and SHMUL Yazhou Tang
2026-09-17 4:17 ` [PATCH bpf-next 8/8] selftests/bpf: Add bytecode tests " Yazhou Tang
2026-09-17 18:00 ` [PATCH bpf-next 0/8] bpf: Add UHMUL and SHMUL instructions Alexei Starovoitov
2026-09-18 9:37 ` 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=DLHR6BTEODXE.2J7T8ZSDTAVNF@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=shenghaoyuan0928@163.com \
--cc=song@kernel.org \
--cc=tangyazhou518@outlook.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.