Re: [PATCH v2 5/5] powerpc64/ftrace: Implement support for ftrace_regs_caller()
From: Naveen N. Rao <hidden>
Date: 2018-03-21 14:37:44
Steven Rostedt wrote:
On Wed, 21 Mar 2018 16:13:22 +0530 "Naveen N. Rao" [off-list ref] wrote: =20quoted
int module_finalize_ftrace(struct module *mod, const Elf_Shdr *sechdrs) { mod->arch.toc =3D my_r2(sechdrs, mod); - mod->arch.tramp =3D create_ftrace_stub(sechdrs, mod); + mod->arch.tramp =3D create_ftrace_stub(sechdrs, mod, + (unsigned long)ftrace_caller); +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS + mod->arch.tramp_regs =3D create_ftrace_stub(sechdrs, mod, + (unsigned long)ftrace_regs_caller);=20 So you only reference ftrace_regs_caller if you have DYNAMIC_FTRACE_WITH_REGS defined?
Yes.
=20quoted
+ if (!mod->arch.tramp_regs) + return -ENOENT; +#endif =20 if (!mod->arch.tramp) return -ENOENT;=20 =20quoted
diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S b/arch/power=
pc/kernel/trace/ftrace_64_mprofile.S
quoted
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
quoted
- * active. + * ftrace_caller()/ftrace_regs_caller() is the function that replaces _=
mcount()
quoted
+ * when ftrace is active. * * We arrive here after a function A calls function B, and we are the t=
race
quoted
* function for B. When we enter r1 points to A's stack frame, B has no=
t yet
quoted
@@ -37,7 +37,7 @@ * Our job is to save the register state into a struct pt_regs (on the =
stack)
quoted
* and then arrange for the ftrace function to be called. */=20 Perhaps you want to add: =20 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS =20 here.
I think that will always be set here. ftrace_64_mprofile.S is only built=20 for -mprofile-kernel and we select HAVE_DYNAMIC_FTRACE_WITH_REGS if=20 MPROFILE_KERNEL is enabled. It looks like there is no way to unset just=20 CONFIG_DYNAMIC_FTRACE_WITH_REGS and so, for -mprofile-kernel, we can=20 assume it is always set? - Naveen =