Re: [PATCH v2 2/3] printk: console_flush_one_record() code cleanup
From: Petr Mladek
Date: Fri Oct 03 2025 - 12:19:37 EST
On Thu 2025-10-02 12:10:50, Petr Mladek wrote:
> On Wed 2025-10-01 17:26:27, Andrew Murray wrote:
> > On Wed, 1 Oct 2025 at 10:53, John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
> > >
> > > On 2025-09-30, Andrew Murray <amurray@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > > Alternatively, it may be possible for console_flush_one_record to
> > > > return any_usable, thus dropping it as an argument and removing the
> > > > return of any_progress. Instead the caller could keep calling
> > > > console_flush_one_record until it returns false or until next_seq
> > > > stops increasing?
>
> No, this won't work. @next_seq shows the highest value from all
> consoles. It is no longer increased when at least one console
> flushed all pending messages. But other consoles might be
> behind, still having pending messages, and still making progress.
>
> Honestly, I do not know how to make it better. We need to pass
> both information: @next_seq and if some console flushed something.
>
> Note that @next_seq is valid only when all consoles are flushed
> and returning the same @next_seq. But it does not help to remove
> the @any_progress parameter.
I thought more about how to improve the semantic and came up with
the following patch. It is supposed to replace this one.
Note: I created this patch on top of Linus' tree as of today.
It already includes the patchset (-mm tree) which consolidated
the panic state API.
Namely, this patchset is affected by the commit d4a36db5639db03
("panic/printk: replace other_cpu_in_panic() with
panic_on_other_cpu()").
It is enough to do:
s/other_cpu_in_panic/panic_on_other_cpu/
I am sorry for any inconvenience.
Here is the new proposal: