Skip to content

LoongArch: BPF: Optimize the calculation method of jmp_offset in the emit_bpf_tail_call function #9013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: LoongArch: BPF: Optimize the calculation method of jmp_offset in the emit_bpf_tail_call function
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: c5cebb2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 90b83ef
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 90b83ef
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bb1556e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bb1556e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: cd2e103
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: cd2e103
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a570f38
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 64a064c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e41079f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e41079f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 97ebac5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2bc0575
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 5fcf896
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2d72dd1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=966970
version: 1

…emit_bpf_tail_call function

For a ebpf subprog JIT,the last call bpf_int_jit_compile function will
directly enter the skip_init_ctx process. At this point, out_offset = -1,
the jmp_offset in emit_bpf_tail_call is calculated
by #define jmp_offset (out_offset - (cur_offset)) is a negative number,
which does not meet expectations.The final generated assembly as follow.

54:	bgeu        	$a2, $t1, -8	    # 0x0000004c
58:	addi.d      	$a6, $s5, -1
5c:	bltz        	$a6, -16	    # 0x0000004c
60:	alsl.d      	$t2, $a2, $a1, 0x3
64:	ld.d        	$t2, $t2, 264
68:	beq         	$t2, $zero, -28	    # 0x0000004c

Before apply this patch, the follow test case will reveal soft lock issues.

cd tools/testing/selftests/bpf/
./test_progs --allow=tailcalls/tailcall_bpf2bpf_1

dmesg:
watchdog: BUG: soft lockup - CPU#2 stuck for 26s! [test_progs:25056]

Signed-off-by: Haoran Jiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants