ftrace: powerpc clean ups
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 22 May 2008 18:31:07 +0000 (14:31 -0400)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 26 May 2008 20:51:57 +0000 (22:51 +0200)
This patch cleans up the ftrace code in PowerPC based on the comments from
Michael Ellerman.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: proski@gnu.org
Cc: a.p.zijlstra@chello.nl
Cc: Pekka Paalanen <pq@iki.fi>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: linuxppc-dev@ozlabs.org
Cc: Soeren Sandmann Pedersen <sandmann@redhat.com>
Cc: paulus@samba.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/ftrace.c
arch/powerpc/kernel/ppc_ksyms.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/setup_64.c
include/asm-powerpc/ftrace.h [new file with mode: 0644]

index 0e62218..3b1dd29 100644 (file)
@@ -1129,18 +1129,11 @@ _GLOBAL(_mcount)
        stw     r5, 8(r1)
 
        LOAD_REG_ADDR(r5, ftrace_trace_function)
-#if 0
-       mtctr   r3
-       mr      r1, r5
-       bctrl
-#endif
        lwz     r5,0(r5)
-#if 1
+
        mtctr   r5
        bctrl
-#else
-       bl      ftrace_stub
-#endif
+
        nop
 
        lwz     r6, 8(r1)
index 5a4993f..69ed412 100644 (file)
@@ -51,10 +51,16 @@ notrace unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
 {
        static unsigned int op;
 
+       /*
+        * It would be nice to just use create_function_call, but that will
+        * update the code itself. Here we need to just return the
+        * instruction that is going to be modified, without modifying the
+        * code.
+        */
        addr = GET_ADDR(addr);
 
        /* Set to "bl addr" */
-       op = 0x48000001 | (ftrace_calc_offset(ip, addr) & 0x03fffffe);
+       op = 0x48000001 | (ftrace_calc_offset(ip, addr) & 0x03fffffc);
 
        /*
         * No locking needed, this must be called via kstop_machine
index cf6b5a7..4300db5 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/div64.h>
 #include <asm/signal.h>
 #include <asm/dcr.h>
+#include <asm/ftrace.h>
 
 #ifdef CONFIG_PPC32
 extern void transfer_to_handler(void);
@@ -68,6 +69,10 @@ EXPORT_SYMBOL(single_step_exception);
 EXPORT_SYMBOL(sys_sigreturn);
 #endif
 
+#ifdef CONFIG_FTRACE
+EXPORT_SYMBOL(_mcount);
+#endif
+
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strncpy);
 EXPORT_SYMBOL(strcat);
index 22f8e2b..19e8fcb 100644 (file)
 #include <asm/kgdb.h>
 #endif
 
-#ifdef CONFIG_FTRACE
-extern void _mcount(void);
-EXPORT_SYMBOL(_mcount);
-#endif
-
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
 int boot_cpuid;
index 277bf18..098fd96 100644 (file)
@@ -85,11 +85,6 @@ struct ppc64_caches ppc64_caches = {
 };
 EXPORT_SYMBOL_GPL(ppc64_caches);
 
-#ifdef CONFIG_FTRACE
-extern void _mcount(void);
-EXPORT_SYMBOL(_mcount);
-#endif
-
 /*
  * These are used in binfmt_elf.c to put aux entries on the stack
  * for each elf executable being started.
diff --git a/include/asm-powerpc/ftrace.h b/include/asm-powerpc/ftrace.h
new file mode 100644 (file)
index 0000000..b1bfa70
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _ASM_POWERPC_FTRACE
+#define _ASM_POWERPC_FTRACE
+
+extern void _mcount(void);
+
+#endif