Re: [PATCH] powerpc64/ftrace: Fix ftrace for clang builds

2022-08-13 Thread Michael Ellerman
On Tue, 9 Aug 2022 15:29:07 +0530, Naveen N. Rao wrote:
> Clang doesn't support -mprofile-kernel ABI, so guard the checks against
> CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version.
> 
> 

Applied to powerpc/fixes.

[1/1] powerpc64/ftrace: Fix ftrace for clang builds
  https://git.kernel.org/powerpc/c/cb928ac192128c842f4c1cfc8b6780b95719d65f

cheers


Re: [PATCH] powerpc64/ftrace: Fix ftrace for clang builds

2022-08-09 Thread Ondrej Mosnáček
On Tue, Aug 9, 2022 at 11:59 AM Naveen N. Rao
 wrote:
> Clang doesn't support -mprofile-kernel ABI, so guard the checks against
> CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version.
>
> Fixes: 23b44fc248f420 ("powerpc/ftrace: Make __ftrace_make_{nop/call}() 
> common to PPC32 and PPC64")
> Reported-by: Nick Desaulniers 
> Reported-by: Ondrej Mosnacek 
> Signed-off-by: Naveen N. Rao 
> ---
>  arch/powerpc/kernel/trace/ftrace.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

With this patch my reproducer [1] is passing, thanks!

Tested-by: Ondrej Mosnacek 

[1] https://github.com/ClangBuiltLinux/linux/issues/1682#issue-1330483247


[PATCH] powerpc64/ftrace: Fix ftrace for clang builds

2022-08-09 Thread Naveen N. Rao
Clang doesn't support -mprofile-kernel ABI, so guard the checks against
CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version.

Fixes: 23b44fc248f420 ("powerpc/ftrace: Make __ftrace_make_{nop/call}() common 
to PPC32 and PPC64")
Reported-by: Nick Desaulniers 
Reported-by: Ondrej Mosnacek 
Signed-off-by: Naveen N. Rao 
---
 arch/powerpc/kernel/trace/ftrace.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/trace/ftrace.c 
b/arch/powerpc/kernel/trace/ftrace.c
index cb158c32b50b99..7b85c3b460a3c0 100644
--- a/arch/powerpc/kernel/trace/ftrace.c
+++ b/arch/powerpc/kernel/trace/ftrace.c
@@ -393,11 +393,11 @@ int ftrace_make_nop(struct module *mod,
  */
 static bool expected_nop_sequence(void *ip, ppc_inst_t op0, ppc_inst_t op1)
 {
-   if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1))
+   if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS))
+   return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
+   else
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_BRANCH(8))) &&
   ppc_inst_equal(op1, ppc_inst(PPC_INST_LD_TOC));
-   else
-   return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
 }
 
 static int
@@ -412,7 +412,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long 
addr)
if (copy_inst_from_kernel_nofault(op, ip))
return -EFAULT;
 
-   if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) &&
+   if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) &&
copy_inst_from_kernel_nofault(op + 1, ip + 4))
return -EFAULT;
 

base-commit: ff1ed171e05c971652a0ede3d716997de8ee41c9
-- 
2.37.1