Skip to content

Commit cb928ac

Browse files
rnavmpe
authored andcommitted
powerpc64/ftrace: Fix ftrace for clang builds
Clang doesn't support -mprofile-kernel ABI, so guard the checks against CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version. Fixes: 23b44fc ("powerpc/ftrace: Make __ftrace_make_{nop/call}() common to PPC32 and PPC64") Cc: [email protected] # v5.19+ Reported-by: Nick Desaulniers <[email protected]> Reported-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Naveen N. Rao <[email protected]> Tested-by: Ondrej Mosnacek <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: llvm/llvm-project#57031 Link: ClangBuiltLinux#1682 Link: https://lore.kernel.org/r/[email protected]
1 parent 5cccf7a commit cb928ac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ int ftrace_make_nop(struct module *mod,
393393
*/
394394
static bool expected_nop_sequence(void *ip, ppc_inst_t op0, ppc_inst_t op1)
395395
{
396-
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1))
396+
if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS))
397+
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
398+
else
397399
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_BRANCH(8))) &&
398400
ppc_inst_equal(op1, ppc_inst(PPC_INST_LD_TOC));
399-
else
400-
return ppc_inst_equal(op0, ppc_inst(PPC_RAW_NOP()));
401401
}
402402

403403
static int
@@ -412,7 +412,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
412412
if (copy_inst_from_kernel_nofault(op, ip))
413413
return -EFAULT;
414414

415-
if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V1) &&
415+
if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) &&
416416
copy_inst_from_kernel_nofault(op + 1, ip + 4))
417417
return -EFAULT;
418418

0 commit comments

Comments
 (0)