tracing: Remove access to trace_flags in trace_printk.c

In the effort to move the global trace_flags to the tracing instances, the
direct access to trace_flags must be removed from trace_printk.c

Instead, add a new trace_printk_enabled boolean that is set by a new access
function trace_printk_control(), that will enable or disable trace_printk.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (Red Hat) 2015-09-29 18:21:35 -04:00 committed by Steven Rostedt
parent b5e87c0581
commit b9f9108cad
3 changed files with 14 additions and 5 deletions

View File

@ -3555,8 +3555,10 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)
#endif #endif
} }
if (mask == TRACE_ITER_PRINTK) if (mask == TRACE_ITER_PRINTK) {
trace_printk_start_stop_comm(enabled); trace_printk_start_stop_comm(enabled);
trace_printk_control(enabled);
}
return 0; return 0;
} }

View File

@ -1318,6 +1318,7 @@ extern const char *__stop___trace_bprintk_fmt[];
extern const char *__start___tracepoint_str[]; extern const char *__start___tracepoint_str[];
extern const char *__stop___tracepoint_str[]; extern const char *__stop___tracepoint_str[];
void trace_printk_control(bool enabled);
void trace_printk_init_buffers(void); void trace_printk_init_buffers(void);
void trace_printk_start_comm(void); void trace_printk_start_comm(void);
int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set); int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set);

View File

@ -178,6 +178,12 @@ static inline void format_mod_start(void) { }
static inline void format_mod_stop(void) { } static inline void format_mod_stop(void) { }
#endif /* CONFIG_MODULES */ #endif /* CONFIG_MODULES */
static bool __read_mostly trace_printk_enabled = true;
void trace_printk_control(bool enabled)
{
trace_printk_enabled = enabled;
}
__initdata_or_module static __initdata_or_module static
struct notifier_block module_trace_bprintk_format_nb = { struct notifier_block module_trace_bprintk_format_nb = {
@ -192,7 +198,7 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...)
if (unlikely(!fmt)) if (unlikely(!fmt))
return 0; return 0;
if (!(trace_flags & TRACE_ITER_PRINTK)) if (!trace_printk_enabled)
return 0; return 0;
va_start(ap, fmt); va_start(ap, fmt);
@ -207,7 +213,7 @@ int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap)
if (unlikely(!fmt)) if (unlikely(!fmt))
return 0; return 0;
if (!(trace_flags & TRACE_ITER_PRINTK)) if (!trace_printk_enabled)
return 0; return 0;
return trace_vbprintk(ip, fmt, ap); return trace_vbprintk(ip, fmt, ap);
@ -219,7 +225,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...)
int ret; int ret;
va_list ap; va_list ap;
if (!(trace_flags & TRACE_ITER_PRINTK)) if (!trace_printk_enabled)
return 0; return 0;
va_start(ap, fmt); va_start(ap, fmt);
@ -231,7 +237,7 @@ EXPORT_SYMBOL_GPL(__trace_printk);
int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap)
{ {
if (!(trace_flags & TRACE_ITER_PRINTK)) if (!trace_printk_enabled)
return 0; return 0;
return trace_vprintk(ip, fmt, ap); return trace_vprintk(ip, fmt, ap);