]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ftrace: fix dynamic ftrace selftest
authorSteven Rostedt <rostedt@goodmis.org>
Mon, 12 May 2008 19:20:54 +0000 (21:20 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 23 May 2008 19:13:23 +0000 (21:13 +0200)
With the adding of the configuration changes in the Makefile to prevent
tracing of functions in the ftrace code, all tracing of all the ftrace
code has been removed. Unfortunately, one of the selftests, relied on
a function to be traced. With the new change, the function was no longer
traced and the test failed.

This patch separates out the test function into its own file so that
we can add the "-pg" flag to the compilation of that function and the
adding of the mcount call to that function.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/trace/Makefile
kernel/trace/trace.h
kernel/trace/trace_selftest.c
kernel/trace/trace_selftest_dynamic.c [new file with mode: 0644]

index c25a6cd6a52964f3e3b1a71b048415be6a7805ee..d9efbbfa2bdf721d1ce2634ec4d471fa757b5d3b 100644 (file)
@@ -4,6 +4,10 @@
 ifdef CONFIG_FTRACE
 ORIG_CFLAGS := $(KBUILD_CFLAGS)
 KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
+
+# selftest needs instrumentation
+CFLAGS_trace_selftest_dynamic.o = -pg
+obj-y += trace_selftest_dynamic.o
 endif
 
 obj-$(CONFIG_FTRACE) += libftrace.o
index 96951a8d09a4b3cdf4e27a749d6ec59c4aacfdf4..98cbfd05d75477b92ae58803fcdfa1e2c582f697 100644 (file)
@@ -244,6 +244,8 @@ extern int unregister_tracer_switch(struct tracer_switch_ops *ops);
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 extern unsigned long ftrace_update_tot_cnt;
+#define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func
+extern int DYN_FTRACE_TEST_NAME(void);
 #endif
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
index 92f4acb7740c1c4cbe1f8525fac1a9e4aca9bce2..83e55a2000ccb13e87fd3ebade062384b46704fe 100644 (file)
@@ -107,14 +107,8 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count)
 
 #ifdef CONFIG_DYNAMIC_FTRACE
 
-#define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func
 #define __STR(x) #x
 #define STR(x) __STR(x)
-static int DYN_FTRACE_TEST_NAME(void)
-{
-       /* used to call mcount */
-       return 0;
-}
 
 /* Test dynamic code modification and ftrace filters */
 int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
diff --git a/kernel/trace/trace_selftest_dynamic.c b/kernel/trace/trace_selftest_dynamic.c
new file mode 100644 (file)
index 0000000..54dd77c
--- /dev/null
@@ -0,0 +1,7 @@
+#include "trace.h"
+
+int DYN_FTRACE_TEST_NAME(void)
+{
+       /* used to call mcount */
+       return 0;
+}