The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Doug Anderson" <dianders@chromium.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Marco Felsch" <m.felsch@pengutronix.de>,
	"Yunhui Cui" <cuiyunhui@bytedance.com>
Subject: Re: [PATCH tty] serial: 8250: Ignore flow control on suspend/resume with no_console_suspend
Date: Thu, 09 Jul 2026 11:08:29 +0206	[thread overview]
Message-ID: <87a4s0lemy.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <20260707141032.5074-1-john.ogness@linutronix.de>

On 2026-07-07, sashiko.dev wrote:
>> -	/* Wait up to 1s for flow control if necessary */
>> -	if (uart_console_hwflow_active(&up->port)) {
>> +	/*
>> +	 * Wait up to 1s for flow control if necessary.
>> +	 * When 'no_console_suspend' is active (in the window between
>> +	 * suspend() and resume()), flow control is temporarily ignored
>> +	 * because the canary workaround is not reliable in all situations,
>> +	 * leading to flow control timeouts for every character.
>> +	 */
>> +	if (uart_console_hwflow_active(&up->port) && !up->canary) {
>
> This isn't a bug introduced by this patch, but does this incomplete
> fix still allow flow control timeouts if the UART loses power during
> suspend?

Yes, and this is fine. More below...

> Looking at serial8250_console_write(), if power is lost, the canary is
> successfully matched, the UART is restored, and the canary is cleared
> to 0:
>
> serial8250_console_write() {
>     ...
>     if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) {
>         serial8250_console_restore(up);
>         up->canary = 0;
>     }
>     ...
> }
>
> Since this happens before the actual characters are printed, won't
> subsequent calls to wait_for_xmitr() see !up->canary as true and
> re-enable the flow control wait loop for each character?

Yes, and that is correct behavior. When serial8250_console_restore() is
called (right before clearing @canary), hardware flow control is
correctly re-configured, thus hardware flow control will work correctly
and it is fine for wait_for_xmitr() to poll.

John

      reply	other threads:[~2026-07-09  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 14:10 [PATCH tty] serial: 8250: Ignore flow control on suspend/resume with no_console_suspend John Ogness
2026-07-09  9:02 ` John Ogness [this message]

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=87a4s0lemy.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    /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