linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] panic: use error_report_end tracepoint on warnings
@ 2021-11-15  8:56 Marco Elver
  2021-11-15 14:38 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Elver @ 2021-11-15  8:56 UTC (permalink / raw)
  To: elver
  Cc: Steven Rostedt, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, Andy Shevchenko, linux-kernel,
	kasan-dev, Alexander Popov

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.

Signed-off-by: Marco Elver <elver@google.com>
---
 include/trace/events/error_report.h | 8 +++++---
 kernel/panic.c                      | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/error_report.h b/include/trace/events/error_report.h
index 96f64bf218b2..ed0164f8e79c 100644
--- a/include/trace/events/error_report.h
+++ b/include/trace/events/error_report.h
@@ -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
diff --git a/kernel/panic.c b/kernel/panic.c
index cefd7d82366f..8e299cae1615 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -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);
-- 
2.34.0.rc1.387.gb447b232ab-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] panic: use error_report_end tracepoint on warnings
  2021-11-15  8:56 [PATCH] panic: use error_report_end tracepoint on warnings Marco Elver
@ 2021-11-15 14:38 ` Andy Shevchenko
  2021-11-15 14:40   ` Marco Elver
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-11-15 14:38 UTC (permalink / raw)
  To: Marco Elver
  Cc: Steven Rostedt, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, linux-kernel, kasan-dev,
	Alexander Popov

On Mon, Nov 15, 2021 at 09:56:30AM +0100, Marco Elver wrote:
> 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.

...

>  enum error_detector {
>  	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.

>  };

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] panic: use error_report_end tracepoint on warnings
  2021-11-15 14:38 ` Andy Shevchenko
@ 2021-11-15 14:40   ` Marco Elver
  2021-11-15 14:55     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Elver @ 2021-11-15 14:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Steven Rostedt, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, linux-kernel, kasan-dev,
	Alexander Popov

On Mon, 15 Nov 2021 at 15:38, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Nov 15, 2021 at 09:56:30AM +0100, Marco Elver wrote:
> > 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.
>
> ...
>
> >  enum error_detector {
> >       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.

So you want me to add a comma?

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

Thanks,
-- Marco

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] panic: use error_report_end tracepoint on warnings
  2021-11-15 14:40   ` Marco Elver
@ 2021-11-15 14:55     ` Andy Shevchenko
  2021-12-10 23:35       ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-11-15 14:55 UTC (permalink / raw)
  To: Marco Elver
  Cc: Steven Rostedt, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, linux-kernel, kasan-dev,
	Alexander Popov

On Mon, Nov 15, 2021 at 03:40:24PM +0100, Marco Elver wrote:
> On Mon, 15 Nov 2021 at 15:38, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Nov 15, 2021 at 09:56:30AM +0100, Marco Elver wrote:

...

> > >       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.
> 
> So you want me to add a comma?

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

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

Done!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] panic: use error_report_end tracepoint on warnings
  2021-11-15 14:55     ` Andy Shevchenko
@ 2021-12-10 23:35       ` Steven Rostedt
  2021-12-10 23:38         ` Marco Elver
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-12-10 23:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Marco Elver, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, linux-kernel, kasan-dev,
	Alexander Popov

On Mon, 15 Nov 2021 16:55:17 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> > > >       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.  
> > 
> > So you want me to add a comma?  
> 
> Yes. And you see exactly why I'm asking for that.
> 
> > (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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] panic: use error_report_end tracepoint on warnings
  2021-12-10 23:35       ` Steven Rostedt
@ 2021-12-10 23:38         ` Marco Elver
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Elver @ 2021-12-10 23:38 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Andy Shevchenko, Ingo Molnar, Alexander Potapenko, Andrew Morton,
	Petr Mladek, Luis Chamberlain, Wei Liu, Mike Rapoport,
	Arnd Bergmann, John Ogness, linux-kernel, kasan-dev,
	Alexander Popov

On Sat, 11 Dec 2021 at 00:35, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Mon, 15 Nov 2021 16:55:17 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > > > >       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.
> > >
> > > So you want me to add a comma?
> >
> > Yes. And you see exactly why I'm asking for that.
> >
> > > (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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-10 23:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  8:56 [PATCH] panic: use error_report_end tracepoint on warnings Marco Elver
2021-11-15 14:38 ` Andy Shevchenko
2021-11-15 14:40   ` Marco Elver
2021-11-15 14:55     ` Andy Shevchenko
2021-12-10 23:35       ` Steven Rostedt
2021-12-10 23:38         ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).