Re: [PATCH tty] serial: 8250: Ignore flow control on suspend/resume with no_console_suspend

John Ogness <[email protected]>
Newsgroups org.kernel.vger.linux-serial,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.