Skip to content

Commit

Permalink
ftrace: fix dynamic ftrace selftest
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Rostedt authored and Thomas Gleixner committed May 23, 2008
1 parent 06fa75a commit d05cdb2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions kernel/trace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions kernel/trace/trace_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions kernel/trace/trace_selftest_dynamic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "trace.h"

int DYN_FTRACE_TEST_NAME(void)
{
/* used to call mcount */
return 0;
}

0 comments on commit d05cdb2

Please sign in to comment.