Hi Petr,

On Thu, Apr 25, 2019 at 01:05:17PM +0200, Petr Mladek wrote:
> On Wed 2019-04-24 16:51:12, Feng Tang wrote:
> > Currently on panic, kernel will lower the loglevel and print out
> > pending printk msg only with console_flush_on_panic().
> > 
> > Add an option for users to configure the "panic_print" to replay
> > all dmesg in buffer, some of which they may have never seen due
> > to the loglevel setting, which will help panic debugging .
> > 
> > diff --git a/kernel/panic.c b/kernel/panic.c
> > index b9f004e..b9c0eb3 100644
> > --- a/kernel/panic.c
> > +++ b/kernel/panic.c
> > @@ -53,6 +53,7 @@ int panic_suppress_printk;
> >  #define PANIC_PRINT_TIMER_INFO             0x00000004
> >  #define PANIC_PRINT_LOCK_INFO              0x00000008
> >  #define PANIC_PRINT_FTRACE_INFO            0x00000010
> > +#define PANIC_PRINT_ALL_PRINTK_MSG 0x00000020
> >  unsigned long panic_print;
> >  
> >  ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
> > @@ -136,6 +137,11 @@ EXPORT_SYMBOL(nmi_panic);
> >  
> >  static void panic_print_sys_info(void)
> >  {
> > +   if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
> > +           console_flush_on_panic(CONSOLE_REPLAY_ALL);
> > +   else
> > +           console_flush_on_panic(CONSOLE_FLUSH_PENDING);
> > +
> >     if (panic_print & PANIC_PRINT_TASK_INFO)
> >             show_state();
> >  
> > @@ -279,8 +285,6 @@ void panic(const char *fmt, ...)
> >      * panic() is not being callled from OOPS.
> >      */
> >     debug_locks_off();
> > -   console_flush_on_panic();
> 
> I would prefer if we keep it here. It is a very important
> operation that plays a role in many panic/printk related
> bugs. We should not hide it in an "unrelated"
> function.
> 
> The name "panic_print_sys_info" suggests that it
> just shows some additional information.
> 
> I guess that you wanted to avoid flushing some messages
> twice. IMHO, it is not a big deal. In many situations,
> console_flush_on_panic(CONSOLE_FLUSH_PENDING) will
> do nothing or it would handle just few lines.

Yes, that was one of my consideration. I got your point
and will send a v4, though Andrew has taken the v3.

> 
> Also people might decide to do a forced reboot when
> the console is slow and it takes ages to print
> everything. Then it might be useful to handle
> the few "most" important lines before starting
> from beginning.
> 
> Other than that I am fine with the patch. I give up
> on bike shedding about the header line ;-)
        :)

Thanks,
Feng

Reply via email to