Skip to content

Commit 23b36fe

Browse files
melvertorvalds
authored andcommitted
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.com Signed-off-by: Marco 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 25d2e88 commit 23b36fe

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

include/trace/events/error_report.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@
1717

1818
enum error_detector {
1919
ERROR_DETECTOR_KFENCE,
20-
ERROR_DETECTOR_KASAN
20+
ERROR_DETECTOR_KASAN,
21+
ERROR_DETECTOR_WARN,
2122
};
2223

2324
#endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */
2425

25-
#define error_detector_list \
26+
#define error_detector_list \
2627
EM(ERROR_DETECTOR_KFENCE, "kfence") \
27-
EMe(ERROR_DETECTOR_KASAN, "kasan")
28+
EM(ERROR_DETECTOR_KASAN, "kasan") \
29+
EMe(ERROR_DETECTOR_WARN, "warning")
2830
/* Always end the list with an EMe. */
2931

3032
#undef EM

kernel/panic.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/bug.h>
3333
#include <linux/ratelimit.h>
3434
#include <linux/debugfs.h>
35+
#include <trace/events/error_report.h>
3536
#include <asm/sections.h>
3637

3738
#define PANIC_TIMER_STEP 100
@@ -609,6 +610,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
609610
print_irqtrace_events(current);
610611

611612
print_oops_end_marker();
613+
trace_error_report_end(ERROR_DETECTOR_WARN, (unsigned long)caller);
612614

613615
/* Just a warning, don't kill lockdep. */
614616
add_taint(taint, LOCKDEP_STILL_OK);

0 commit comments

Comments
 (0)