Re: [PATCH v5] panic: Avoid the extra noise dmesg

From: Feng Tang
Date: Thu Feb 28 2019 - 23:09:33 EST


Hi Andrew,

Thanks for the review!

On Thu, Feb 28, 2019 at 12:00:14PM -0800, Andrew Morton wrote:
> On Fri, 22 Feb 2019 14:09:59 +0800 Feng Tang <feng.tang@xxxxxxxxx> wrote:
>
> > When kernel panic happens, it will first print the panic call stack,
> > then the ending msg like:
> >
> > [ 35.743249] ---[ end Kernel panic - not syncing: Fatal exception
> > [ 35.749975] ------------[ cut here ]------------
> >
> > The above message are very useful for debugging.
> >
> > But if system is configured to not reboot on panic, say the "panic_timeout"
> > parameter equals 0, it will likely print out many noisy message like
> > WARN() call stack for each and every CPU except the panic one, messages
> > like below:
> >
> > WARNING: CPU: 1 PID: 280 at kernel/sched/core.c:1198 set_task_cpu+0x183/0x190
> > Call Trace:
> > <IRQ>
> > try_to_wake_up
> > default_wake_function
> > autoremove_wake_function
> > __wake_up_common
> > __wake_up_common_lock
> > __wake_up
> > wake_up_klogd_work_func
> > irq_work_run_list
> > irq_work_tick
> > update_process_times
> > tick_sched_timer
> > __hrtimer_run_queues
> > hrtimer_interrupt
> > smp_apic_timer_interrupt
> > apic_timer_interrupt
>
> It's a fairly ugly-looking patch but I am inclined to agree.

Yes, it's ugly :) we've changed 3 methods to tackle this.

> The panicing CPU is spinning and blinking a LED and all CPUs have
> interrupts enabled and the system is known to be in a messed up state.
> All sorts of kernel code could emit all sorts of output in such
> circumstances. So a global printk-killing knob seems appropriate.
>
> Thoughts:
>
> - why do the suppression in vprintk_emit()? Doing it right at entry
> to printk() seems cleaner, more explicit?

Yes, I put it in printk() in one earlier post, and Petr suggested to
put it into vprintk_emit so that it works for all printk() interfaces,
like the devkmsg_write -> printk_emit -> vprintk_emit path.

>
> - Other code sites may wish to suppress all printks. Perhaps
> `panic_suppress_printk' should just be called `suppress_printk'?
Ok, then I'll move the definition from panic.c to printk code.

Thanks,
Feng