powerpc64/bpf: Do not save/restore LR on each call to bpf_stf_barrier()
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Mon, 14 Feb 2022 10:41:38 +0000 (16:11 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 7 Mar 2022 13:04:57 +0000 (00:04 +1100)
Instead of saving and restoring LR before each invocation to
bpf_stf_barrier(), set SEEN_FUNC flag so that we save/restore LR in
prologue/epilogue.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/4446f25478d82a2a4ac9dab2ebdfd88ddf923eb7.1644834730.git.naveen.n.rao@linux.vnet.ibm.com
arch/powerpc/net/bpf_jit_comp64.c

index 371bd5a..27ac2fc 100644 (file)
@@ -690,11 +690,10 @@ emit_clear:
                                EMIT(PPC_RAW_ORI(_R31, _R31, 0));
                                break;
                        case STF_BARRIER_FALLBACK:
-                               EMIT(PPC_RAW_MFLR(b2p[TMP_REG_1]));
+                               ctx->seen |= SEEN_FUNC;
                                PPC_LI64(12, dereference_kernel_function_descriptor(bpf_stf_barrier));
                                EMIT(PPC_RAW_MTCTR(12));
                                EMIT(PPC_RAW_BCTRL());
-                               EMIT(PPC_RAW_MTLR(b2p[TMP_REG_1]));
                                break;
                        case STF_BARRIER_NONE:
                                break;