From: kpursoty@proton.me
To: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"jirislaby@kernel.org" <jirislaby@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
"tsbogend@alpha.franken.de" <tsbogend@alpha.franken.de>
Subject: Re: [PATCH] serial: base: do not disable TX on hangup for console ports
Date: Thu, 16 Apr 2026 07:19:56 +0000 [thread overview]
Message-ID: <rHcToILwx6aB9P0a5jBv5Xkuyu8LeRk9nEXX4FezpwlmzPVoKL3MFkw77E_u68Yz6twiE4C7sPLN3Knlw3rf9BL6ejgjqiqmOffgou6ziyQ=@proton.me> (raw)
In-Reply-To: <1fpGAFo1KYyRDeGSGmaDWx6gXbV00C83qU_tep62Zu_cl9JfjpjWg8SKhw6z0owZ9eEMzXR2GnZ_U3V2PVi2R1fuGAmzgK43GYbWkCIBFf8=@proton.me>
Thanks for your notes. Patch withdrawn.
On Wednesday, 15 April 2026 at 09:01, kpursoty@proton.me <kpursoty@proton.me> wrote:
> serial_base_port_shutdown() calls serial_base_port_set_tx(false)
> unconditionally. When a TTY hangup occurs on a port that is also a
> registered kernel console, this permanently disables the console
> transmitter.
>
> uart_hangup() already guards against uart_change_pm(PM_OFF) for console
> ports (see the uart_console() check in uart_hangup()). Apply the same
> guard in serial_base_port_shutdown(): skip TX-disable if the port is a
> registered console.
>
> Without this fix, any path that calls uart_shutdown() on a console port
> - including TIOCSCTTY with force=1 (as used by init systems such as
> procd) - permanently silences all subsequent kernel console output.
>
> Signed-off-by: Kervin Pursoty <kpursoty@proton.me>
> ---
> drivers/tty/serial/serial_port.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c
> --- a/drivers/tty/serial/serial_port.c
> +++ b/drivers/tty/serial/serial_port.c
> @@ -110,5 +110,14 @@
> {
> struct serial_port_device *port_dev = port->port_dev;
>
> - serial_base_port_set_tx(port, port_dev, false);
> + /*
> + * Do not disable TX on a console port. When an init system calls
> + * TIOCSCTTY with force=1, the kernel hangs up the previous session,
> + * triggering uart_hangup() -> uart_shutdown() -> here. Stopping TX
> + * kills all kernel console output permanently.
> + * uart_hangup() already skips uart_change_pm(PM_OFF) for consoles
> + * via uart_console(); apply the same guard here.
> + */
> + if (!uart_console(port))
> + serial_base_port_set_tx(port, port_dev, false);
> }
>
> static DEFINE_RUNTIME_DEV_PM_OPS(serial_port_pm,
>
prev parent reply other threads:[~2026-04-16 7:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 8:01 [PATCH] serial: base: do not disable TX on hangup for console ports kpursoty
2026-04-16 7:19 ` kpursoty [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='rHcToILwx6aB9P0a5jBv5Xkuyu8LeRk9nEXX4FezpwlmzPVoKL3MFkw77E_u68Yz6twiE4C7sPLN3Knlw3rf9BL6ejgjqiqmOffgou6ziyQ=@proton.me' \
--to=kpursoty@proton.me \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=tsbogend@alpha.franken.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).