Commit 729358da authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Only create function graph options when it is compiled in

Do not create fuction graph tracer options when function graph tracer is not
even compiled in.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent a3418a36
...@@ -489,10 +489,13 @@ static inline void ftrace_trace_stack(struct ring_buffer *buffer, ...@@ -489,10 +489,13 @@ static inline void ftrace_trace_stack(struct ring_buffer *buffer,
#endif #endif
/* trace_flags holds trace_options default values */ /* trace_flags holds trace_options default values */
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK | unsigned long trace_flags =
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME | FUNCTION_GRAPH_DEFAULT_FLAGS |
TRACE_ITER_GRAPH_TIME | TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE | TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS | TRACE_ITER_FUNCTION; TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO |
TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS | TRACE_ITER_FUNCTION
;
static void tracer_tracing_on(struct trace_array *tr) static void tracer_tracing_on(struct trace_array *tr)
{ {
......
...@@ -879,6 +879,22 @@ extern void trace_parser_put(struct trace_parser *parser); ...@@ -879,6 +879,22 @@ extern void trace_parser_put(struct trace_parser *parser);
extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
size_t cnt, loff_t *ppos); size_t cnt, loff_t *ppos);
/*
* Only create function graph options if function graph is configured.
*/
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
# define FGRAPH_FLAGS \
C(SLEEP_TIME, "sleep-time"), \
C(GRAPH_TIME, "graph-time"), \
C(DISPLAY_GRAPH, "display-graph"),
/* Initially set for trace_flags */
# define FUNCTION_GRAPH_DEFAULT_FLAGS \
(TRACE_ITER_SLEEP_TIME | TRACE_ITER_GRAPH_TIME)
#else
# define FGRAPH_FLAGS
# define FUNCTION_GRAPH_DEFAULT_FLAGS 0UL
#endif
/* /*
* trace_iterator_flags is an enumeration that defines bit * trace_iterator_flags is an enumeration that defines bit
* positions into trace_flags that controls the output. * positions into trace_flags that controls the output.
...@@ -904,15 +920,13 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, ...@@ -904,15 +920,13 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
C(PRINTK_MSGONLY, "printk-msg-only"), \ C(PRINTK_MSGONLY, "printk-msg-only"), \
C(CONTEXT_INFO, "context-info"), /* Print pid/cpu/time */ \ C(CONTEXT_INFO, "context-info"), /* Print pid/cpu/time */ \
C(LATENCY_FMT, "latency-format"), \ C(LATENCY_FMT, "latency-format"), \
C(SLEEP_TIME, "sleep-time"), \
C(GRAPH_TIME, "graph-time"), \
C(RECORD_CMD, "record-cmd"), \ C(RECORD_CMD, "record-cmd"), \
C(OVERWRITE, "overwrite"), \ C(OVERWRITE, "overwrite"), \
C(STOP_ON_FREE, "disable_on_free"), \ C(STOP_ON_FREE, "disable_on_free"), \
C(IRQ_INFO, "irq-info"), \ C(IRQ_INFO, "irq-info"), \
C(MARKERS, "markers"), \ C(MARKERS, "markers"), \
C(FUNCTION, "function-trace"), \ C(FUNCTION, "function-trace"), \
C(DISPLAY_GRAPH, "display-graph"), FGRAPH_FLAGS
/* /*
* By defining C, we can make TRACE_FLAGS a list of bit names * By defining C, we can make TRACE_FLAGS a list of bit names
......
...@@ -57,15 +57,15 @@ irq_trace(void) ...@@ -57,15 +57,15 @@ irq_trace(void)
# define irq_trace() (0) # define irq_trace() (0)
#endif #endif
#define is_graph() (trace_flags & TRACE_ITER_DISPLAY_GRAPH)
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static int irqsoff_display_graph(struct trace_array *tr, int set); static int irqsoff_display_graph(struct trace_array *tr, int set);
# define is_graph() (trace_flags & TRACE_ITER_DISPLAY_GRAPH)
#else #else
static inline int irqsoff_display_graph(struct trace_array *tr, int set) static inline int irqsoff_display_graph(struct trace_array *tr, int set)
{ {
return -EINVAL; return -EINVAL;
} }
# define is_graph() false
#endif #endif
/* /*
...@@ -556,8 +556,10 @@ static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set) ...@@ -556,8 +556,10 @@ static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set)
if (mask & TRACE_ITER_FUNCTION) if (mask & TRACE_ITER_FUNCTION)
return irqsoff_function_set(tr, set); return irqsoff_function_set(tr, set);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
if (mask & TRACE_ITER_DISPLAY_GRAPH) if (mask & TRACE_ITER_DISPLAY_GRAPH)
return irqsoff_display_graph(tr, set); return irqsoff_display_graph(tr, set);
#endif
return trace_keep_overwrite(tracer, mask, set); return trace_keep_overwrite(tracer, mask, set);
} }
......
...@@ -40,15 +40,15 @@ static void wakeup_graph_return(struct ftrace_graph_ret *trace); ...@@ -40,15 +40,15 @@ static void wakeup_graph_return(struct ftrace_graph_ret *trace);
static int save_flags; static int save_flags;
static bool function_enabled; static bool function_enabled;
#define is_graph() (trace_flags & TRACE_ITER_DISPLAY_GRAPH)
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static int wakeup_display_graph(struct trace_array *tr, int set); static int wakeup_display_graph(struct trace_array *tr, int set);
# define is_graph() (trace_flags & TRACE_ITER_DISPLAY_GRAPH)
#else #else
static inline int wakeup_display_graph(struct trace_array *tr, int set) static inline int wakeup_display_graph(struct trace_array *tr, int set)
{ {
return -EINVAL; return -EINVAL;
} }
# define is_graph() false
#endif #endif
...@@ -174,8 +174,10 @@ static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set) ...@@ -174,8 +174,10 @@ static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set)
if (mask & TRACE_ITER_FUNCTION) if (mask & TRACE_ITER_FUNCTION)
return wakeup_function_set(tr, set); return wakeup_function_set(tr, set);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
if (mask & TRACE_ITER_DISPLAY_GRAPH) if (mask & TRACE_ITER_DISPLAY_GRAPH)
return wakeup_display_graph(tr, set); return wakeup_display_graph(tr, set);
#endif
return trace_keep_overwrite(tracer, mask, set); return trace_keep_overwrite(tracer, mask, set);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment