lkml.org 
[lkml]   [2022]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V6] panic: Move panic_print before kmsg dumpers
On Fri 2022-02-25 14:18:22, Sergey Senozhatsky wrote:
> IOW move console_flush_on_panic() handling out of panic_print_sys_info().
> console_flush_on_panic() isn't really related to "print sys info" stuff
> that panic_print_sys_info() does.
>
> Something like this may be:
>
> static void panic_print_sys_info(void)
> {
> - if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
> - console_flush_on_panic(CONSOLE_REPLAY_ALL);
> -
> if (panic_print & PANIC_PRINT_ALL_CPU_BT)
> trigger_all_cpu_backtrace();
>
> @@ -196,6 +193,23 @@ static void panic_print_sys_info(void)
> ftrace_dump(DUMP_ALL);
> }
>
> +static void panic_console_flush(void)
> +{
> + /*
> + * We may have ended up stopping the CPU holding the lock (in
> + * smp_send_stop()) while still having some valuable data in the console
> + * buffer. Try to acquire the lock then release it regardless of the
> + * result. The release will also print the buffers out. Locks debug
> + * should be disabled to avoid reporting bad unlock balance when
> + * panic() is not being callled from OOPS.
> + */
> + debug_locks_off();
> + if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
> + console_flush_on_panic(CONSOLE_REPLAY_ALL);
> + else
> + console_flush_on_panic(CONSOLE_FLUSH_PENDING);
> +}
> +
> /**
> * panic - halt the system
> * @fmt: The text string to print
> @@ -329,17 +343,7 @@ void panic(const char *fmt, ...)
> #endif
> console_unblank();
>
> - /*
> - * We may have ended up stopping the CPU holding the lock (in
> - * smp_send_stop()) while still having some valuable data in the console
> - * buffer. Try to acquire the lock then release it regardless of the
> - * result. The release will also print the buffers out. Locks debug
> - * should be disabled to avoid reporting bad unlock balance when
> - * panic() is not being callled from OOPS.
> - */
> - debug_locks_off();
> - console_flush_on_panic(CONSOLE_FLUSH_PENDING);
> -
> + panic_console_flush();
> panic_print_sys_info();
>
> if (!panic_blink)

The result looks good to me. We could do it as a followup patch.

Best Regards,
Petr

\
 
 \ /
  Last update: 2022-02-25 13:17    [W:0.147 / U:1.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site