[PATCH] powerpc/ftrace: Remove ftrace init tramp once kernel init is complete

Michael Ellerman mpe at ellerman.id.au
Thu May 5 23:59:32 AEST 2022


"Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> writes:
> Stop using the ftrace trampoline for init section once kernel init is
> complete.
>
> Fixes: 67361cf8071286 ("powerpc/ftrace: Handle large kernel configs")
> Cc: stable at vger.kernel.org # v4.20+
> Signed-off-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/ftrace.h  |  2 ++
>  arch/powerpc/kernel/trace/ftrace.c | 15 ++++++++++++---
>  arch/powerpc/mm/mem.c              |  2 ++
>  3 files changed, 16 insertions(+), 3 deletions(-)

This breaks the corenet64_smp_defconfig build:

  ld: arch/powerpc/mm/mem.o: in function `.free_initmem':
  (.text+0x130): undefined reference to `.ftrace_free_init_tramp'
  make[1]: *** [/home/michael/linux/Makefile:1158: vmlinux] Error 1
  make: *** [Makefile:219: __sub-make] Error 2


> diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
> index d83758acd1c7c3..d329f4ad18944d 100644
> --- a/arch/powerpc/include/asm/ftrace.h
> +++ b/arch/powerpc/include/asm/ftrace.h
> @@ -110,11 +110,13 @@ static inline u8 this_cpu_get_ftrace_enabled(void)
>  	return get_paca()->ftrace_enabled;
>  }
>  
> +void ftrace_free_init_tramp(void);
>  #else /* CONFIG_PPC64 */
>  static inline void this_cpu_disable_ftrace(void) { }
>  static inline void this_cpu_enable_ftrace(void) { }
>  static inline void this_cpu_set_ftrace_enabled(u8 ftrace_enabled) { }
>  static inline u8 this_cpu_get_ftrace_enabled(void) { return 1; }
> +static inline void ftrace_free_init_tramp(void) { }
>  #endif /* CONFIG_PPC64 */

I think because we need that stub to be defined.

But this config does have PPC64=y but *doesn't* have DYNAMIC_FTRACE or
FTRACE_SYSCALLS or FUNCTION_GRAPH_TRACER enabled.

cheers


More information about the Linuxppc-dev mailing list