diff options
-rw-r--r-- | kernel/trace/Makefile | 4 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_selftest.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_selftest_dynamic.c | 7 |
4 files changed, 13 insertions, 6 deletions
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index c25a6cd6a529..d9efbbfa2bdf 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile | |||
@@ -4,6 +4,10 @@ | |||
4 | ifdef CONFIG_FTRACE | 4 | ifdef CONFIG_FTRACE |
5 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | 5 | ORIG_CFLAGS := $(KBUILD_CFLAGS) |
6 | KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) | 6 | KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS)) |
7 | |||
8 | # selftest needs instrumentation | ||
9 | CFLAGS_trace_selftest_dynamic.o = -pg | ||
10 | obj-y += trace_selftest_dynamic.o | ||
7 | endif | 11 | endif |
8 | 12 | ||
9 | obj-$(CONFIG_FTRACE) += libftrace.o | 13 | obj-$(CONFIG_FTRACE) += libftrace.o |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 96951a8d09a4..98cbfd05d754 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -244,6 +244,8 @@ extern int unregister_tracer_switch(struct tracer_switch_ops *ops); | |||
244 | 244 | ||
245 | #ifdef CONFIG_DYNAMIC_FTRACE | 245 | #ifdef CONFIG_DYNAMIC_FTRACE |
246 | extern unsigned long ftrace_update_tot_cnt; | 246 | extern unsigned long ftrace_update_tot_cnt; |
247 | #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func | ||
248 | extern int DYN_FTRACE_TEST_NAME(void); | ||
247 | #endif | 249 | #endif |
248 | 250 | ||
249 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 251 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index 92f4acb7740c..83e55a2000cc 100644 --- a/kernel/trace/trace_selftest.c +++ b/kernel/trace/trace_selftest.c | |||
@@ -107,14 +107,8 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count) | |||
107 | 107 | ||
108 | #ifdef CONFIG_DYNAMIC_FTRACE | 108 | #ifdef CONFIG_DYNAMIC_FTRACE |
109 | 109 | ||
110 | #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func | ||
111 | #define __STR(x) #x | 110 | #define __STR(x) #x |
112 | #define STR(x) __STR(x) | 111 | #define STR(x) __STR(x) |
113 | static int DYN_FTRACE_TEST_NAME(void) | ||
114 | { | ||
115 | /* used to call mcount */ | ||
116 | return 0; | ||
117 | } | ||
118 | 112 | ||
119 | /* Test dynamic code modification and ftrace filters */ | 113 | /* Test dynamic code modification and ftrace filters */ |
120 | int trace_selftest_startup_dynamic_tracing(struct tracer *trace, | 114 | 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 index 000000000000..54dd77cce5bf --- /dev/null +++ b/kernel/trace/trace_selftest_dynamic.c | |||
@@ -0,0 +1,7 @@ | |||
1 | #include "trace.h" | ||
2 | |||
3 | int DYN_FTRACE_TEST_NAME(void) | ||
4 | { | ||
5 | /* used to call mcount */ | ||
6 | return 0; | ||
7 | } | ||