mbox series

[RESEND,bpf-next,v3,0/6] Zbb support and code simplification for RV64 JIT

Message ID 20240115131235.2914289-1-pulehui@huaweicloud.com (mailing list archive)
Headers show
Series Zbb support and code simplification for RV64 JIT | expand

Message

Pu Lehui Jan. 15, 2024, 1:12 p.m. UTC
Add Zbb support [0] to optimize code size and performance of RV64 JIT.
Meanwhile, adjust the code for unification and simplification. Tests
test_bpf.ko and test_verifier have passed, as well as the relative
testcases of test_progs*.

Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]

v3 resend:
- resend for mail be treated as spam.

v3:
- Change to early-exit code style and make code more explicit.

v2: https://lore.kernel.org/bpf/20230919035839.3297328-1-pulehui@huaweicloud.com
- Add runtime detection for Zbb instructions.
- Correct formatting issues detected by checkpatch.

v1: https://lore.kernel.org/bpf/20230913153413.1446068-1-pulehui@huaweicloud.com

Pu Lehui (6):
  riscv, bpf: Unify 32-bit sign-extension to emit_sextw
  riscv, bpf: Unify 32-bit zero-extension to emit_zextw
  riscv, bpf: Simplify sext and zext logics in branch instructions
  riscv, bpf: Add necessary Zbb instructions
  riscv, bpf: Optimize sign-extention mov insns with Zbb support
  riscv, bpf: Optimize bswap insns with Zbb support

 arch/riscv/net/bpf_jit.h        | 134 ++++++++++++++++++++
 arch/riscv/net/bpf_jit_comp64.c | 210 +++++++++++---------------------
 2 files changed, 205 insertions(+), 139 deletions(-)

Comments

Björn Töpel Jan. 22, 2024, 2:33 p.m. UTC | #1
Pu Lehui <pulehui@huaweicloud.com> writes:

> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
> Meanwhile, adjust the code for unification and simplification. Tests
> test_bpf.ko and test_verifier have passed, as well as the relative
> testcases of test_progs*.
>
> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>
> v3 resend:
> - resend for mail be treated as spam.
>
> v3:
> - Change to early-exit code style and make code more explicit.

Lehui,

Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
6.8-rc1, I will need to wrap my head around that prior reviewing
properly.


Björn
Pu Lehui Jan. 22, 2024, 2:37 p.m. UTC | #2
On 2024/1/22 22:33, Björn Töpel wrote:
> Pu Lehui <pulehui@huaweicloud.com> writes:
> 
>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>> Meanwhile, adjust the code for unification and simplification. Tests
>> test_bpf.ko and test_verifier have passed, as well as the relative
>> testcases of test_progs*.
>>
>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>
>> v3 resend:
>> - resend for mail be treated as spam.
>>
>> v3:
>> - Change to early-exit code style and make code more explicit.
> 
> Lehui,
> 
> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
> 6.8-rc1, I will need to wrap my head around that prior reviewing
> properly.
> 

Oh, I also found the problem with struct ops and fixed it

