mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH tty v2] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
@ 2026-09-21 14:39 John Ogness
  2026-09-22  7:44 ` Petr Mladek
  0 siblings, 1 reply; 2+ messages in thread
From: John Ogness @ 2026-09-21 14:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Petr Mladek, Sebastian Andrzej Siewior,
	Jon Hunter, Thierry Reding, linux-kernel, Ilpo Järvinen,
	Andy Shevchenko, Crescent Hsieh, Hugo Villeneuve, linux-serial

Change console_msr_work (defers MSR handling) to be IRQ_WORK_LAZY,
thus not raising an IRQ upon irq_work queueing. The irq_work is then
handled on the next kernel tick. This additional delay is acceptable
because any pending MSR handling is also performed in the interrupt
handler, if mctrl is queried, and during console resume. Using
IRQ_WORK_LAZY has the benefit of not needing to raise an IRQ for
each line of atomic console printing when modem control is active.

On a side note, the Tegra20 and Tegra30 platforms can hang if an
irq_work IRQ is raised while entering cpuidle states. This problem
was reproducible by performing atomic printing while entering cpuidle.
So this change also provides a workaround for these platforms (as
long as they are not running tickless). The discussion on this topic
is linked below.

Link: https://lore.kernel.org/lkml/f3757a75-0ba1-4558-bf57-f19ab7e59a4c@nvidia.com
Fixes: d3539347022a ("serial: 8250: Switch to nbcon console, take 2")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
 drivers/tty/serial/8250/8250_port.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 38fa45e74a37a..1acb73e45f8a0 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -3597,7 +3597,7 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
 
 	up->console_line_ended = true;
 	up->console_msr_work_allow = true;
-	init_irq_work(&up->console_msr_work, console_msr_handler);
+	up->console_msr_work = IRQ_WORK_INIT_LAZY(console_msr_handler);
 
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);

base-commit: de7f683ff9e070ca19565373c546d736663e5512
-- 
2.47.3


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

* Re: [PATCH tty v2] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
  2026-09-21 14:39 [PATCH tty v2] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY John Ogness
@ 2026-09-22  7:44 ` Petr Mladek
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Mladek @ 2026-09-22  7:44 UTC (permalink / raw)
  To: John Ogness
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Sebastian Andrzej Siewior, Jon Hunter, Thierry Reding,
	linux-kernel, Ilpo Järvinen, Andy Shevchenko,
	Crescent Hsieh, Hugo Villeneuve, linux-serial

On Mon 2026-09-21 16:45:36, John Ogness wrote:
> Change console_msr_work (defers MSR handling) to be IRQ_WORK_LAZY,
> thus not raising an IRQ upon irq_work queueing. The irq_work is then
> handled on the next kernel tick. This additional delay is acceptable
> because any pending MSR handling is also performed in the interrupt
> handler, if mctrl is queried, and during console resume. Using
> IRQ_WORK_LAZY has the benefit of not needing to raise an IRQ for
> each line of atomic console printing when modem control is active.
> 
> On a side note, the Tegra20 and Tegra30 platforms can hang if an
> irq_work IRQ is raised while entering cpuidle states. This problem
> was reproducible by performing atomic printing while entering cpuidle.
> So this change also provides a workaround for these platforms (as
> long as they are not running tickless). The discussion on this topic
> is linked below.
> 
> Link: https://lore.kernel.org/lkml/f3757a75-0ba1-4558-bf57-f19ab7e59a4c@nvidia.com
> Fixes: d3539347022a ("serial: 8250: Switch to nbcon console, take 2")
> Signed-off-by: John Ogness <john.ogness@linutronix.de>

We did the same change also for the nbcon_irq_work which is used
to wakeup printk kthreads in a safe context, see the commit
560f4deda32785e ("printk/nbcon: Change nbcon_irq_work to
IRQ_WORK_LAZY").

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

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

end of thread, other threads:[~2026-09-22  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 14:39 [PATCH tty v2] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY John Ogness
2026-09-22  7:44 ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®