[PATCH v2 5/5] powerpc64/ftrace: Implement support for ftrace_regs_caller()
Naveen N. Rao
naveen.n.rao at linux.vnet.ibm.com
Thu Mar 22 01:37:32 AEDT 2018
Steven Rostedt wrote:
> On Wed, 21 Mar 2018 16:13:22 +0530
> "Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:
>
>> int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs)
>> {
>> mod->arch.toc = my_r2(sechdrs, mod);
>> - mod->arch.tramp = create_ftrace_stub(sechdrs, mod);
>> + mod->arch.tramp = create_ftrace_stub(sechdrs, mod,
>> + (unsigned long)ftrace_caller);
>> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>> + mod->arch.tramp_regs = create_ftrace_stub(sechdrs, mod,
>> + (unsigned long)ftrace_regs_caller);
>
> So you only reference ftrace_regs_caller if you have
> DYNAMIC_FTRACE_WITH_REGS defined?
Yes.
>
>> + if (!mod->arch.tramp_regs)
>> + return -ENOENT;
>> +#endif
>>
>> if (!mod->arch.tramp)
>> return -ENOENT;
>
>
>> diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
>> index 8f2380304ef1..7b81db85f76e 100644
>> --- a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
>> +++ b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S
>> @@ -20,8 +20,8 @@
>> #ifdef CONFIG_DYNAMIC_FTRACE
>> /*
>> *
>> - * ftrace_caller() is the function that replaces _mcount() when ftrace is
>> - * active.
>> + * ftrace_caller()/ftrace_regs_caller() is the function that replaces _mcount()
>> + * when ftrace is active.
>> *
>> * We arrive here after a function A calls function B, and we are the trace
>> * function for B. When we enter r1 points to A's stack frame, B has not yet
>> @@ -37,7 +37,7 @@
>> * Our job is to save the register state into a struct pt_regs (on the stack)
>> * and then arrange for the ftrace function to be called.
>> */
>
> Perhaps you want to add:
>
> #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>
> here.
I think that will always be set here. ftrace_64_mprofile.S is only built
for -mprofile-kernel and we select HAVE_DYNAMIC_FTRACE_WITH_REGS if
MPROFILE_KERNEL is enabled. It looks like there is no way to unset just
CONFIG_DYNAMIC_FTRACE_WITH_REGS and so, for -mprofile-kernel, we can
assume it is always set?
- Naveen
More information about the Linuxppc-dev
mailing list