Skip to contentSkip to conversation

panic: use error_report_end tracepoint on warnings

PATCH Applied Marco Elver 3 participants 6 messages Nov 15, 2021 – Dec 10, 2021 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 include/trace/events/error_report.h | 8 +++++---
 kernel/panic.c                      | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)
include/trace/events/error_report.h +5 -3
index 96f64bf218b2..ed0164f8e79c 100644
@@ -17,14 +17,16 @@
 
 enum error_detector {
 	ERROR_DETECTOR_KFENCE,
-	ERROR_DETECTOR_KASAN
+	ERROR_DETECTOR_KASAN,
+	ERROR_DETECTOR_WARN
 };
 
 #endif /* __ERROR_REPORT_DECLARE_TRACE_ENUMS_ONCE_ONLY */
 
-#define error_detector_list	\
+#define error_detector_list			\
 	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. */
 
 #undef EM
kernel/panic.c +2 -0
index cefd7d82366f..8e299cae1615 100644
@@ -32,6 +32,7 @@
 #include <linux/bug.h>
 #include <linux/ratelimit.h>
 #include <linux/debugfs.h>
+#include <trace/events/error_report.h>
 #include <asm/sections.h>
 
 #define PANIC_TIMER_STEP 100
@@ -609,6 +610,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 	print_irqtrace_events(current);
 
 	print_oops_end_marker();
+	trace_error_report_end(ERROR_DETECTOR_WARN, (unsigned long)caller);
 
 	/* Just a warning, don't kill lockdep. */
 	add_taint(taint, LOCKDEP_STILL_OK);
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#1 lore raw
Quoted 5 lines · Marco Elver

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.

...

include/trace/events/error_report.h line 21

Quoted 5 lines

enum error_detector {

include/trace/events/error_report.h +2 -1
 	ERROR_DETECTOR_KFENCE,
-	ERROR_DETECTOR_KASAN
+	ERROR_DETECTOR_KASAN,
+	ERROR_DETECTOR_WARN

...which exactly shows my point (given many times somewhere else) why comma is good to have when we are not sure the item is a terminator one in the enum or array of elements.

Quoted 1 line

};

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 16 lines · Andy Shevchenko
Quoted 5 lines · Marco Elver

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.

...

include/trace/events/error_report.h line 21

Quoted 5 lines

enum error_detector {
ERROR_DETECTOR_KFENCE,

include/trace/events/error_report.h +2 -1
-     ERROR_DETECTOR_KASAN
+     ERROR_DETECTOR_KASAN,
+     ERROR_DETECTOR_WARN
Quoted 3 lines

...which exactly shows my point (given many times somewhere else) why comma is good to have when we are not sure the item is a terminator one in the enum or array of elements.

So you want me to add a comma?

(I'm not participating in bikeshedding here, just tell me what to do.)

Thanks,
-- Marco

#3 lore raw
Quoted 3 lines · Marco Elver
Quoted 1 line · Andy Shevchenko

On Mon, Nov 15, 2021 at 09:56:30AM +0100, Marco Elver wrote:

...

Quoted 10 lines
Quoted 8 lines

include/trace/events/error_report.h line 21

Quoted 4 lines

ERROR_DETECTOR_KFENCE,

include/trace/events/error_report.h +2 -1
-     ERROR_DETECTOR_KASAN
+     ERROR_DETECTOR_KASAN,
+     ERROR_DETECTOR_WARN

...which exactly shows my point (given many times somewhere else) why comma is good to have when we are not sure the item is a terminator one in the enum or array of elements.

So you want me to add a comma?

Yes. And you see exactly why I'm asking for that.

Quoted 1 line

(I'm not participating in bikeshedding here, just tell me what to do.)

Done!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw
Quoted 9 lines · On Mon, 15 Nov 2021 16:55:17 +0200 Andy Shevchenko…
Quoted 9 lines
Quoted 8 lines

include/trace/events/error_report.h line 21

Quoted 4 lines

ERROR_DETECTOR_KFENCE,

include/trace/events/error_report.h +2 -1
-     ERROR_DETECTOR_KASAN
+     ERROR_DETECTOR_KASAN,
+     ERROR_DETECTOR_WARN  

...which exactly shows my point (given many times somewhere else) why comma is good to have when we are not sure the item is a terminator one in the enum or array of elements.

Quoted 7 lines
Quoted 1 line

So you want me to add a comma?

Yes. And you see exactly why I'm asking for that.

Quoted 1 line

(I'm not participating in bikeshedding here, just tell me what to do.)

Done!

Is there going to be another patch set? Or did I miss it?

-- Steve

#5 lore raw
Quoted 15 lines · Steven Rostedt
Quoted 11 lines · On Mon, 15 Nov 2021 16:55:17 +0200 Andy Shevchenko…
Quoted 10 lines
Quoted 8 lines

include/trace/events/error_report.h line 21

Quoted 4 lines

ERROR_DETECTOR_KFENCE,

include/trace/events/error_report.h +2 -1
-     ERROR_DETECTOR_KASAN
+     ERROR_DETECTOR_KASAN,
+     ERROR_DETECTOR_WARN

...which exactly shows my point (given many times somewhere else) why comma is good to have when we are not sure the item is a terminator one in the enum or array of elements.

So you want me to add a comma?

Quoted 7 lines
Quoted 5 lines

Yes. And you see exactly why I'm asking for that.

Quoted 1 line

(I'm not participating in bikeshedding here, just tell me what to do.)

Done!

Is there going to be another patch set? Or did I miss it?

Andrew was kind enough to fix it up for me. :-)
It's already in -mm:
https://www.spinics.net/lists/mm-commits/msg161488.html
https://www.spinics.net/lists/mm-commits/msg161487.html

Thanks,
-- Marco