linux-stable/arch
Naveen N Rao 0f71dcfb4a powerpc/ftrace: Add support for -fpatchable-function-entry
GCC v13.1 updated support for -fpatchable-function-entry on ppc64le to
emit nops after the local entry point, rather than before it. This
allows us to use this in the kernel for ftrace purposes. A new script is
added under arch/powerpc/tools/ to help detect if nops are emitted after
the function local entry point, or before the global entry point.

With -fpatchable-function-entry, we no longer have the profiling
instructions generated at function entry, so we only need to validate
the presence of two nops at the ftrace location in ftrace_init_nop(). We
patch the preceding instruction with 'mflr r0' to match the
-mprofile-kernel ABI for subsequent ftrace use.

This changes the profiling instructions used on ppc32. The default -pg
option emits an additional 'stw' instruction after 'mflr r0' and before
the branch to _mcount 'bl _mcount'. This is very similar to the original
-mprofile-kernel implementation on ppc64le, where an additional 'std'
instruction was used to save LR to its save location in the caller's
stackframe. Subsequently, this additional store was removed in later
compiler versions for performance reasons. The same reasons apply for
ppc32 so we only patch in a 'mflr r0'.

Signed-off-by: Naveen N Rao <naveen@kernel.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/68586d22981a2c3bb45f27a2b621173d10a7d092.1687166935.git.naveen@kernel.org
2023-08-22 00:09:06 +10:00
..
alpha Merge branch 'expand-stack' 2023-06-28 20:35:21 -07:00
arc asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
arm asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
arm64 ARM: 2023-07-23 10:44:38 -07:00
csky arch/csky patches for 6.5 2023-07-01 21:12:32 -07:00
hexagon Merge branch 'expand-stack' 2023-06-28 20:35:21 -07:00
ia64 io_uring-6.5-2023-07-21 2023-07-22 10:46:30 -07:00
loongarch asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
m68k asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
microblaze slab updates for 6.5 2023-06-29 16:34:12 -07:00
mips - fixes for KVM 2023-07-09 10:02:49 -07:00
nios2 slab updates for 6.5 2023-06-29 16:34:12 -07:00
openrisc OpenRISC fix for 6.5 2023-07-12 16:28:53 -07:00
parisc io_uring-6.5-2023-07-21 2023-07-22 10:46:30 -07:00
powerpc powerpc/ftrace: Add support for -fpatchable-function-entry 2023-08-22 00:09:06 +10:00
riscv RISC-V Fixes for 6.5-rc2 2023-07-14 11:14:07 -07:00
s390 ARM: 2023-07-23 10:44:38 -07:00
sh sh fixes for v6.5 2023-07-13 13:34:00 -07:00
sparc sparc: mark __arch_xchg() as __always_inline 2023-07-13 09:54:32 -07:00
um x86/alternative: Rename apply_ibt_endbr() 2023-07-10 09:52:23 +02:00
x86 cpu/SMT: Remove topology_smt_supported() 2023-07-28 09:53:37 +02:00
xtensa xtensa: fix unaligned and load/store configuration interaction 2023-07-10 21:41:04 -07:00
.gitignore
Kconfig cpu/SMT: Create topology_smt_thread_allowed() 2023-07-28 09:53:37 +02:00