mirror of https://gitee.com/openkylin/linux.git
tracing: Do not create function tracer options when not compiled in
When the function tracer is not compiled in, do not create the option files for it. Fix up both the sched_wakeup and irqsoff tracers to handle the change. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
4ee4301c4b
commit
8179e8a15b
|
@ -490,11 +490,11 @@ static inline void ftrace_trace_stack(struct ring_buffer *buffer,
|
||||||
|
|
||||||
/* trace_flags holds trace_options default values */
|
/* trace_flags holds trace_options default values */
|
||||||
unsigned long trace_flags =
|
unsigned long trace_flags =
|
||||||
FUNCTION_GRAPH_DEFAULT_FLAGS |
|
FUNCTION_DEFAULT_FLAGS | FUNCTION_GRAPH_DEFAULT_FLAGS |
|
||||||
TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
|
TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
|
||||||
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO |
|
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO |
|
||||||
TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
|
TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |
|
||||||
TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS | TRACE_ITER_FUNCTION
|
TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS
|
||||||
;
|
;
|
||||||
|
|
||||||
static void tracer_tracing_on(struct trace_array *tr)
|
static void tracer_tracing_on(struct trace_array *tr)
|
||||||
|
|
|
@ -902,6 +902,15 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
|
||||||
# define BRANCH_FLAGS
|
# define BRANCH_FLAGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
|
# define FUNCTION_FLAGS \
|
||||||
|
C(FUNCTION, "function-trace"),
|
||||||
|
# define FUNCTION_DEFAULT_FLAGS TRACE_ITER_FUNCTION
|
||||||
|
#else
|
||||||
|
# define FUNCTION_FLAGS
|
||||||
|
# define FUNCTION_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.
|
||||||
|
@ -931,7 +940,7 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
|
||||||
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"), \
|
FUNCTION_FLAGS \
|
||||||
FGRAPH_FLAGS \
|
FGRAPH_FLAGS \
|
||||||
BRANCH_FLAGS
|
BRANCH_FLAGS
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ enum {
|
||||||
static int trace_type __read_mostly;
|
static int trace_type __read_mostly;
|
||||||
|
|
||||||
static int save_flags;
|
static int save_flags;
|
||||||
static bool function_enabled;
|
|
||||||
|
|
||||||
static void stop_irqsoff_tracer(struct trace_array *tr, int graph);
|
static void stop_irqsoff_tracer(struct trace_array *tr, int graph);
|
||||||
static int start_irqsoff_tracer(struct trace_array *tr, int graph);
|
static int start_irqsoff_tracer(struct trace_array *tr, int graph);
|
||||||
|
@ -249,21 +248,23 @@ __trace_function(struct trace_array *tr,
|
||||||
#else
|
#else
|
||||||
#define __trace_function trace_function
|
#define __trace_function trace_function
|
||||||
|
|
||||||
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
static int irqsoff_graph_entry(struct ftrace_graph_ent *trace)
|
static int irqsoff_graph_entry(struct ftrace_graph_ent *trace)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static enum print_line_t irqsoff_print_line(struct trace_iterator *iter)
|
static enum print_line_t irqsoff_print_line(struct trace_iterator *iter)
|
||||||
{
|
{
|
||||||
return TRACE_TYPE_UNHANDLED;
|
return TRACE_TYPE_UNHANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void irqsoff_graph_return(struct ftrace_graph_ret *trace) { }
|
|
||||||
static void irqsoff_trace_open(struct trace_iterator *iter) { }
|
static void irqsoff_trace_open(struct trace_iterator *iter) { }
|
||||||
static void irqsoff_trace_close(struct trace_iterator *iter) { }
|
static void irqsoff_trace_close(struct trace_iterator *iter) { }
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_TRACER
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
|
static void irqsoff_graph_return(struct ftrace_graph_ret *trace) { }
|
||||||
static void irqsoff_print_header(struct seq_file *s)
|
static void irqsoff_print_header(struct seq_file *s)
|
||||||
{
|
{
|
||||||
trace_default_header(s);
|
trace_default_header(s);
|
||||||
|
@ -507,6 +508,9 @@ void trace_preempt_off(unsigned long a0, unsigned long a1)
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PREEMPT_TRACER */
|
#endif /* CONFIG_PREEMPT_TRACER */
|
||||||
|
|
||||||
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
|
static bool function_enabled;
|
||||||
|
|
||||||
static int register_irqsoff_function(struct trace_array *tr, int graph, int set)
|
static int register_irqsoff_function(struct trace_array *tr, int graph, int set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -540,21 +544,35 @@ static void unregister_irqsoff_function(struct trace_array *tr, int graph)
|
||||||
function_enabled = false;
|
function_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int irqsoff_function_set(struct trace_array *tr, int set)
|
static int irqsoff_function_set(struct trace_array *tr, u32 mask, int set)
|
||||||
{
|
{
|
||||||
|
if (!(mask & TRACE_ITER_FUNCTION))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (set)
|
if (set)
|
||||||
register_irqsoff_function(tr, is_graph(), 1);
|
register_irqsoff_function(tr, is_graph(), 1);
|
||||||
else
|
else
|
||||||
unregister_irqsoff_function(tr, is_graph());
|
unregister_irqsoff_function(tr, is_graph());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static int register_irqsoff_function(struct trace_array *tr, int graph, int set)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static void unregister_irqsoff_function(struct trace_array *tr, int graph) { }
|
||||||
|
static inline int irqsoff_function_set(struct trace_array *tr, u32 mask, int set)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_FUNCTION_TRACER */
|
||||||
|
|
||||||
static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set)
|
static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set)
|
||||||
{
|
{
|
||||||
struct tracer *tracer = tr->current_trace;
|
struct tracer *tracer = tr->current_trace;
|
||||||
|
|
||||||
if (mask & TRACE_ITER_FUNCTION)
|
if (irqsoff_function_set(tr, mask, set))
|
||||||
return irqsoff_function_set(tr, set);
|
return 0;
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
if (mask & TRACE_ITER_DISPLAY_GRAPH)
|
if (mask & TRACE_ITER_DISPLAY_GRAPH)
|
||||||
|
|
|
@ -34,11 +34,8 @@ static arch_spinlock_t wakeup_lock =
|
||||||
|
|
||||||
static void wakeup_reset(struct trace_array *tr);
|
static void wakeup_reset(struct trace_array *tr);
|
||||||
static void __wakeup_reset(struct trace_array *tr);
|
static void __wakeup_reset(struct trace_array *tr);
|
||||||
static int wakeup_graph_entry(struct ftrace_graph_ent *trace);
|
|
||||||
static void wakeup_graph_return(struct ftrace_graph_ret *trace);
|
|
||||||
|
|
||||||
static int save_flags;
|
static int save_flags;
|
||||||
static bool function_enabled;
|
|
||||||
|
|
||||||
#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);
|
||||||
|
@ -46,7 +43,7 @@ static int wakeup_display_graph(struct trace_array *tr, int set);
|
||||||
#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 0;
|
||||||
}
|
}
|
||||||
# define is_graph() false
|
# define is_graph() false
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,6 +51,11 @@ static inline int wakeup_display_graph(struct trace_array *tr, int set)
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_TRACER
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
|
|
||||||
|
static int wakeup_graph_entry(struct ftrace_graph_ent *trace);
|
||||||
|
static void wakeup_graph_return(struct ftrace_graph_ret *trace);
|
||||||
|
|
||||||
|
static bool function_enabled;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prologue for the wakeup function tracers.
|
* Prologue for the wakeup function tracers.
|
||||||
*
|
*
|
||||||
|
@ -123,7 +125,6 @@ wakeup_tracer_call(unsigned long ip, unsigned long parent_ip,
|
||||||
atomic_dec(&data->disabled);
|
atomic_dec(&data->disabled);
|
||||||
preempt_enable_notrace();
|
preempt_enable_notrace();
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FUNCTION_TRACER */
|
|
||||||
|
|
||||||
static int register_wakeup_function(struct trace_array *tr, int graph, int set)
|
static int register_wakeup_function(struct trace_array *tr, int graph, int set)
|
||||||
{
|
{
|
||||||
|
@ -158,21 +159,35 @@ static void unregister_wakeup_function(struct trace_array *tr, int graph)
|
||||||
function_enabled = false;
|
function_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wakeup_function_set(struct trace_array *tr, int set)
|
static int wakeup_function_set(struct trace_array *tr, u32 mask, int set)
|
||||||
{
|
{
|
||||||
|
if (!(mask & TRACE_ITER_FUNCTION))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (set)
|
if (set)
|
||||||
register_wakeup_function(tr, is_graph(), 1);
|
register_wakeup_function(tr, is_graph(), 1);
|
||||||
else
|
else
|
||||||
unregister_wakeup_function(tr, is_graph());
|
unregister_wakeup_function(tr, is_graph());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static int register_wakeup_function(struct trace_array *tr, int graph, int set)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static void unregister_wakeup_function(struct trace_array *tr, int graph) { }
|
||||||
|
static int wakeup_function_set(struct trace_array *tr, u32 mask, int set)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_FUNCTION_TRACER */
|
||||||
|
|
||||||
static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set)
|
static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set)
|
||||||
{
|
{
|
||||||
struct tracer *tracer = tr->current_trace;
|
struct tracer *tracer = tr->current_trace;
|
||||||
|
|
||||||
if (mask & TRACE_ITER_FUNCTION)
|
if (wakeup_function_set(tr, mask, set))
|
||||||
return wakeup_function_set(tr, set);
|
return 0;
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
if (mask & TRACE_ITER_DISPLAY_GRAPH)
|
if (mask & TRACE_ITER_DISPLAY_GRAPH)
|
||||||
|
@ -302,21 +317,20 @@ __trace_function(struct trace_array *tr,
|
||||||
#else
|
#else
|
||||||
#define __trace_function trace_function
|
#define __trace_function trace_function
|
||||||
|
|
||||||
static int wakeup_graph_entry(struct ftrace_graph_ent *trace)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum print_line_t wakeup_print_line(struct trace_iterator *iter)
|
static enum print_line_t wakeup_print_line(struct trace_iterator *iter)
|
||||||
{
|
{
|
||||||
return TRACE_TYPE_UNHANDLED;
|
return TRACE_TYPE_UNHANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wakeup_graph_return(struct ftrace_graph_ret *trace) { }
|
|
||||||
static void wakeup_trace_open(struct trace_iterator *iter) { }
|
static void wakeup_trace_open(struct trace_iterator *iter) { }
|
||||||
static void wakeup_trace_close(struct trace_iterator *iter) { }
|
static void wakeup_trace_close(struct trace_iterator *iter) { }
|
||||||
|
|
||||||
#ifdef CONFIG_FUNCTION_TRACER
|
#ifdef CONFIG_FUNCTION_TRACER
|
||||||
|
static int wakeup_graph_entry(struct ftrace_graph_ent *trace)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
static void wakeup_graph_return(struct ftrace_graph_ret *trace) { }
|
||||||
static void wakeup_print_header(struct seq_file *s)
|
static void wakeup_print_header(struct seq_file *s)
|
||||||
{
|
{
|
||||||
trace_default_header(s);
|
trace_default_header(s);
|
||||||
|
|
Loading…
Reference in New Issue