powerpc64/ftrace: Add support for ftrace_modify_call() and a few other fixes
Subsystems (3)
v3 cover powerpc64/ftrace: Add support for ftrace_modify_call() and a few other fixes
This is v3 of the patches posted at:
https://www.mail-archive.com/[email protected]/msg130652.html
This series has been tested using mambo for p8 (hash) and p9 (radix).
The first two patches fix a kernel oops when function tracing is enabled while using KVM.
Patch 3 is new and changes how ftrace is disabled before kexec.
Patch 4 tightens how we detect _mcount() call sites for -mprofile-kernel during module loading.
The last two patches implement support for ftrace_caller() to conditionally save the register state. This speeds up the function tracer a bit. The existing ftrace_caller() is renamed to ftrace_regs_caller() since we save the entire pt_regs today. A new implementation of ftrace_caller() that saves the minimum register state is provided. We switch between the two variants through ftrace_modify_call(). The necessary support to call into the two different variants from modules is also added.
- Naveen
Naveen N. Rao (6):
powerpc64/ftrace: Add a field in paca to disable ftrace in unsafe code
paths
powerpc64/ftrace: Disable ftrace during kvm guest entry/exit powerpc/kexec: Disable ftrace before switching to the new kernel powerpc64/module: Tighten detection of mcount call sites with
-mprofile-kernel
powerpc64/ftrace: Use the generic version of ftrace_replace_code() powerpc64/ftrace: Implement support for ftrace_regs_caller()
arch/powerpc/include/asm/ftrace.h | 2 - arch/powerpc/include/asm/module.h | 3 + arch/powerpc/include/asm/paca.h | 1 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/machine_kexec.c | 6 +- arch/powerpc/kernel/module_64.c | 43 +++-- arch/powerpc/kernel/trace/ftrace.c | 210 ++++++++++++++++++++----- arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 85 +++++++++- arch/powerpc/kernel/trace/ftrace_64_pg.S | 4 + arch/powerpc/kvm/book3s_hv_rmhandlers.S | 8 + 10 files changed, 296 insertions(+), 67 deletions(-)
Signature · 1 line
2.16.2
PATCH v3 1/6 powerpc64/ftrace: Add a field in paca to disable ftrace in unsafe code paths
We have some C code that we call into from real mode where we cannot take any exceptions. Though the C functions themselves are mostly safe, if these functions are traced, there is a possibility that we may take an exception. For instance, in certain conditions, the ftrace code uses WARN(), which uses a 'trap' to do its job.
For such scenarios, introduce a new field in paca 'ftrace_disabled', which is checked on ftrace entry before continuing. This field can then be set to a non-zero value to disable/pause ftrace, and reset to zero to resume ftrace.
---
Changes since v2:
- Move paca->ftrace_disabled out of CONFIG_BOOK3S_64.
- Disable tracing when asked for, not the other way around.
arch/powerpc/include/asm/paca.h | 1 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 14 ++++++++++++++ arch/powerpc/kernel/trace/ftrace_64_pg.S | 4 ++++ 4 files changed, 20 insertions(+)
arch/powerpc/include/asm/paca.h +1 -0
@@ -164,6 +164,7 @@ struct paca_struct {u8 io_sync;/* writel() needs spin_unlock sync */ u8 irq_work_pending;/* IRQ_WORK interrupt while soft-disable */ u8 nap_state_lost;/* NV GPR values lost in power7_idle */ +u8 ftrace_disabled;/* Hard disable ftrace */ u64 sprg_vdso;/* Saved user-visible sprg */ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
u64 tm_scratch; /* TM scratch area for reclaim
*/
arch/powerpc/kernel/asm-offsets.c +1 -0
@@ -180,6 +180,7 @@ int main(void)OFFSET (PACAKMSR , paca_struct, kernel_msr);OFFSET (PACAIRQSOFTMASK , paca_struct, irq_soft_mask);OFFSET (PACAIRQHAPPENED , paca_struct, irq_happened); +OFFSET (PACA_FTRACE_DISABLED , paca_struct, ftrace_disabled);#ifdef CONFIG_PPC_BOOK3S OFFSET (PACACONTEXTID , paca_struct, mm_ctx_id);#ifdef CONFIG_PPC_MM_SLICES
arch/powerpc/kernel/trace/ftrace_64_mprofile.S +14 -0
@@ -47,6 +47,12 @@ _GLOBAL(ftrace_caller) /* Save all gprs to pt_regs */ SAVE_GPR(0, r1) SAVE_10GPRS(2, r1) + + /* Ok to continue? */ + lbz r3, PACA_FTRACE_DISABLED(r13) + cmpdi r3, 0 + bne ftrace_no_trace + SAVE_10GPRS(12, r1) SAVE_10GPRS(22, r1)
@@ -168,6 +174,14 @@ _GLOBAL(ftrace_graph_stub) _GLOBAL(ftrace_stub) blr +ftrace_no_trace: + mflr r3 + mtctr r3 + REST_GPR(3, r1) + addi r1, r1, SWITCH_FRAME_SIZE + mtlr r0 + bctr + #ifdef CONFIG_LIVEPATCH /* * This function runs in the mcount context, between two functions. As
arch/powerpc/kernel/trace/ftrace_64_pg.S +4 -0
@@ -16,6 +16,10 @@ #ifdef CONFIG_DYNAMIC_FTRACE _GLOBAL_TOC(ftrace_caller) + lbz r3, PACA_FTRACE_DISABLED(r13) + cmpdi r3, 0 + bnelr + /* Taken from output of objdump from lib64/glibc */ mflr r3 ld r11, 0(r1)
Signature · 1 line
2.16.2
PATCH v3 2/6 powerpc64/ftrace: Disable ftrace during kvm guest entry/exit
In reply to Naveen N. RaoDuring guest entry/exit, we switch over to/from the guest MMU context. While doing so, we set our state to KVM_GUEST_MODE_HOST_HV to note down the fact that we cannot take any exceptions in the hypervisor code.
Since ftrace may be enabled and since it can result in us taking a trap, disable ftrace by setting paca->ftrace_disabled. Once we exit the guest and restore host MMU context, we re-enable ftrace.
--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +8 -0
@@ -600,6 +600,10 @@ kvmppc_hv_entry: /* Save R1 in the PACA */ std r1, HSTATE_HOST_R1(r13) + /* Disable ftrace since we can't take a trap any more */ + li r6, 1 + stb r6, PACA_FTRACE_DISABLED(r13) + li r6, KVM_GUEST_MODE_HOST_HV stb r6, HSTATE_IN_GUEST(r13)
@@ -2048,6 +2052,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) /* Unset guest mode */ li r0, KVM_GUEST_MODE_NONE stb r0, HSTATE_IN_GUEST(r13) + li r0, 0 + stb r0, PACA_FTRACE_DISABLED(r13) ld r0, SFS+PPC_LR_STKOFF(r1) addi r1, r1, SFS
@@ -3379,6 +3385,8 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) ld r8, KVM_HOST_LPCR(r10) mtspr SPRN_LPCR, r8 isync + li r0, 0 + stb r0, PACA_FTRACE_DISABLED(r13) li r0, KVM_GUEST_MODE_NONE stb r0, HSTATE_IN_GUEST(r13)
Signature · 1 line
2.16.2
PATCH v3 3/6 powerpc/kexec: Disable ftrace before switching to the new kernel
In reply to Naveen N. RaoIf function_graph tracer is enabled during kexec, we see the below exception in the simulator:
root@(none):/# kexec -e kvm: exiting hardware virtualization kexec_core: Starting new kernel [ 19.262020070,5] OPAL: Switch to big-endian OS kexec: Starting switchover sequence. Interrupt to 0xC000000000004380 from 0xC000000000004380 ** Execution stopped: Continuous Interrupt, Instruction caused exception, **
Now that we have a more effective way to disable ftrace, let's use that before switching to a new kernel during kexec.
--- arch/powerpc/kernel/machine_kexec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/kernel/machine_kexec.c +2 -4
@@ -95,16 +95,14 @@ void arch_crash_save_vmcoreinfo(void)*/ void machine_kexec (struct kimage *image) { -int save_ftrace_enabled; - - save_ftrace_enabled =__ftrace_enabled_save (); +get_paca ()->ftrace_disabled =1 ;if (ppc_md.machine_kexec) ppc_md.machine_kexec (image);else default_machine_kexec (image); -__ftrace_enabled_restore (save_ftrace_enabled); +get_paca ()->ftrace_disabled =0 ;/* Fall back to normal restart if we're still alive. */ machine_restart (NULL );
Signature · 1 line
2.16.2
Michael Ellerman
reviewerRe: [PATCH v3 3/6] powerpc/kexec: Disable ftrace before switching to the new kernel
Quoted 23 lines · Naveen N. Rao
If
function_graphtracer is enabled during kexec, we see the below exception in the simulator:root@(none):/# kexec -e kvm: exiting hardware virtualization kexec_core: Starting new kernel [ 19.262020070,5] OPAL: Switch to big-endian OS kexec: Starting switchover sequence. Interrupt to 0xC000000000004380 from 0xC000000000004380 ** Execution stopped: Continuous Interrupt, Instruction caused exception, **Now that we have a more effective way to disable ftrace, let's use that before switching to a new kernel during kexec.
Signed-off-by Naveen N. Rao <[email protected]>--- arch/powerpc/kernel/machine_kexec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/powerpc/kernel/machine_kexec.c +0
-0
arch/powerpc/kernel/machine_kexec.c void arch_crash_save_vmcoreinfo(void) · line 98
Quoted 7 lines
arch/powerpc/kernel/machine_kexec.c +1
-3@@ -95,16 +95,14 @@ void arch_crash_save_vmcoreinfo(void)*/ void machine_kexec (struct kimage *image) { -int save_ftrace_enabled; - - save_ftrace_enabled =__ftrace_enabled_save (); +get_paca ()->ftrace_disabled =1 ;
This doesn't compile on 32-bit:
Failed: powerpc-next/corenet32_smp_defconfig/powerpc-5.3 (http://kisskb.ozlabs.ibm.com/kisskb/buildresult/13314085/log/)
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:105:12: error: invalid type argument of '->' (have 'int')
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:12: error: invalid type argument of '->' (have 'int')
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:2: error: implicit declaration of function 'get_paca' [-Werror=implicit-function-declaration]A wrapper is probably best that does nothing on 32-bit.
cheers
Michael Ellerman
reviewerRe: [PATCH v3 3/6] powerpc/kexec: Disable ftrace before switching to the new kernel
Quoted 34 lines · Michael Ellerman
Quoted 23 lines · Naveen N. Rao
If
function_graphtracer is enabled during kexec, we see the below exception in the simulator:root@(none):/# kexec -e kvm: exiting hardware virtualization kexec_core: Starting new kernel [ 19.262020070,5] OPAL: Switch to big-endian OS kexec: Starting switchover sequence. Interrupt to 0xC000000000004380 from 0xC000000000004380 ** Execution stopped: Continuous Interrupt, Instruction caused exception, **Now that we have a more effective way to disable ftrace, let's use that before switching to a new kernel during kexec.
Signed-off-by Naveen N. Rao <[email protected]>--- arch/powerpc/kernel/machine_kexec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/powerpc/kernel/machine_kexec.c +0
-0arch/powerpc/kernel/machine_kexec.c void arch_crash_save_vmcoreinfo(void) · line 98
Quoted 7 lines
arch/powerpc/kernel/machine_kexec.c +1
-3@@ -95,16 +95,14 @@ void arch_crash_save_vmcoreinfo(void)*/ void machine_kexec (struct kimage *image) { -int save_ftrace_enabled; - - save_ftrace_enabled =__ftrace_enabled_save (); +get_paca ()->ftrace_disabled =1 ;This doesn't compile on 32-bit:
Quoted 7 lines
Failed: powerpc-next/corenet32_smp_defconfig/powerpc-5.3 (http://kisskb.ozlabs.ibm.com/kisskb/buildresult/13314085/log/)
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:105:12: error: invalid type argument of '->' (have 'int') /kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:12: error: invalid type argument of '->' (have 'int') /kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:2: error: implicit declaration of function 'get_paca' [-Werror=implicit-function-declaration]A wrapper is probably best that does nothing on 32-bit.
Actually it should probably do __ftrace_enabled_save() etc. on 32-bit, like the existing code does.
cheers
Re: [PATCH v3 3/6] powerpc/kexec: Disable ftrace before switching to the new kernel
Quoted 12 lines · Michael Ellerman
Michael Ellerman <[email protected]> writes:
=20Quoted 10 lines
Quoted 9 lines · Naveen N. Rao
If
function_graphtracer is enabled during kexec, we see the below exception in the simulator:root@(none):/# kexec -e kvm: exiting hardware virtualization kexec_core: Starting new kernel [ 19.262020070,5] OPAL: Switch to big-endian OS kexec: Starting switchover sequence. Interrupt to 0xC000000000004380 from 0xC000000000004380 ** Execution stopped: Continuous Interrupt, Instruction caused excepti=
on, **
Quoted 10 lines
Quoted 10 lines
arch/powerpc/kernel/=
Quoted 10 lines
Now that we have a more effective way to disable ftrace, let's use that before switching to a new kernel during kexec.
Signed-off-by Naveen N. Rao <[email protected]>--- arch/powerpc/kernel/machine_kexec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/powerpc/kernel/= renamed from arch/powerpc/kernel/machine_kexec.c +0
-0
machine_kexec.c
Quoted 14 lines
Quoted 14 lines
arch/powerpc/kernel/machine_kexec.c void arch_crash_save_vmcoreinfo(void) · line 98
Quoted 11 lines
index
2694d078741d..4a1b24a9dd61100644arch/powerpc/kernel/machine_kexec.c +1
-3@@ -95,16 +95,14 @@ void arch_crash_save_vmcoreinfo(void)*/ void machine_kexec (struct kimage *image) { -int save_ftrace_enabled; - - save_ftrace_enabled =3D __ftrace_enabled_save(); + get_paca()->ftrace_disabled =3D 1;This doesn't compile on 32-bit:
Quoted 1 line
Quoted 1 line
Failed: powerpc-next/corenet32_smp_defconfig/powerpc-5.3 (http://kiss=
kb.ozlabs.ibm.com/kisskb/buildresult/13314085/log/)
Quoted 1 line
Quoted 1 line
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:105:12: error: inval=
id type argument of '->' (have 'int')
Quoted 1 line
Quoted 1 line
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:12: error: invali=
d type argument of '->' (have 'int')
Quoted 1 line
Quoted 1 line
/kisskb/src/arch/powerpc/kernel/machine_kexec.c:98:2: error: implici=
t declaration of function 'get_paca' [-Werror=3Dimplicit-function-declarati= on]
Hmm... pmac32_defconfig built fine for me, so I thought we are ok there.
Quoted 6 lines
Quoted 3 lines
A wrapper is probably best that does nothing on 32-bit.
=20
Actually it should probably do__ftrace_enabled_save()etc. on 32-bit, like the existing code does.
Agree. In hindsight, I'm not updating ftrace_32.S, so I think I will=20 gate this with CONFIG_PPC64.
Thanks,
Naveen
=
PATCH v3 4/6 powerpc64/module: Tighten detection of mcount call sites with -mprofile-kernel
In reply to Naveen N. RaoFor R_PPC64_REL24 relocations, we suppress emitting instructions for TOC load/restore in the relocation stub if the relocation is for _mcount() call when using -mprofile-kernel ABI.
To detect this, we check if the preceding instructions are per the standard set of instructions emitted by gcc: either the two instruction sequence of 'mflr r0; std r0,16(r1)', or the more optimized variant of a single 'mflr r0'. This is not sufficient since nothing prevents users from hand coding sequences involving a 'mflr r0' followed by a 'bl'.
For removing the toc save instruction from the stub, we additionally check if the symbol is "_mcount". Add the same check here as well.
Also rename is_early_mcount_callsite() to is_mprofile_mcount_callsite() since that is what is being checked. The use of "early" is misleading since there is nothing involving this function that qualifies as early.
--- arch/powerpc/kernel/module_64.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/powerpc/kernel/module_64.c +9 -6
@@ -463,8 +463,11 @@ static unsigned long stub_for_addr(const Elf64_Shdr *sechdrs, }#ifdef CC_USING_MPROFILE_KERNEL -static bool is_early_mcount_callsite (u32 *instruction) +static bool is_mprofile_mcount_callsite (const char *name,u32 *instruction) { +if (strcmp ("_mcount" , name)) +return false; +/* * Check if this is one of the -mprofile-kernel sequences. */
@@ -496,8 +499,7 @@ static void squash_toc_save_inst(const char *name, unsigned long addr)#else static void squash_toc_save_inst (const char *name,unsigned long addr) { } -/* without -mprofile-kernel, mcount calls are never early */ -static bool is_early_mcount_callsite (u32 *instruction) +static bool is_mprofile_mcount_callsite (const char *name,u32 *instruction) {return false; }
@@ -505,11 +507,11 @@ static bool is_early_mcount_callsite(u32 *instruction)/* We expect a noop next: if it is, replace it with instruction to restore r2. */ -static int restore_r2 (u32 *instruction,struct module *me) +static int restore_r2 (const char *name,u32 *instruction,struct module *me) {u32 *prev_insn = instruction -1 ; -if (is_early_mcount_callsite (prev_insn)) +if (is_mprofile_mcount_callsite (name, prev_insn))return 1 ;/*
@@ -650,7 +652,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, value =stub_for_addr (sechdrs, value, me);if (!value)return -ENOENT ; -if (!restore_r2 ((u32 *)location +1 , me)) +if (!restore_r2 (strtab + sym->st_name, + (u32 *)location +1 , me))return -ENOEXEC ;squash_toc_save_inst (strtab + sym->st_name, value);
Signature · 1 line
2.16.2
PATCH v3 5/6 powerpc64/ftrace: Use the generic version of ftrace_replace_code()
In reply to Naveen N. RaoOur implementation matches that of the generic version, which also handles FTRACE_UPDATE_MODIFY_CALL. So, remove our implementation in favor of the generic version.
--- arch/powerpc/kernel/trace/ftrace.c | 36 ------------------------------------ 1 file changed, 36 deletions(-)
arch/powerpc/kernel/trace/ftrace.c +0 -36
@@ -485,42 +485,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)return ret; } -static int __ftrace_replace_code (struct dyn_ftrace *rec,int enable) -{ -unsigned long ftrace_addr = (unsigned long )FTRACE_ADDR ; -int ret; - - ret =ftrace_update_record (rec, enable); - -switch (ret) { -case FTRACE_UPDATE_IGNORE : -return 0 ; -case FTRACE_UPDATE_MAKE_CALL : -return ftrace_make_call (rec, ftrace_addr); -case FTRACE_UPDATE_MAKE_NOP : -return ftrace_make_nop (NULL , rec, ftrace_addr); - } - -return 0 ; -} - -void ftrace_replace_code (int enable) -{ -struct ftrace_rec_iter *iter; -struct dyn_ftrace *rec; -int ret; - -for (iter =ftrace_rec_iter_start (); iter; - iter =ftrace_rec_iter_next (iter)) { - rec =ftrace_rec_iter_record (iter); - ret =__ftrace_replace_code (rec, enable); -if (ret) { -ftrace_bug (ret, rec); -return ; - } - } -} -/* * Use the default ftrace_modify_all_code, but without * stop_machine().
Signature · 1 line
2.16.2
PATCH v3 6/6 powerpc64/ftrace: Implement support for ftrace_regs_caller()
In reply to Naveen N. RaoWith -mprofile-kernel, we always save the full register state in ftrace_caller(). While this works, this is inefficient if we're not interested in the register state, such as when we're using the function tracer.
Rename the existing ftrace_caller() as ftrace_regs_caller() and provide a simpler implementation for ftrace_caller() that is used when registers are not required to be saved.
---
Changes since v2:
- Disable ftrace when asked for, in ftrace_caller().
arch/powerpc/include/asm/ftrace.h | 2 - arch/powerpc/include/asm/module.h | 3 + arch/powerpc/kernel/module_64.c | 28 +++- arch/powerpc/kernel/trace/ftrace.c | 184 +++++++++++++++++++++++-- arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 71 +++++++++- 5 files changed, 262 insertions(+), 26 deletions(-)
arch/powerpc/include/asm/ftrace.h +0 -2
@@ -49,8 +49,6 @@extern void _mcount (void );#ifdef CONFIG_DYNAMIC_FTRACE -# define FTRACE_ADDR ((unsigned long)ftrace_caller) -# define FTRACE_REGS_ADDR FTRACE_ADDRstatic inline unsigned long ftrace_call_adjust (unsigned long addr) {/* reloction of mcount call site is the same as the address */
arch/powerpc/include/asm/module.h +3 -0
@@ -43,6 +43,9 @@ struct mod_arch_specific {#ifdef CONFIG_DYNAMIC_FTRACE unsigned long toc;unsigned long tramp; +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS +unsigned long tramp_regs; +#endif #endif /* For module function descriptor dereference */
arch/powerpc/kernel/module_64.c +21 -7
@@ -280,6 +280,10 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,#ifdef CONFIG_DYNAMIC_FTRACE /* make the trampoline to the ftrace_caller */ relocs++; +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS +/* an additional one for ftrace_regs_caller */ + relocs++; +#endif #endif pr_debug ("Looks like a total of %lu stubs, max\n" , relocs);
@@ -765,7 +769,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,* via the paca (in r13). The target (ftrace_caller()) is responsible for * saving and restoring the toc before returning. */ -static unsigned long create_ftrace_stub (const Elf64_Shdr *sechdrs,struct module *me) +static unsigned long create_ftrace_stub (const Elf64_Shdr *sechdrs, +struct module *me,unsigned long addr) {struct ppc64_stub_entry *entry;unsigned int i, num_stubs;
@@ -792,9 +797,10 @@ static unsigned long create_ftrace_stub(const Elf64_Shdr *sechdrs, struct modulememcpy (entry->jump, stub_insns,sizeof (stub_insns));/* Stub uses address relative to kernel toc (from the paca) */ - reladdr = (unsigned long )ftrace_caller -kernel_toc_addr (); + reladdr = addr -kernel_toc_addr ();if (reladdr >0x7FFFFFFF || reladdr < -(0x80000000L )) { -pr_err ("%s: Address of ftrace_caller out of range of kernel_toc.\n" , me->name); +pr_err ("%s: Address of %ps out of range of kernel_toc.\n" , + me->name, (void *)addr);return 0 ; }
@@ -802,22 +808,30 @@ static unsigned long create_ftrace_stub(const Elf64_Shdr *sechdrs, struct module entry->jump[2 ] |=PPC_LO (reladdr);/* Eventhough we don't use funcdata in the stub, it's needed elsewhere. */ - entry->funcdata =func_desc ((unsigned long )ftrace_caller); + entry->funcdata =func_desc (addr); entry->magic =STUB_MAGIC ;return (unsigned long )entry; }#else -static unsigned long create_ftrace_stub (const Elf64_Shdr *sechdrs,struct module *me) +static unsigned long create_ftrace_stub (const Elf64_Shdr *sechdrs, +struct module *me,unsigned long addr) { -return stub_for_addr (sechdrs, (unsigned long )ftrace_caller, me); +return stub_for_addr (sechdrs, addr, me); }#endif 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); +if (!mod->arch.tramp_regs) +return -ENOENT ; +#endif if (!mod->arch.tramp)return -ENOENT ;
arch/powerpc/kernel/trace/ftrace.c +172 -12
223 lines not on this page · raw message
arch/powerpc/kernel/trace/ftrace_64_mprofile.S +66 -5
101 lines not on this page · raw message
Signature · 1 line
2.16.2