ftrace,bug: Improve traceoff_on_warn

While doing some tracing, I found a huge portion of the per-cpu buffer
was taken by printk/serial output because we're disabling the trace far
too late (after printing the CUT string).

Improve matters for architectures that have GENERIC_BUG + _BUG_FLAGS by
killing the tracer in the exception handler before printing anything
much.

Link: https://lkml.kernel.org/r/20200528145240.GF706495@hirez.programming.kicks-ass.net

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Peter Zijlstra 2020-05-28 16:52:40 +02:00 committed by Steven Rostedt (VMware)
parent bea24f766e
commit 58f6e38448
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,7 @@
#include <linux/bug.h>
#include <linux/sched.h>
#include <linux/rculist.h>
#include <linux/ftrace.h>
extern struct bug_entry __start___bug_table[], __stop___bug_table[];
@ -153,6 +154,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
if (!bug)
return BUG_TRAP_TYPE_NONE;
disable_trace_on_warning();
file = NULL;
line = 0;
warning = 0;