[PATCH v2 0/2] serial: amba-pl011: fix console clock lifetime
Karl Mehltretter <[email protected]> Fri, 24 Jul 2026 23:33:46 +0200
| Newsgroups | dev.linux.lists.linux-rt-devel,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-serial |
|---|---|
| Message-ID | <[email protected]> |
Patch 1 fixes an independent bug: pl011_console_setup() prepares the UART clock but nothing releases it when the console is unregistered, so the clock's prepare count leaks one reference per unregister. It adds the missing console .exit() and stands on its own. Patch 2 fixes a PREEMPT_RT failure: pl011_console_write_atomic() runs in nbcon atomic context but calls clk_enable(), which under RT can acquire a sleeping lock. It keeps the clock enabled while the console is available for output and releases it in .exit(); it depends on patch 1. Changes in v2: - Add suspend/resume management for the persistent clock reference. - Keep the reference for no_console_suspend and RX-wakeup ports. - Document the platform-dependent power impact. Patch 1 is unchanged. Tested in QEMU on raspi1ap, raspi2b, and RealView ARMv6 SMP, and on arm64 virt under PREEMPT_RT. Actual s2idle suspend/resume (RTC-wake) dropped and restored the PL011 clock reference, balanced across repeated cycles, while wake-capable and no_console_suspend cases kept it enabled. Strict clock checking found no access while stopped, and RX behaved as expected. Toggling /sys/class/tty/ttyAMA0/console showed the prepare-count leak without patch 1 and a balanced count with it. Full-platform-sleep and actual RX-wakeup were not exercised. Karl Mehltretter (2): serial: amba-pl011: unprepare console clock on unregister serial: amba-pl011: keep console clock enabled for atomic writes drivers/tty/serial/amba-pl011.c | 53 ++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 11 deletions(-) -- 2.53.0