diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-02-11 15:45:49 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 18:48:54 -0500 |
commit | bb7253403f7a4670a128e4c080fd8ea1bd4d5029 (patch) | |
tree | f2ee8c966035a67be77fad922ada4c4d52a53be9 /arch/powerpc/kernel/ftrace.c | |
parent | 465428884765b43d642a967915e16c6c7cacbe8e (diff) |
powerpc64, ftrace: save toc only on modules for function graph
The TOCS used by modules are different than the one used by
the core kernel code. The function graph tracer must save and
restore the TOC whenever it traces a module call. But this
is an added overhead to burden the majority of core kernel
code being traced.
Benjamin Herrenschmidt suggested in testing the entry of
the call to tell if it is a core kernel function or a module.
He recommended using the REGION_ID() macro to perform this test.
This patch implements Benjamin's idea, and uses a different
return_to_handler routine dependent on if the entry is a core
kernel function or not. The module version saves the TOC, where as
the core kernel version does not.
Geoff Lavand tested on PS3.
Tested-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/ftrace.c')
-rw-r--r-- | arch/powerpc/kernel/ftrace.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 7538b944fa52..5c6dfa97e838 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -567,6 +567,10 @@ int ftrace_disable_ftrace_graph_caller(void) | |||
567 | } | 567 | } |
568 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 568 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
569 | 569 | ||
570 | #ifdef CONFIG_PPC64 | ||
571 | extern void mod_return_to_handler(void); | ||
572 | #endif | ||
573 | |||
570 | /* | 574 | /* |
571 | * Hook the return address and push it in the stack of return addrs | 575 | * Hook the return address and push it in the stack of return addrs |
572 | * in current thread info. | 576 | * in current thread info. |
@@ -577,12 +581,17 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) | |||
577 | unsigned long long calltime; | 581 | unsigned long long calltime; |
578 | int faulted; | 582 | int faulted; |
579 | struct ftrace_graph_ent trace; | 583 | struct ftrace_graph_ent trace; |
580 | unsigned long return_hooker = (unsigned long) | 584 | unsigned long return_hooker = (unsigned long)&return_to_handler; |
581 | &return_to_handler; | ||
582 | 585 | ||
583 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 586 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
584 | return; | 587 | return; |
585 | 588 | ||
589 | #if CONFIG_PPC64 | ||
590 | /* non core kernel code needs to save and restore the TOC */ | ||
591 | if (REGION_ID(self_addr) != KERNEL_REGION_ID) | ||
592 | return_hooker = (unsigned long)&mod_return_to_handler; | ||
593 | #endif | ||
594 | |||
586 | return_hooker = GET_ADDR(return_hooker); | 595 | return_hooker = GET_ADDR(return_hooker); |
587 | 596 | ||
588 | /* | 597 | /* |