Re: [PATCH v3 2/2] Handle flushing of CPU backtraces during panic

From: John Ogness
Date: Mon Aug 19 2024 - 15:23:26 EST


On 2024-08-13, Petr Mladek <pmladek@xxxxxxxx> wrote:
> I would do something like:
>
> /**
> * console_try_or_trigger_flush - try to flush consoles directly when
> * safe or the trigger deferred flush.
> *
> * Context: Any
> */
> void console_try_or_trigger_flush(void)
> {
> if (!is_printk_legacy_deferred() && console_trylock())
> console_unlock();
> else
> defer_console_output();
> }
>
> and use it instead of printk_trigger_flush() in
> nmi_trigger_cpumask_backtrace().

Just to be clear, you are talking about removing printk_trigger_flush()
entirely and instead provide the new console_try_or_trigger_flush()?
Which then also involves updating the call sites:

lib/nmi_backtrace.c:nmi_trigger_cpumask_backtrace()
arch/powerpc/kernel/watchdog.c:watchdog_timer_interrupt()

> Well, I would postpone this patch after we finalize the patchset
> adding con->write_atomic() callback. This patch depends on it anyway
> via is_printk_legacy_deferred(). The patchset might also add
> other wrappers for flushing consoles and we have to choose some
> reasonable names.

I agree. Let's finish up the atomic series and then we can worry about
this.

John