提交 23b36fec 编写于 作者: M Marco Elver 提交者: Linus Torvalds

panic: use error_report_end tracepoint on warnings

Introduce the error detector "warning" to the error_report event and use
the error_report_end tracepoint at the end of a warning report.

This allows in-kernel tests but also userspace to more easily determine
if a warning occurred without polling kernel logs.

[akpm@linux-foundation.org: add comma to enum list, per Andy]

Link: https://lkml.kernel.org/r/20211115085630.1756817-1-elver@google.comSigned-off-by: NMarco Elver <elver@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Alexander Popov <alex.popov@linux.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 25d2e886
...@@ -17,14 +17,16 @@ ...@@ -17,14 +17,16 @@
enum error_detector { enum error_detector {
ERROR_DETECTOR_KFENCE, ERROR_DETECTOR_KFENCE,
ERROR_DETECTOR_KASAN ERROR_DETECTOR_KASAN,
ERROR_DETECTOR_WARN,
}; };
#endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */ #endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */
#define error_detector_list \ #define error_detector_list \
EM(ERROR_DETECTOR_KFENCE, "kfence") \ EM(ERROR_DETECTOR_KFENCE, "kfence") \
EMe(ERROR_DETECTOR_KASAN, "kasan") EM(ERROR_DETECTOR_KASAN, "kasan") \
EMe(ERROR_DETECTOR_WARN, "warning")
/* Always end the list with an EMe. */ /* Always end the list with an EMe. */
#undef EM #undef EM
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <trace/events/error_report.h>
#include <asm/sections.h> #include <asm/sections.h>
#define PANIC_TIMER_STEP 100 #define PANIC_TIMER_STEP 100
...@@ -609,6 +610,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, ...@@ -609,6 +610,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
print_irqtrace_events(current); print_irqtrace_events(current);
print_oops_end_marker(); print_oops_end_marker();
trace_error_report_end(ERROR_DETECTOR_WARN, (unsigned long)caller);
/* Just a warning, don't kill lockdep. */ /* Just a warning, don't kill lockdep. */
add_taint(taint, LOCKDEP_STILL_OK); add_taint(taint, LOCKDEP_STILL_OK);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册