All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] serial: amba-pl011: fix console clock lifetime
@ 2026-07-19  6:35 Karl Mehltretter
  2026-07-19  6:35 ` [PATCH 1/2] serial: amba-pl011: unprepare console clock on unregister Karl Mehltretter
  2026-07-19  6:35 ` [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes Karl Mehltretter
  0 siblings, 2 replies; 12+ messages in thread
From: Karl Mehltretter @ 2026-07-19  6:35 UTC (permalink / raw)
  To: Russell King, Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-serial, linux-kernel, Sebastian Andrzej Siewior,
	Clark Williams, Steven Rostedt, linux-rt-devel, Toshiyuki Sato,
	Petr Mladek, John Ogness, Karl Mehltretter

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 registration cycle (via
the sysfs "console" attribute or a driver unbind). 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, so an atomic-context printk on a clk-backed pl011 can hit
"sleeping function called from invalid context". The same lock
acquisition would also be unsafe if write_atomic() is invoked from NMI
context. It keeps the clock enabled while the console is registered and
releases it in .exit(); it depends on patch 1.

Tested on QEMU: the prepare-count leak was reproduced and fixed on
bcm2835 (a gateable CPRMAN UART clock), and the PREEMPT_RT splat was
reproduced and fixed on versatilepb. With the series applied, recycling
the console via the sysfs attribute keeps both the prepare and enable
counts balanced, and the console keeps working after re-registration.

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 | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

-- 
2.53.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-07-20 21:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-19  6:35 [PATCH 0/2] serial: amba-pl011: fix console clock lifetime Karl Mehltretter
2026-07-19  6:35 ` [PATCH 1/2] serial: amba-pl011: unprepare console clock on unregister Karl Mehltretter
2026-07-19  7:04   ` sashiko-bot
2026-07-19 10:27     ` Karl Mehltretter
2026-07-19  6:35 ` [PATCH 2/2] serial: amba-pl011: keep console clock enabled for atomic writes Karl Mehltretter
2026-07-19  6:52   ` sashiko-bot
2026-07-20  8:01     ` Sebastian Andrzej Siewior
2026-07-20  8:13       ` John Ogness
2026-07-20  8:26         ` Sebastian Andrzej Siewior
2026-07-20 21:26           ` Karl Mehltretter
2026-07-20 11:45   ` Petr Mladek
2026-07-20 12:15     ` Sebastian Andrzej Siewior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.