diff mbox

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

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

Commit Message

Chris Wilson Feb. 26, 2018, 1:53 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>
---
 kernel/panic.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

Comments

Marta Lofstedt Feb. 26, 2018, 1:59 p.m. UTC | #1
Seems like a good idea to me.

+Mika

> -----Original Message-----
> From: Chris Wilson [mailto:chris@chris-wilson.co.uk]
> Sent: Monday, February 26, 2018 3:53 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Chris Wilson <chris@chris-wilson.co.uk>; Lofstedt, Marta
> <marta.lofstedt@intel.com>
> Subject: [RFC] kernel/panic: Repeat the line and caller information at the end
> of the OOPS
> 
> 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>
> ---
>  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
diff mbox

Patch

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. */