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

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 26 13:53:26 UTC 2018


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 at chris-wilson.co.uk>
Cc: Marta Lofstedt <marta.lofstedt at intel.com>
---
 kernel/panic.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 2cfef408fec9..51914dcd1ab8 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 print_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. */
-- 
2.16.2



More information about the Intel-gfx mailing list