Skip to content

Fix two tailcall-related issues #9231

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

Closed

Conversation

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

Pull request for series with
subject: Fix two tailcall-related issues
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 26d0e53
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 0df1a55
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

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

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 1230be8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 212ec92
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 621af19
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 564606f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 38d95be
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=977599
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ad97cb2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=979921
version: 2

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the series/977599=>bpf-next branch from 3f6e3a7 to 3b3103c Compare July 9, 2025 02:02
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the bpf-next_base branch 2 times, most recently from 128441d to f818fa8 Compare July 11, 2025 18:34
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: ea2aecd
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=979921
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e860a98
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=979921
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: e860a98
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=979921
version: 2

@kernel-patches-daemon-bpf
Copy link
Author

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

Haoran Jiang added 2 commits July 16, 2025 18:33
…emit_bpf_tail_call function

The extra pass of bpf_int_jit_compile() skips JIT context initialization
which essentially skips offset calculation leaving 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]

Fixes: 5dc6155 ("LoongArch: Add BPF JIT support")
Signed-off-by: Haoran Jiang <[email protected]>
Reviewed-by: Hengqi Chen <[email protected]>
In specific use cases combining tailcalls and BPF-to-BPF calls,
MAX_TAIL_CALL_CNT won't work because of missing tail_call_cnt
back-propagation from callee to caller。This patch fixes this
tailcall issue caused by abusing the tailcall in bpf2bpf feature
on LoongArch like the way of "bpf, x64: Fix tailcall hierarchy".

push tail_call_cnt_ptr and tail_call_cnt into the stack,
tail_call_cnt_ptr is passed between tailcall and bpf2bpf,
uses tail_call_cnt_ptr to increment tail_call_cnt.

Fixes: bb035ef ("LoongArch: BPF: Support mixing bpf2bpf and tailcalls")
Fixes: 5dc6155 ("LoongArch: Add BPF JIT support")
Signed-off-by: Haoran Jiang <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=979921 irrelevant now. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/977599=>bpf-next branch July 17, 2025 01:40
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