* [PATCH 0/2] [GIT PULL] powerpc/ftrace: linker fixes
@ 2009-10-14 3:02 Steven Rostedt
2009-10-14 3:02 ` [PATCH 1/2] [PATCH 1/2] powerpc/ftrace: show real return addresses in modules Steven Rostedt
2009-10-14 3:02 ` [PATCH 2/2] [PATCH 2/2] powerpc64/ftrace: use PACA to retrieve TOC in mod_return_to_handler Steven Rostedt
0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2009-10-14 3:02 UTC (permalink / raw)
To: linux-kernel; +Cc: Benjamin Herrenschmidt, Andrew Morton
Benjamin,
Please pull the latest ppc/ftrace tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
ppc/ftrace
Steven Rostedt (2):
powerpc/ftrace: show real return addresses in modules
powerpc64/ftrace: use PACA to retrieve TOC in mod_return_to_handler
----
arch/powerpc/kernel/entry_64.S | 3 +--
arch/powerpc/kernel/process.c | 10 +++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/2] [PATCH 1/2] powerpc/ftrace: show real return addresses in modules
2009-10-14 3:02 [PATCH 0/2] [GIT PULL] powerpc/ftrace: linker fixes Steven Rostedt
@ 2009-10-14 3:02 ` Steven Rostedt
2009-10-14 3:02 ` [PATCH 2/2] [PATCH 2/2] powerpc64/ftrace: use PACA to retrieve TOC in mod_return_to_handler Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2009-10-14 3:02 UTC (permalink / raw)
To: linux-kernel; +Cc: Benjamin Herrenschmidt, Andrew Morton
[-- Attachment #1: 0001-powerpc-ftrace-show-real-return-addresses-in-modules.patch --]
[-- Type: text/plain, Size: 1900 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
When the function graph tracer is enabled, it replaces the return address
with a hook back to the tracer. This makes back traces see the hook instead
of the actual return address.
The current code also shows the real address by checking if the return
address jumps to the return_to_handler. If it is, is also prints out
the saved real return address.
On powerpc64, some modules may return to mod_return_to_handler, which
is not checked. This patch will also show the real address if a return
is to mod_return_to_handler as well.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/powerpc/kernel/process.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 1168c5f..2ec1eae 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1016,9 +1016,13 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
int curr_frame = current->curr_ret_stack;
extern void return_to_handler(void);
- unsigned long addr = (unsigned long)return_to_handler;
+ unsigned long rth = (unsigned long)return_to_handler;
+ unsigned long mrth = -1;
#ifdef CONFIG_PPC64
- addr = *(unsigned long*)addr;
+ extern void mod_return_to_handler(void);
+ rth = *(unsigned long *)rth;
+ mrth = (unsigned long)mod_return_to_handler;
+ mrth = *(unsigned long *)mrth;
#endif
#endif
@@ -1044,7 +1048,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
if (!firstframe || ip != lr) {
printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
- if (ip == addr && curr_frame >= 0) {
+ if ((ip == rth || ip == mrth) && curr_frame >= 0) {
printk(" (%pS)",
(void *)current->ret_stack[curr_frame].ret);
curr_frame--;
--
1.6.3.3
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] [PATCH 2/2] powerpc64/ftrace: use PACA to retrieve TOC in mod_return_to_handler
2009-10-14 3:02 [PATCH 0/2] [GIT PULL] powerpc/ftrace: linker fixes Steven Rostedt
2009-10-14 3:02 ` [PATCH 1/2] [PATCH 1/2] powerpc/ftrace: show real return addresses in modules Steven Rostedt
@ 2009-10-14 3:02 ` Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2009-10-14 3:02 UTC (permalink / raw)
To: linux-kernel; +Cc: Benjamin Herrenschmidt, Andrew Morton, Sachin Sant
[-- Attachment #1: 0002-powerpc64-ftrace-use-PACA-to-retrieve-TOC-in-mod_ret.patch --]
[-- Type: text/plain, Size: 1060 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The mod_return_to_handler needs to switch to the kernel TOC before
jumping to a the kernel code. It currently does this by looking
at the kernel function data and retrieves the TOC that way.
Not only is this inefficient, it also breaks with a relocatable kernel.
The PACA contains the kernel TOC and we can easily retrieve it that
way.
Reported-by: Sachin Sant <sachinp@in.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/powerpc/kernel/entry_64.S | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 900e0ee..f9fd54b 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -1038,8 +1038,7 @@ _GLOBAL(mod_return_to_handler)
* We are in a module using the module's TOC.
* Switch to our TOC to run inside the core kernel.
*/
- LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler)
- ld r2, 8(r4)
+ ld r2, PACATOC(r13)
bl .ftrace_return_to_handler
nop
--
1.6.3.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-14 3:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-14 3:02 [PATCH 0/2] [GIT PULL] powerpc/ftrace: linker fixes Steven Rostedt
2009-10-14 3:02 ` [PATCH 1/2] [PATCH 1/2] powerpc/ftrace: show real return addresses in modules Steven Rostedt
2009-10-14 3:02 ` [PATCH 2/2] [PATCH 2/2] powerpc64/ftrace: use PACA to retrieve TOC in mod_return_to_handler Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®