powerpc/ftrace: show real return addresses in modules

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>

authored by Steven Rostedt and committed by Steven Rostedt 9135c3cc 80f50691

+7 -3
+7 -3
arch/powerpc/kernel/process.c
··· 1016 1016 #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1017 1017 int curr_frame = current->curr_ret_stack; 1018 1018 extern void return_to_handler(void); 1019 - unsigned long addr = (unsigned long)return_to_handler; 1019 + unsigned long rth = (unsigned long)return_to_handler; 1020 + unsigned long mrth = -1; 1020 1021 #ifdef CONFIG_PPC64 1021 - addr = *(unsigned long*)addr; 1022 + extern void mod_return_to_handler(void); 1023 + rth = *(unsigned long *)rth; 1024 + mrth = (unsigned long)mod_return_to_handler; 1025 + mrth = *(unsigned long *)mrth; 1022 1026 #endif 1023 1027 #endif 1024 1028 ··· 1048 1044 if (!firstframe || ip != lr) { 1049 1045 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); 1050 1046 #ifdef CONFIG_FUNCTION_GRAPH_TRACER 1051 - if (ip == addr && curr_frame >= 0) { 1047 + if ((ip == rth || ip == mrth) && curr_frame >= 0) { 1052 1048 printk(" (%pS)", 1053 1049 (void *)current->ret_stack[curr_frame].ret); 1054 1050 curr_frame--;