Re: [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes
| Newsgroups | dev.linux.lists.linux-rt-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] The UART clock is kept unconditionally enabled during system suspend, potentially preventing deep system sleep. -- --- Patch [2]: [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes --- commit d187007d951bc1373a13bbdbd4ba5d6db47490d1 Author: Karl Mehltretter <[email protected]> serial: amba-pl011: keep console clock enabled for atomic writes This commit fixes a sleeping-in-atomic bug under PREEMPT_RT by keeping the console clock enabled while the console is registered. It moves the clock enable from the atomic write path to console setup and exit. > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 1aa43994a3cdc..4facd1b350d5d 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -2523,7 +2523,11 @@ static int pl011_console_setup(struct console *co, char *options) > /* Allow pins to be muxed in and configured */ > pinctrl_pm_select_default_state(uap->port.dev); > > - ret = clk_prepare(uap->clk); > + /* > + * Keep the clock enabled while registered because write_atomic() may > + * run in NMI context and must not acquire the clock framework lock. > + */ > + ret = clk_prepare_enable(uap->clk); [Severity: High] Will this keep the UART clock unconditionally enabled during system suspend? Because the persistent clock reference is acquired here during console registration and only dropped on console exit in pl011_console_exit(), the reference remains active. During system suspend, pl011_suspend() delegates to uart_suspend_port() but fails to drop this console's persistent clock enable reference. This might prevent the SoC from turning off the clock tree or parent PLLs, preventing deep system sleep. -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2