Re: [PATCH 1/2] powerpc/ftrace: Separate the heuristics for checking call sites
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-07-21 10:36:00
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-07-21 10:36:00
Madhavan Srinivasan [off-list ref] writes:
On Tuesday 19 July 2016 10:18 AM, Michael Ellerman wrote:quoted
In __ftrace_make_nop() (the 64-bit version), we have code to deal with two ftrace ABIs. There is the original ABI, which looks mostly like a function call, and then the mprofile-kernel ABI which is just a branch.
...
quoted
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 7af6c4de044b..438442dac44c 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c@@ -144,6 +144,21 @@ __ftrace_make_nop(struct module *mod, return -EINVAL; } +#ifdef CC_USING_MPROFILE_KERNEL + /* When using -mkernel_profile there is no load to jump over */ + pop = PPC_INST_NOP; + + if (probe_kernel_read(&op, (void *)(ip - 4), 4)) { + pr_err("Fetching instruction at %lx failed.\n", ip - 4); + return -EFAULT; + } + + /* We expect either a mlfr r0, or a std r0, LRSAVE(r1) */nit.. "mflr" and not "mlfr"
Yep, copied from the old comment, but I'll fix it up. Thanks. cheers