diff --git a/arch/riscv/net/bpf_jit_comp64.c 
b/arch/riscv/net/bpf_jit_comp64.c
index 42cfd1ed295e..5c4e0ac389d0 100644
--- a/arch/riscv/net/bpf_jit_comp64.c
+++ b/arch/riscv/net/bpf_jit_comp64.c
@@ -795,6 +795,7 @@ static int __arch_prepare_bpf_trampoline(struct 
bpf_tramp_image *im,
         struct bpf_tramp_links *fentry = &tlinks[BPF_TRAMP_FENTRY];
         struct bpf_tramp_links *fexit = &tlinks[BPF_TRAMP_FEXIT];
         struct bpf_tramp_links *fmod_ret = 
&tlinks[BPF_TRAMP_MODIFY_RETURN];
+       bool is_struct_ops = flags & BPF_TRAMP_F_INDIRECT;
         void *orig_call = func_addr;
         bool save_ret;
         u32 insn;
@@ -878,7 +879,7 @@ static int __arch_prepare_bpf_trampoline(struct 
bpf_tramp_image *im,

         stack_size = round_up(stack_size, 16);

-       if (func_addr) {
+       if (!is_struct_ops) {
                 /* For the trampoline called from function entry,
                  * the frame of traced function and the frame of
                  * trampoline need to be considered.
@@ -998,7 +999,7 @@ static int __arch_prepare_bpf_trampoline(struct 
bpf_tramp_image *im,

         emit_ld(RV_REG_S1, -sreg_off, RV_REG_FP, ctx);

-       if (func_addr) {
+       if (!is_struct_ops) {
                 /* trampoline called from function entry */
                 emit_ld(RV_REG_T0, stack_size - 8, RV_REG_SP, ctx);
                 emit_ld(RV_REG_FP, stack_size - 16, RV_REG_SP, ctx);

> 
> Björn
Björn Töpel Jan. 22, 2024, 2:44 p.m. UTC | #3
Pu Lehui <pulehui@huaweicloud.com> writes:

> On 2024/1/22 22:33, Björn Töpel wrote:
>> Pu Lehui <pulehui@huaweicloud.com> writes:
>> 
>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>> Meanwhile, adjust the code for unification and simplification. Tests
>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>> testcases of test_progs*.
>>>
>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>
>>> v3 resend:
>>> - resend for mail be treated as spam.
>>>
>>> v3:
>>> - Change to early-exit code style and make code more explicit.
>> 
>> Lehui,
>> 
>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>> properly.
>> 
>
> Oh, I also found the problem with struct ops and fixed it

Awesome, I just started bisecting the following test_progs sub-test
fails on 6.8-rc1:

bpf_iter_setsockopt:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Oops [#1]
Modules linked in: bpf_testmod(OE) drm fuse i2c_core dm_mod drm_panel_orientation_quirks backlight configfs ip_tables x_tables
CPU: 1 PID: 458 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
Hardware name: riscv-virtio,qemu (DT)
epc : 0x0
 ra : tcp_set_ca_state+0x2c/0x9a
epc : 0000000000000000 ra : ffffffff80cdc6b2 sp : ff2000000000b910
 gp : ffffffff82587b60 tp : ff60000087ea8040 t0 : 0000000000000000
 t1 : ffffffff801ed15e t2 : 0000000000000000 s0 : ff2000000000b930
 s1 : ff600000879296c0 a0 : ff20000000497000 a1 : 0000000000000008
 a2 : 0000000000000001 a3 : ff60000087ea83a0 a4 : 0000000000000000
 a5 : 0000000000000106 a6 : 0000000000000021 a7 : 0000000000000000
 s2 : 0000000000000000 s3 : ff60000086878008 s4 : ff60000082ce2f40
 s5 : ff60000084f56040 s6 : ff60000087929040 s7 : ff60000086878008
 s8 : ff2000000000ba5f s9 : ff60000087928a00 s10: 0000000000000002
 s11: ff60000087928040 t3 : 000000000001ffff t4 : 0100000000000000
 t5 : 0000000000000000 t6 : ff6000008792a118
status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000c
Code: Unable to access instruction at 0xffffffffffffffec.
---[ end trace 0000000000000000 ]---

bpf_tcp_ca:
Unable to handle kernel paging request at virtual address ff60000088554500
Oops [#1]
Modules linked in: iptable_raw xt_connmark bpf_testmod(OE) drm fuse i2c_core drm_panel_orientation_quirks backlight dm_mod configfs ip_tables x_tables [last unloaded: bpf_testmod(OE)]
CPU: 3 PID: 458 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
Hardware name: riscv-virtio,qemu (DT)
epc : 0xff60000088554500
 ra : tcp_ack+0x288/0x1232
epc : ff60000088554500 ra : ffffffff80cc7166 sp : ff2000000117ba50
 gp : ffffffff82587b60 tp : ff60000087be0040 t0 : ff60000088554500
 t1 : ffffffff801ed24e t2 : 0000000000000000 s0 : ff2000000117bbc0
 s1 : 0000000000000500 a0 : ff20000000691000 a1 : 0000000000000018
 a2 : 0000000000000001 a3 : ff60000087be03a0 a4 : 0000000000000000
 a5 : 0000000000000000 a6 : 0000000000000021 a7 : ffffffff8263f880
 s2 : 000000004ac3c13b s3 : 000000004ac3c13a s4 : 0000000000008200
 s5 : 0000000000000001 s6 : 0000000000000104 s7 : ff2000000117bb00
 s8 : ff600000885544c0 s9 : 0000000000000000 s10: ff60000086ff0b80
 s11: 000055557983a9c0 t3 : 0000000000000000 t4 : 000000000000ffc4
 t5 : ffffffff8154f170 t6 : 0000000000000030
status: 0000000200000120 badaddr: ff60000088554500 cause: 000000000000000c
Code: c796 67d7 0000 0000 0052 0002 c13b 4ac3 0000 0000 (0001) 0000 
---[ end trace 0000000000000000 ]---

dummy_st_ops:
Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000043022
Oops [#1]
Modules linked in: iptable_raw xt_connmark bpf_testmod(OE) drm fuse i2c_core drm_panel_orientation_quirks backlight dm_mod configfs ip_tables x_tables [last unloaded: bpf_testmod(OE)]
CPU: 1 PID: 452 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
Hardware name: riscv-virtio,qemu (DT)
epc : 0x43022
 ra : bpf_struct_ops_test_run+0x188/0x37a
epc : 0000000000043022 ra : ffffffff80c75d1a sp : ff200000002a3ce0
 gp : ffffffff82587b60 tp : ff6000008356b840 t0 : 0000000000043023
 t1 : ffffffff801ed062 t2 : 000000000000ff00 s0 : ff200000002a3d40
 s1 : ffffffff78207000 a0 : fffffffff2f3f4f5 a1 : 0000000000000008
 a2 : 0000000000000001 a3 : ff6000008356bba0 a4 : 0000000000000000
 a5 : fffffffff2f3f4f5 a6 : 0000000000000021 a7 : 0000000052464e43
 s2 : 0000000000000000 s3 : ff60000080b33b80 s4 : 0000000000000084
 s5 : ff60000083334c00 s6 : ff60000084861580 s7 : 00007ffff0887668
 s8 : 00007fffaa859030 s9 : 0000000000000000 s10: 000055556631ca4c
 s11: 000055556631c9c0 t3 : 000000000000000f t4 : 0000000000000800
 t5 : 0001000000000000 t6 : ff6000008adb9bf8
status: 0000000200000120 badaddr: 0000000000043022 cause: 000000000000000c
Code: Unable to access instruction at 0x000000000004300e.
---[ end trace 0000000000000000 ]---

Environment: OpenSBI 1.4, Qemu 8.2.0, U-boot UEFI

Is that the same that you see?

I'll take your patch for a spin!


Björn
Björn Töpel Jan. 22, 2024, 3:07 p.m. UTC | #4
Björn Töpel <bjorn@kernel.org> writes:

> Pu Lehui <pulehui@huaweicloud.com> writes:
>
>> On 2024/1/22 22:33, Björn Töpel wrote:
>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>> 
>>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>>> Meanwhile, adjust the code for unification and simplification. Tests
>>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>>> testcases of test_progs*.
>>>>
>>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>>
>>>> v3 resend:
>>>> - resend for mail be treated as spam.
>>>>
>>>> v3:
>>>> - Change to early-exit code style and make code more explicit.
>>> 
>>> Lehui,
>>> 
>>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>>> properly.
>>> 
>>
>> Oh, I also found the problem with struct ops and fixed it

Pu, with your patch bpf_iter_setsockopt, bpf_tcp_ca, and dummy_st_ops
passes!

Please spin a proper fixes patch, and feel free to add:

Tested-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Björn Töpel <bjorn@kernel.org>


Björn
Pu Lehui Jan. 22, 2024, 3:15 p.m. UTC | #5
On 2024/1/22 22:44, Björn Töpel wrote:
> Pu Lehui <pulehui@huaweicloud.com> writes:
> 
>> On 2024/1/22 22:33, Björn Töpel wrote:
>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>
>>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>>> Meanwhile, adjust the code for unification and simplification. Tests
>>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>>> testcases of test_progs*.
>>>>
>>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>>
>>>> v3 resend:
>>>> - resend for mail be treated as spam.
>>>>
>>>> v3:
>>>> - Change to early-exit code style and make code more explicit.
>>>
>>> Lehui,
>>>
>>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>>> properly.
>>>
>>
>> Oh, I also found the problem with struct ops and fixed it
> 
> Awesome, I just started bisecting the following test_progs sub-test
> fails on 6.8-rc1:
> 
> bpf_iter_setsockopt:
> Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
> Oops [#1]
> Modules linked in: bpf_testmod(OE) drm fuse i2c_core dm_mod drm_panel_orientation_quirks backlight configfs ip_tables x_tables
> CPU: 1 PID: 458 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
> Hardware name: riscv-virtio,qemu (DT)
> epc : 0x0
>   ra : tcp_set_ca_state+0x2c/0x9a
> epc : 0000000000000000 ra : ffffffff80cdc6b2 sp : ff2000000000b910
>   gp : ffffffff82587b60 tp : ff60000087ea8040 t0 : 0000000000000000
>   t1 : ffffffff801ed15e t2 : 0000000000000000 s0 : ff2000000000b930
>   s1 : ff600000879296c0 a0 : ff20000000497000 a1 : 0000000000000008
>   a2 : 0000000000000001 a3 : ff60000087ea83a0 a4 : 0000000000000000
>   a5 : 0000000000000106 a6 : 0000000000000021 a7 : 0000000000000000
>   s2 : 0000000000000000 s3 : ff60000086878008 s4 : ff60000082ce2f40
>   s5 : ff60000084f56040 s6 : ff60000087929040 s7 : ff60000086878008
>   s8 : ff2000000000ba5f s9 : ff60000087928a00 s10: 0000000000000002
>   s11: ff60000087928040 t3 : 000000000001ffff t4 : 0100000000000000
>   t5 : 0000000000000000 t6 : ff6000008792a118
> status: 0000000200000120 badaddr: 0000000000000000 cause: 000000000000000c
> Code: Unable to access instruction at 0xffffffffffffffec.
> ---[ end trace 0000000000000000 ]---
> 
> bpf_tcp_ca:
> Unable to handle kernel paging request at virtual address ff60000088554500
> Oops [#1]
> Modules linked in: iptable_raw xt_connmark bpf_testmod(OE) drm fuse i2c_core drm_panel_orientation_quirks backlight dm_mod configfs ip_tables x_tables [last unloaded: bpf_testmod(OE)]
> CPU: 3 PID: 458 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
> Hardware name: riscv-virtio,qemu (DT)
> epc : 0xff60000088554500
>   ra : tcp_ack+0x288/0x1232
> epc : ff60000088554500 ra : ffffffff80cc7166 sp : ff2000000117ba50
>   gp : ffffffff82587b60 tp : ff60000087be0040 t0 : ff60000088554500
>   t1 : ffffffff801ed24e t2 : 0000000000000000 s0 : ff2000000117bbc0
>   s1 : 0000000000000500 a0 : ff20000000691000 a1 : 0000000000000018
>   a2 : 0000000000000001 a3 : ff60000087be03a0 a4 : 0000000000000000
>   a5 : 0000000000000000 a6 : 0000000000000021 a7 : ffffffff8263f880
>   s2 : 000000004ac3c13b s3 : 000000004ac3c13a s4 : 0000000000008200
>   s5 : 0000000000000001 s6 : 0000000000000104 s7 : ff2000000117bb00
>   s8 : ff600000885544c0 s9 : 0000000000000000 s10: ff60000086ff0b80
>   s11: 000055557983a9c0 t3 : 0000000000000000 t4 : 000000000000ffc4
>   t5 : ffffffff8154f170 t6 : 0000000000000030
> status: 0000000200000120 badaddr: ff60000088554500 cause: 000000000000000c
> Code: c796 67d7 0000 0000 0052 0002 c13b 4ac3 0000 0000 (0001) 0000
> ---[ end trace 0000000000000000 ]---
> 
> dummy_st_ops:
> Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000043022
> Oops [#1]
> Modules linked in: iptable_raw xt_connmark bpf_testmod(OE) drm fuse i2c_core drm_panel_orientation_quirks backlight dm_mod configfs ip_tables x_tables [last unloaded: bpf_testmod(OE)]
> CPU: 1 PID: 452 Comm: test_progs Tainted: G           OE      6.8.0-rc1-kselftest_plain #1
> Hardware name: riscv-virtio,qemu (DT)
> epc : 0x43022
>   ra : bpf_struct_ops_test_run+0x188/0x37a
> epc : 0000000000043022 ra : ffffffff80c75d1a sp : ff200000002a3ce0
>   gp : ffffffff82587b60 tp : ff6000008356b840 t0 : 0000000000043023
>   t1 : ffffffff801ed062 t2 : 000000000000ff00 s0 : ff200000002a3d40
>   s1 : ffffffff78207000 a0 : fffffffff2f3f4f5 a1 : 0000000000000008
>   a2 : 0000000000000001 a3 : ff6000008356bba0 a4 : 0000000000000000
>   a5 : fffffffff2f3f4f5 a6 : 0000000000000021 a7 : 0000000052464e43
>   s2 : 0000000000000000 s3 : ff60000080b33b80 s4 : 0000000000000084
>   s5 : ff60000083334c00 s6 : ff60000084861580 s7 : 00007ffff0887668
>   s8 : 00007fffaa859030 s9 : 0000000000000000 s10: 000055556631ca4c
>   s11: 000055556631c9c0 t3 : 000000000000000f t4 : 0000000000000800
>   t5 : 0001000000000000 t6 : ff6000008adb9bf8
> status: 0000000200000120 badaddr: 0000000000043022 cause: 000000000000000c
> Code: Unable to access instruction at 0x000000000004300e.
> ---[ end trace 0000000000000000 ]---
> 
> Environment: OpenSBI 1.4, Qemu 8.2.0, U-boot UEFI
> 
> Is that the same that you se >

Yes, is the same issue. The question is that the commit 2cd3e3772e41 
("x86/cfi,bpf: Fix bpf_struct_ops CFI") change func_addr of 
arch_prepare_bpf_trampoline from NULL to not NULL, while we use 
func_addr to distinguish struct_ops and regular trampoline. After commit 
2cd3e3772e41, we can use BPF_TRAMP_F_INDIRECT to distinguish them as it 
always be set in struct_ops.

> I'll take your patch for a spin!
> 
> 
> Björn
Pu Lehui Jan. 22, 2024, 3:17 p.m. UTC | #6
On 2024/1/22 23:07, Björn Töpel wrote:
> Björn Töpel <bjorn@kernel.org> writes:
> 
>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>
>>> On 2024/1/22 22:33, Björn Töpel wrote:
>>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>>
>>>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>>>> Meanwhile, adjust the code for unification and simplification. Tests
>>>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>>>> testcases of test_progs*.
>>>>>
>>>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>>>
>>>>> v3 resend:
>>>>> - resend for mail be treated as spam.
>>>>>
>>>>> v3:
>>>>> - Change to early-exit code style and make code more explicit.
>>>>
>>>> Lehui,
>>>>
>>>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>>>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>>>> properly.
>>>>
>>>
>>> Oh, I also found the problem with struct ops and fixed it
> 
> Pu, with your patch bpf_iter_setsockopt, bpf_tcp_ca, and dummy_st_ops
> passes!
> 
> Please spin a proper fixes patch, and feel free to add:
> 
> Tested-by: Björn Töpel <bjorn@rivosinc.com>
> Acked-by: Björn Töpel <bjorn@kernel.org>
> 

Is that in a hurry? If not, I would like to send it with the upcoming 
patchset.

> 
> Björn
Björn Töpel Jan. 22, 2024, 4:30 p.m. UTC | #7
Pu Lehui <pulehui@huaweicloud.com> writes:

> On 2024/1/22 23:07, Björn Töpel wrote:
>> Björn Töpel <bjorn@kernel.org> writes:
>> 
>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>
>>>> On 2024/1/22 22:33, Björn Töpel wrote:
>>>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>>>
>>>>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>>>>> Meanwhile, adjust the code for unification and simplification. Tests
>>>>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>>>>> testcases of test_progs*.
>>>>>>
>>>>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>>>>
>>>>>> v3 resend:
>>>>>> - resend for mail be treated as spam.
>>>>>>
>>>>>> v3:
>>>>>> - Change to early-exit code style and make code more explicit.
>>>>>
>>>>> Lehui,
>>>>>
>>>>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>>>>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>>>>> properly.
>>>>>
>>>>
>>>> Oh, I also found the problem with struct ops and fixed it
>> 
>> Pu, with your patch bpf_iter_setsockopt, bpf_tcp_ca, and dummy_st_ops
>> passes!
>> 
>> Please spin a proper fixes patch, and feel free to add:
>> 
>> Tested-by: Björn Töpel <bjorn@rivosinc.com>
>> Acked-by: Björn Töpel <bjorn@kernel.org>
>> 
>
> Is that in a hurry? If not, I would like to send it with the upcoming 
> patchset.

This is a separate fix, right? What patchset are you referring to where
the fix would be in?

As of now 6.8-rc1 is broken! It would be a great with a fix asap...


Cheers,
Björn
Pu Lehui Jan. 23, 2024, 1:57 a.m. UTC | #8
On 2024/1/23 0:30, Björn Töpel wrote:
> Pu Lehui <pulehui@huaweicloud.com> writes:
> 
>> On 2024/1/22 23:07, Björn Töpel wrote:
>>> Björn Töpel <bjorn@kernel.org> writes:
>>>
>>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>>
>>>>> On 2024/1/22 22:33, Björn Töpel wrote:
>>>>>> Pu Lehui <pulehui@huaweicloud.com> writes:
>>>>>>
>>>>>>> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
>>>>>>> Meanwhile, adjust the code for unification and simplification. Tests
>>>>>>> test_bpf.ko and test_verifier have passed, as well as the relative
>>>>>>> testcases of test_progs*.
>>>>>>>
>>>>>>> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
>>>>>>>
>>>>>>> v3 resend:
>>>>>>> - resend for mail be treated as spam.
>>>>>>>
>>>>>>> v3:
>>>>>>> - Change to early-exit code style and make code more explicit.
>>>>>>
>>>>>> Lehui,
>>>>>>
>>>>>> Sorry for the delay. I'm chasing a struct_ops RISC-V BPF regression in
>>>>>> 6.8-rc1, I will need to wrap my head around that prior reviewing
>>>>>> properly.
>>>>>>
>>>>>
>>>>> Oh, I also found the problem with struct ops and fixed it
>>>
>>> Pu, with your patch bpf_iter_setsockopt, bpf_tcp_ca, and dummy_st_ops
>>> passes!
>>>
>>> Please spin a proper fixes patch, and feel free to add:
>>>
>>> Tested-by: Björn Töpel <bjorn@rivosinc.com>
>>> Acked-by: Björn Töpel <bjorn@kernel.org>
>>>
>>
>> Is that in a hurry? If not, I would like to send it with the upcoming
>> patchset.
> 
> This is a separate fix, right? What patchset are you referring to where
> the fix would be in?
> 

Yes, you are right! I'll send a bug fix patch as soon as possible. 
Coming soon is the bpf_prog_pack for RV64 Trampoline, which currently 
does not seem to be related to the bugfix, will populate the commit 
message and send it later.
Björn Töpel Jan. 27, 2024, 5:12 p.m. UTC | #9
Pu Lehui <pulehui@huaweicloud.com> writes:

> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
> Meanwhile, adjust the code for unification and simplification. Tests
> test_bpf.ko and test_verifier have passed, as well as the relative
> testcases of test_progs*.

Lehui, apologies for the delay. Nice work! I have a minor comment in
patch 4, but not a blocker...

For the series,

Tested-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Björn Töpel <bjorn@kernel.org>
patchwork-bot+netdevbpf@kernel.org Jan. 29, 2024, 3:30 p.m. UTC | #10
Hello:

This series was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Mon, 15 Jan 2024 13:12:29 +0000 you wrote:
> Add Zbb support [0] to optimize code size and performance of RV64 JIT.
> Meanwhile, adjust the code for unification and simplification. Tests
> test_bpf.ko and test_verifier have passed, as well as the relative
> testcases of test_progs*.
> 
> Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0]
> 
> [...]

Here is the summary with links:
  - [RESEND,bpf-next,v3,1/6] riscv, bpf: Unify 32-bit sign-extension to emit_sextw
    https://git.kernel.org/bpf/bpf-next/c/e33758f7493c
  - [RESEND,bpf-next,v3,2/6] riscv, bpf: Unify 32-bit zero-extension to emit_zextw
    https://git.kernel.org/bpf/bpf-next/c/914c7a5ff18a
  - [RESEND,bpf-next,v3,3/6] riscv, bpf: Simplify sext and zext logics in branch instructions
    https://git.kernel.org/bpf/bpf-next/c/361db44c3c59
  - [RESEND,bpf-next,v3,4/6] riscv, bpf: Add necessary Zbb instructions
    https://git.kernel.org/bpf/bpf-next/c/647b93f65daa
  - [RESEND,bpf-next,v3,5/6] riscv, bpf: Optimize sign-extention mov insns with Zbb support
    https://git.kernel.org/bpf/bpf-next/c/519fb722bea0
  - [RESEND,bpf-next,v3,6/6] riscv, bpf: Optimize bswap insns with Zbb support
    https://git.kernel.org/bpf/bpf-next/c/06a33d024838

You are awesome, thank you!