diff mbox

[RFC] kernel/panic: Repeat the line and caller information at the end of the OOPS

Message ID 20180226142957.6549-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 26, 2018, 2:29 p.m. UTC
For large oops dump, for example if ftrace is included, we can easily
exceed the storage buffer and lose the most important bit of
information: where the OOPS occurred. So repeat the location information
just before the end marker.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
---
git add ftw
-Chris
---
 kernel/panic.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

Comments

Chris Wilson Feb. 27, 2018, 10:50 a.m. UTC | #1
Quoting Chris Wilson (2018-02-26 14:29:56)
> For large oops dump, for example if ftrace is included, we can easily
> exceed the storage buffer and lose the most important bit of
> information: where the OOPS occurred. So repeat the location information
> just before the end marker.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Marta Lofstedt <marta.lofstedt@intel.com>

I've plonked this in topic/core-for-CI to see if it is effective in
helping us nail a few bugs.
-Chris
Marta Lofstedt Feb. 27, 2018, 11:12 a.m. UTC | #2
OK cool I'll look out for it landing, CI_DRM_3838 or CI_DRM_3839 I guess.

> -----Original Message-----

> From: Chris Wilson [mailto:chris@chris-wilson.co.uk]

> Sent: Tuesday, February 27, 2018 12:50 PM

> To: intel-gfx@lists.freedesktop.org

> Cc: Lofstedt, Marta <marta.lofstedt@intel.com>

> Subject: Re: [RFC] kernel/panic: Repeat the line and caller information at the

> end of the OOPS

> 

> Quoting Chris Wilson (2018-02-26 14:29:56)

> > For large oops dump, for example if ftrace is included, we can easily

> > exceed the storage buffer and lose the most important bit of

> > information: where the OOPS occurred. So repeat the location

> > information just before the end marker.

> >

> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

> > Cc: Marta Lofstedt <marta.lofstedt@intel.com>

> 

> I've plonked this in topic/core-for-CI to see if it is effective in helping us nail a

> few bugs.

> -Chris
Chris Wilson Feb. 27, 2018, 8:57 p.m. UTC | #3
Quoting Lofstedt, Marta (2018-02-27 11:12:52)
> OK cool I'll look out for it landing, CI_DRM_3838 or CI_DRM_3839 I guess.

Bah, wrong path. This is only called to handle WARN() and we need the
extra information in BUG(). In fact, the information we need is in a raw
printk and not given to WARN, so we'll have to try a different tack.
-Chris
diff mbox

Patch

diff --git a/kernel/panic.c b/kernel/panic.c
index 2cfef408fec9..9049168d9445 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -517,14 +517,9 @@  struct warn_args {
 	va_list args;
 };
 
-void __warn(const char *file, int line, void *caller, unsigned taint,
-	    struct pt_regs *regs, struct warn_args *args)
+static void show_location(const char *file, int line, void *caller,
+			  struct warn_args *args)
 {
-	disable_trace_on_warning();
-
-	if (args)
-		pr_warn(CUT_HERE);
-
 	if (file)
 		pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
 			raw_smp_processor_id(), current->pid, file, line,
@@ -535,6 +530,17 @@  void __warn(const char *file, int line, void *caller, unsigned taint,
 
 	if (args)
 		vprintk(args->fmt, args->args);
+}
+
+void __warn(const char *file, int line, void *caller, unsigned taint,
+	    struct pt_regs *regs, struct warn_args *args)
+{
+	disable_trace_on_warning();
+
+	if (args)
+		pr_warn(CUT_HERE);
+
+	show_location(file, line, caller, args);
 
 	if (panic_on_warn) {
 		/*
@@ -554,6 +560,8 @@  void __warn(const char *file, int line, void *caller, unsigned taint,
 	else
 		dump_stack();
 
+	show_location(file, line, caller, args);
+
 	print_oops_end_marker();
 
 	/* Just a warning, don't kill lockdep. */