Commit a0e9418
LoongArch: BPF: Optimize the calculation method of jmp_offset in the 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]>1 parent 6d7073a commit a0e9418
1 file changed
+9
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 211 | + | |
214 | 212 | | |
215 | 213 | | |
216 | 214 | | |
| |||
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
223 | | - | |
224 | | - | |
225 | | - | |
| 221 | + | |
| 222 | + | |
226 | 223 | | |
227 | 224 | | |
228 | 225 | | |
| |||
232 | 229 | | |
233 | 230 | | |
234 | 231 | | |
| 232 | + | |
| 233 | + | |
235 | 234 | | |
236 | 235 | | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| 258 | + | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| |||
263 | 265 | | |
264 | 266 | | |
265 | 267 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | 268 | | |
276 | 269 | | |
277 | 270 | | |
278 | 271 | | |
279 | 272 | | |
280 | | - | |
281 | | - | |
282 | 273 | | |
283 | 274 | | |
284 | 275 | | |
| |||
916 | 907 | | |
917 | 908 | | |
918 | 909 | | |
919 | | - | |
| 910 | + | |
920 | 911 | | |
921 | 912 | | |
922 | 913 | | |
| |||
1342 | 1333 | | |
1343 | 1334 | | |
1344 | 1335 | | |
1345 | | - | |
1346 | 1336 | | |
1347 | 1337 | | |
1348 | 1338 | | |
| |||
0 commit comments