Skip to content

sync: rvck #128: Backport subject : "bpf JIT optimization based on Zba and Zbb extension"#170

Merged
xmzzz merged 8 commits into
OLK-6.6from
sync/rvck-pr-128
Apr 8, 2026
Merged

sync: rvck #128: Backport subject : "bpf JIT optimization based on Zba and Zbb extension"#170
xmzzz merged 8 commits into
OLK-6.6from
sync/rvck-pr-128

Conversation

@xmzzz
Copy link
Copy Markdown
Contributor

@xmzzz xmzzz commented Apr 8, 2026

Sync commits from rvck PR #128.

Source PR: RVCK-Project/rvck#128

Commits

  • 6f06ac458f15 riscv, bpf: Unify 32-bit sign-extension to emit_sextw
  • a0c7a3d81c80 riscv, bpf: Unify 32-bit zero-extension to emit_zextw
  • 19681f23b61f riscv, bpf: Simplify sext and zext logics in branch instructions
  • 2c5303baa8e9 riscv, bpf: Add necessary Zbb instructions
  • 558c01d48968 riscv, bpf: Optimize sign-extention mov insns with Zbb support
  • 6c2e5203aa64 riscv, bpf: Optimize bswap insns with Zbb support
  • c6071e5b639f riscv, bpf: Optimize zextw insn with Zba extension
  • f8d2f35f1043 riscv, bpf: Introduce shift add helper with Zba optimization

Pu Lehui and others added 8 commits April 8, 2026 15:03
mainline inclusion
from mainline-v6.8-rc3
commit e33758f7493c9ad8cf6960bcf7c70f5761f3acfb
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

For code unification, add emit_sextw wrapper to unify all the 32-bit
sign-extension operations.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 6f06ac4)
mainline inclusion
from mainline-v6.8-rc3
commit 914c7a5ff18a225f7df254ae3433574f3d47b711
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

For code unification, add emit_zextw wrapper to unify all the 32-bit
zero-extension operations.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit a0c7a3d)
mainline inclusion
from mainline-v6.8-rc3
commit 361db44c3c59cde05e9926647f16255e274a37f4
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

There are many extension helpers in the current branch instructions, and
the implementation is a bit complicated. We simplify this logic through
two simple extension helpers with alternate register.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 19681f2)
mainline inclusion
from mainline-v6.8-rc3
commit 647b93f65daa128d9a0e4aac744a5fcf5f58b2d2
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

Add necessary Zbb instructions introduced by [0] to reduce code size and
improve performance of RV64 JIT. Meanwhile, a runtime deteted helper is
added to check whether the CPU supports Zbb instructions.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 2c5303b)
mainline inclusion
from mainline-v6.8-rc3
commit 519fb722bea09ae2664ad21f8ef4360fb799eb2f
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

Add 8-bit and 16-bit sign-extention wraper with Zbb support to optimize
sign-extension mov instructions.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 558c01d)
mainline inclusion
from mainline-v6.8-rc3
commit 06a33d024838414432b6c0f51f994e7f1695b74f
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

Optimize bswap instructions by rev8 Zbb instruction conbined with srli
instruction. And Optimize 16-bit zero-extension with Zbb support.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 6c2e520)
mainline inclusion
from mainline-v6.10-rc1
commit c12603e76ef666ce5c51a9d6faf155c9e3de7601
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

The Zba extension provides add.uw insn which can be used to implement
zext.w with rs2 set as ZERO.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit c6071e5)
mainline inclusion
from mainline-v6.10-rc2
commit 96a27ee76f0e95b56f94b6902da7a5ebef372612
category: feature
bugzilla: RVCK-Project/rvck#127

--------------------------------

Zba extension is very useful for generating addresses that index into array
of basic data types. This patch introduces sh2add and sh3add helpers for
RV32 and RV64 respectively, to accelerate addressing for array of unsigned
long data.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: gaorui <gao.rui@zte.com.cn>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit f8d2f35)
@xmzzz xmzzz merged commit 6e4f16c into OLK-6.6 Apr 8, 2026
1 check passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026


开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/24122513430

参数解析结果
args value
repository RVCK-Project/rvck-olk
head ref pull/170/head
base ref OLK-6.6
LAVA repo RVCK-Project/lavaci
LAVA Template lava-job-template/qemu/qemu-ltp.yaml
Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:

RVCK result

check result
kunit-test success
kernel-build success
lava-trigger success
check-patch success

Kunit Test Result

[07:08:47] Testing complete. Ran 454 tests: passed: 442, skipped: 12

Kernel Build Result

Kernel build succeeded: RVCK-Project/rvck-olk/170__1/

cef16ca11321b80511f5af50abc6c38c /srv/guix_result/533dd66fa4c604519fc3fc338b03e6e753d3291c/Image
27ca1dec091b456ef9fde463e0d18695 /root/initramfs.img

LAVA Check

args:

result:

Lava check done! lava log: https://lava.oerv.ac.cn/scheduler/job/1762

lava result count: [fail]: 18, [pass]: 1588, [skip]: 293

Check Patch Result

Total Errors 0
Total Warnings 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants