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. [[email protected]: add comma to enum list, per Andy] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Marco Elver <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: Wei Liu <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: John Ogness <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Alexander Popov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 25d2e88 commit 23b36fe

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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)