]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpftool: Probe for ISA v4 instruction set extension
authorSimone Magnani <simone.magnani@isovalent.com>
Mon, 9 Dec 2024 14:54:39 +0000 (15:54 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 12 Dec 2024 16:25:17 +0000 (17:25 +0100)
commitb9fee10a52c0999f6f1c7e1c0ea83869f3cd10ae
treeb75197253016db8e3de613a164c0e0185cbb91e1
parent6e8ba494d87d05cba49224d2068dd313190adbd0
bpftool: Probe for ISA v4 instruction set extension

This patch introduces a new probe to check whether the kernel supports
instruction set extensions v4. The v4 extension comprises several new
instructions: BPF_{SDIV,SMOD} (signed div and mod), BPF_{LD,LDX,ST,STX,MOV}
(sign-extended load/store/move), 32-bit BPF_JA (unconditional jump),
target-independent BPF_ALU64 BSWAP (byte-swapping 16/32/64).

These have been introduced in the following commits respectively:

ec0e2da95f72 ("bpf: Support new signed div/mod instructions.")
1f9a1ea821ff ("bpf: Support new sign-extension load insns")
8100928c8814 ("bpf: Support new sign-extension mov insns")
4cd58e9af8b9 ("bpf: Support new 32bit offset jmp instruction")
0845c3db7bf5 ("bpf: Support new unconditional bswap instruction")

Support in bpftool for previous ISA extensions was added in commit
0fd800b2456c ("bpftool: Probe for instruction set extensions"). These
probes are useful for userspace BPF projects that want to use newer
instruction set extensions on newer kernels, to reduce the programs'
sizes or their complexity.

LLVM provides the mcpu=v4 option since LLVM commit 8f28e8069c4b ("[BPF]
support for BPF_ST instruction in codegen") [0].

Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://github.com/llvm/llvm-project/commit/8f28e8069c4ba1110daee8bddc4d5049b6d4646e
Link: https://lore.kernel.org/bpf/20241209145439.336362-1-simone.magnani@isovalent.com
tools/bpf/bpftool/feature.c
tools/include/linux/filter.h