From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>,
Andrew Murray <amurray@thegoodpenguin.co.uk>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] printk: console_flush_one_record() code cleanup
Date: Wed, 08 Oct 2025 18:12:25 +0206 [thread overview]
Message-ID: <847bx5peda.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <aN_3id2CF7ivC42R@pathway.suse.cz>
On 2025-10-03, Petr Mladek <pmladek@suse.com> wrote:
> From 30f5302b11962f8ec961ca85419ed097a5b76502 Mon Sep 17 00:00:00 2001
> From: Petr Mladek <pmladek@suse.com>
> Date: Sat, 27 Sep 2025 23:05:36 +0100
> Subject: [PATCH 2/3] printk: console_flush_one_record() code cleanup
>
> console_flush_one_record() and console_flush_all() duplicate several
> checks. They both want to tell the caller that consoles are not
> longer usable in this context because it has lost the lock or
> the lock has to be reserved for the panic CPU.
>
> Remove the duplication by changing the semantic of the function
> console_flush_one_record() return value and parameters.
>
> The function will return true when it is able to do the job. It means
> that there is at least one usable console. And the flushing was
> not interrupted by a takeover or panic_on_other_cpu().
>
> Also replace the @any_usable parameter with @try_again. The @try_again
> parameter will be set to true when the function could do the job
> and at least one console made a progress.
>
> Motivation:
>
> The callers need to know when
>
> + they should continue flushing => @try_again
> + when the console is flushed => can_do_the_job(return) && !@try_again
> + when @next_seq is valid => same as flushed
> + when lost console_lock => @takeover
>
> The proposed change makes it clear when the function can do
> the job. It simplifies the answer for the other questions.
>
> Also the return value from console_flush_one_record() can
> be used as return value from console_flush_all().
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
next prev parent reply other threads:[~2025-10-08 16:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 22:05 [PATCH v2 0/3] printk: Release console_lock between printing records in legacy thread Andrew Murray
2025-09-27 22:05 ` [PATCH v2 1/3] printk: Introduce console_flush_one_record Andrew Murray
2025-09-30 12:54 ` John Ogness
2025-09-30 13:21 ` Andrew Murray
2025-10-03 13:29 ` Petr Mladek
2025-09-27 22:05 ` [PATCH v2 2/3] printk: console_flush_one_record() code cleanup Andrew Murray
2025-09-30 12:59 ` John Ogness
2025-09-30 15:14 ` Andrew Murray
2025-10-01 9:53 ` John Ogness
2025-10-01 16:26 ` Andrew Murray
2025-10-02 10:10 ` Petr Mladek
2025-10-03 16:19 ` Petr Mladek
2025-10-08 16:06 ` John Ogness [this message]
2025-09-27 22:05 ` [PATCH v2 3/3] printk: Use console_flush_one_record for legacy printer kthread Andrew Murray
2025-09-30 13:03 ` John Ogness
2025-09-30 13:20 ` Andrew Murray
2025-10-03 16:26 ` Petr Mladek
2025-10-08 16:15 ` John Ogness
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=847bx5peda.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=amurray@thegoodpenguin.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox