From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 6.18-6.6] serial: qcom_geni: Disable closing_wait for console to prevent shutdown timeout
Date: Mon, 19 Oct 2026 15:51:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-177794@kernel.org> (raw)
In-Reply-To: <20261019135441.1420968-515-sashal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] serial: qcom_geni: uncancelled console TX in qcom_geni_serial_startup()
--
commit 410ad55ea7c02110e68e77ae15503cb551a22bf5
Author: Aniket Randive <aniket.randive@oss.qualcomm.com>
serial: qcom_geni: Disable closing_wait for console to prevent shutdown timeout
This commit sets closing_wait to ASYNC_CLOSING_WAIT_NONE in
qcom_geni_serial_startup() for console ports so that closing the console
TTY bypasses tty_wait_until_sent() during system shutdown.
Link: https://patch.msgid.link/20260706093749.836121-1-aniket.randive@oss.qualcomm.com
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 8058b839b26ce..219ac88b0fab2 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1227,6 +1227,7 @@ static int qcom_geni_serial_startup(struct uart_port *uport)
> {
> int ret;
> struct qcom_geni_serial_port *port = to_dev_port(uport);
> + struct tty_port *tport = &uport->state->port;
>
> if (!port->setup) {
> ret = qcom_geni_serial_port_setup(uport);
> @@ -1234,6 +1235,13 @@ static int qcom_geni_serial_startup(struct uart_port *uport)
> return ret;
> }
>
> + /*
> + * Skip the close-time transmit drain for console ports so that
> + * shutdown can proceed without waiting for pending TX completion.
> + */
> + if (uart_console(uport))
> + tport->closing_wait = ASYNC_CLOSING_WAIT_NONE;
[Severity: Medium]
Does uart_shutdown() actually get called to cancel pending TX commands when a
console port is closed?
The commit message states that setting closing_wait to ASYNC_CLOSING_WAIT_NONE
bypasses tty_wait_until_sent() on close, allowing uart_shutdown() to cancel TX
commands cleanly.
However, when uart_console(uport) is true, serial_core_add_one_port() sets
port->console:
drivers/tty/serial/serial_core.c:serial_core_add_one_port() {
...
port->console = uart_console(uport);
...
}
When userspace closes the final file descriptor on the console TTY via
tty_release() -> uart_close() -> tty_port_close(), tty_port_close_start()
skips tty_wait_until_sent() without calling tty_driver_flush_buffer() (unless
tty->flow.tco_stopped is set):
drivers/tty/tty_port.c:tty_port_close_start() {
...
if (tty->flow.tco_stopped)
tty_driver_flush_buffer(tty);
if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
tty_wait_until_sent(tty, port->closing_wait);
...
}
Then tty_port_close() calls tty_port_shutdown(), which returns early for
console ports without invoking port->ops->shutdown() (uart_tty_port_shutdown()
-> uart_port_shutdown() -> qcom_geni_serial_shutdown()):
drivers/tty/tty_port.c:tty_port_shutdown() {
struct tty_struct *tty = port->tty;
mutex_lock(&port->mutex);
if (port->console)
goto out;
...
}
After that, tty_port_close_end() clears TTY_PORT_ACTIVE via
tty_port_set_active(port, false), so even a subsequent uart_hangup() (which
checks tty_port_active(port)) will not call uart_flush_buffer() or
uart_shutdown().
Doesn't this leave pending GENI sequencer TX commands (UART_START_TX), TX
interrupts, and unsent bytes in tport->xmit_fifo active after the console TTY
is closed, causing subsequent qcom_geni_serial_console_write() calls to poll
until timeout before cancelling the stalled command and re-triggering
qcom_geni_serial_isr() -> qcom_geni_serial_handle_tx_fifo() on the leftover
xmit_fifo data?
> +
> uart_port_lock_irq(uport);
> qcom_geni_serial_start_rx(uport);
> uart_port_unlock_irq(uport);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019135441.1420968-515-sashal@kernel.org?part=1
prev parent reply other threads:[~2026-10-19 15:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261019135441.1420968-1-sashal@kernel.org>
2026-10-19 13:45 ` [PATCH AUTOSEL 6.18-5.10] tty: serial: pch_uart: add check for pci_get_slot() Sasha Levin
2026-10-19 14:06 ` sashiko-bot
2026-10-19 13:45 ` [PATCH AUTOSEL 6.18-6.12] serial: 8250: force synchronous probe for the ISA and PNP drivers Sasha Levin
2026-10-19 14:10 ` sashiko-bot
2026-10-19 13:53 ` [PATCH AUTOSEL 6.18-6.6] serial: qcom_geni: Disable closing_wait for console to prevent shutdown timeout Sasha Levin
2026-10-19 15:51 ` sashiko-bot [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=sashiko-outbox-177794@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashal@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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