tracing: Only allow trace_array_printk() to be used by instances

To prevent default "trace_printks()" from spamming the top level tracing
ring buffer, only allow trace instances to use trace_array_printk() (which
can be used without the trace_printk() start up warning).

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (VMware) 2020-06-16 14:53:55 -04:00
parent 9ebcfadb06
commit c791cc4b1f

View File

@ -3346,12 +3346,16 @@ int trace_array_printk(struct trace_array *tr,
int ret; int ret;
va_list ap; va_list ap;
if (!(global_trace.trace_flags & TRACE_ITER_PRINTK))
return 0;
if (!tr) if (!tr)
return -ENOENT; return -ENOENT;
/* This is only allowed for created instances */
if (tr == &global_trace)
return 0;
if (!(tr->trace_flags & TRACE_ITER_PRINTK))
return 0;
va_start(ap, fmt); va_start(ap, fmt);
ret = trace_array_vprintk(tr, ip, fmt, ap); ret = trace_array_vprintk(tr, ip, fmt, ap);
va_end(ap); va_end(ap);