linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang
@ 2023-06-09  3:45 Naveen N Rao
  2023-06-09 19:45 ` Nick Desaulniers
  2023-07-03  5:26 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Naveen N Rao @ 2023-06-09  3:45 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nathan Chancellor, llvm, Nick Desaulniers

Ftrace on ppc32 expects a three instruction sequence at the beginning of
each function when specifying -pg:
	mflr	r0
	stw	r0,4(r1)
	bl	_mcount

This is the case with all supported versions of gcc. Clang however emits
a branch to _mcount after the function prologue, similar to the pre
-mprofile-kernel ABI on ppc64. This is not supported.

Disable ftrace on ppc32 if using clang for now. This can be re-enabled
later if clang picks up support for -fpatchable-function-entry on ppc32.

Signed-off-by: Naveen N Rao <naveen@kernel.org>
---
 arch/powerpc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bff5820b7cda14..d85e3cf4016d90 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -236,7 +236,7 @@ config PPC
 	select HAVE_FUNCTION_DESCRIPTORS	if PPC64_ELF_ABI_V1
 	select HAVE_FUNCTION_ERROR_INJECTION
 	select HAVE_FUNCTION_GRAPH_TRACER
-	select HAVE_FUNCTION_TRACER
+	select HAVE_FUNCTION_TRACER		if PPC64 || (PPC32 && CC_IS_GCC)
 	select HAVE_GCC_PLUGINS			if GCC_VERSION >= 50200   # plugin support on gcc <= 5.1 is buggy on PPC
 	select HAVE_GENERIC_VDSO
 	select HAVE_HARDLOCKUP_DETECTOR_ARCH	if PPC_BOOK3S_64 && SMP

base-commit: bd517a8442b6c6646a136421cd4c1b95bf4ce32b
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang
  2023-06-09  3:45 [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang Naveen N Rao
@ 2023-06-09 19:45 ` Nick Desaulniers
  2023-07-03  5:26 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2023-06-09 19:45 UTC (permalink / raw)
  To: Naveen N Rao; +Cc: Nathan Chancellor, llvm, linuxppc-dev

On Thu, Jun 8, 2023 at 8:47 PM Naveen N Rao <naveen@kernel.org> wrote:
>
> Ftrace on ppc32 expects a three instruction sequence at the beginning of
> each function when specifying -pg:
>         mflr    r0
>         stw     r0,4(r1)
>         bl      _mcount
>
> This is the case with all supported versions of gcc. Clang however emits
> a branch to _mcount after the function prologue, similar to the pre
> -mprofile-kernel ABI on ppc64. This is not supported.
>
> Disable ftrace on ppc32 if using clang for now. This can be re-enabled
> later if clang picks up support for -fpatchable-function-entry on ppc32.
>
> Signed-off-by: Naveen N Rao <naveen@kernel.org>

Thanks for the patch! I've filed the below bug, a link to whom I'd
like to see retained in the commit message. In the future, please file
bugs against the compiler vendors first, then include the relevant
link.

Link: https://github.com/llvm/llvm-project/issues/63220
Acked-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  arch/powerpc/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index bff5820b7cda14..d85e3cf4016d90 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -236,7 +236,7 @@ config PPC
>         select HAVE_FUNCTION_DESCRIPTORS        if PPC64_ELF_ABI_V1
>         select HAVE_FUNCTION_ERROR_INJECTION
>         select HAVE_FUNCTION_GRAPH_TRACER
> -       select HAVE_FUNCTION_TRACER
> +       select HAVE_FUNCTION_TRACER             if PPC64 || (PPC32 && CC_IS_GCC)
>         select HAVE_GCC_PLUGINS                 if GCC_VERSION >= 50200   # plugin support on gcc <= 5.1 is buggy on PPC
>         select HAVE_GENERIC_VDSO
>         select HAVE_HARDLOCKUP_DETECTOR_ARCH    if PPC_BOOK3S_64 && SMP
>
> base-commit: bd517a8442b6c6646a136421cd4c1b95bf4ce32b
> --
> 2.40.1
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang
  2023-06-09  3:45 [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang Naveen N Rao
  2023-06-09 19:45 ` Nick Desaulniers
@ 2023-07-03  5:26 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2023-07-03  5:26 UTC (permalink / raw)
  To: linuxppc-dev, Naveen N Rao; +Cc: Nathan Chancellor, llvm, Nick Desaulniers

On Fri, 09 Jun 2023 09:15:01 +0530, Naveen N Rao wrote:
> Ftrace on ppc32 expects a three instruction sequence at the beginning of
> each function when specifying -pg:
> 	mflr	r0
> 	stw	r0,4(r1)
> 	bl	_mcount
> 
> This is the case with all supported versions of gcc. Clang however emits
> a branch to _mcount after the function prologue, similar to the pre
> -mprofile-kernel ABI on ppc64. This is not supported.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/ftrace: Disable ftrace on ppc32 if using clang
      https://git.kernel.org/powerpc/c/d24da1f85530a5b47590c0febd1395dd8fc73124

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-03  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09  3:45 [PATCH] powerpc/ftrace: Disable ftrace on ppc32 if using clang Naveen N Rao
2023-06-09 19:45 ` Nick Desaulniers
2023-07-03  5:26 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).