]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
powerpc64/bpf: Avoid tailcall restore from trampoline
authorAbhishek Dubey <adubey@linux.ibm.com>
Sat, 24 Jan 2026 07:52:20 +0000 (13:22 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Thu, 29 Jan 2026 03:36:00 +0000 (09:06 +0530)
Back propagation of tailcall count is no longer needed for
powerpc64 due to use of reference, which updates the tailcall
count in the tail_call_info field in the frame of the main
program only.

Back propagation is still required for 32-bit powerpc.

Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260124075223.6033-4-adubey@linux.ibm.com
arch/powerpc/net/bpf_jit_comp.c

index 7b494be1a48f370887283bc61ffb39fbf9034b74..038448b74fa0c60704c18eb1fc2c8c7e0bf2da6a 100644 (file)
@@ -676,14 +676,11 @@ static void bpf_trampoline_setup_tail_call_info(u32 *image, struct codegen_conte
 static void bpf_trampoline_restore_tail_call_cnt(u32 *image, struct codegen_context *ctx,
                                                 int func_frame_offset, int r4_off)
 {
-       if (IS_ENABLED(CONFIG_PPC64)) {
-               /* See bpf_jit_stack_tailcallcnt() */
-               int tailcallcnt_offset = BPF_PPC_TAILCALL;
-
-               EMIT(PPC_RAW_LL(_R3, _R1, -tailcallcnt_offset));
-               EMIT(PPC_RAW_STL(_R3, _R1, func_frame_offset - tailcallcnt_offset));
-       } else {
-               /* See bpf_jit_stack_offsetof() and BPF_PPC_TC */
+       if (IS_ENABLED(CONFIG_PPC32)) {
+               /*
+                * Restore tailcall for 32-bit powerpc
+                * See bpf_jit_stack_offsetof() and BPF_PPC_TC
+                */
                EMIT(PPC_RAW_STL(_R4, _R1, r4_off));
        }
 }