* [PATCH tty 0/1] Make 8250 deferred MSR handling LAZY
@ 2026-08-28 15:58 John Ogness
2026-08-28 15:58 ` [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY John Ogness
0 siblings, 1 reply; 6+ messages in thread
From: John Ogness @ 2026-08-28 15:58 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
There was a report and follow-up discussion [0] about a problem
using regular irq_work queuing on some platforms when entering
cpuidle. To circumvent this problem, all irq_work for printk will
become IRQ_WORK_LAZY [1].
The 8250 console driver uses irq_work to defer MSR handling during
atomic printing. This means it is vulnerable to the same problem if,
for example, a WARN() is hit while entering cpuidle on one of the
affected platforms.
Avoid the problem for deferred MSR handling by changing
console_msr_work to IRQ_WORK_LAZY.
[0] https://lore.kernel.org/lkml/f3757a75-0ba1-4558-bf57-f19ab7e59a4c@nvidia.com
[1] https://lore.kernel.org/lkml/20260828140218.232439-1-john.ogness@linutronix.de
John Ogness (1):
serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
drivers/tty/serial/8250/8250_port.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: 45c13f3f9e3bb15fd89ff2864c6f627a3b4b4229
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
2026-08-28 15:58 [PATCH tty 0/1] Make 8250 deferred MSR handling LAZY John Ogness
@ 2026-08-28 15:58 ` John Ogness
2026-08-28 16:06 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 6+ messages in thread
From: John Ogness @ 2026-08-28 15:58 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
For some platforms it is a problem to queue irq_work when entering
cpuidle states. Since irq_work is used for deferred MSR handling,
any atomic console printing when entering cpuidle states can lead
to the affected hardware hanging. Tegra20 and Tegra30 are examples
of such platforms. Avoiding raising the irq_work IRQ has shown to
circumvent the problem.
Change the console_msr_work to be IRQ_WORK_LAZY, thus not raising
an IRQ upon irq_work queuing. The irq_work is then handled on the
next interrupt (worst case, kernel tick).
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);
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
2026-08-28 15:58 ` [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY John Ogness
@ 2026-08-28 16:06 ` Sebastian Andrzej Siewior
2026-08-28 16:41 ` John Ogness
2026-08-28 17:06 ` Jon Hunter
0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-08-28 16:06 UTC (permalink / raw)
To: John Ogness
Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Petr Mladek,
Jon Hunter, Thierry Reding, linux-kernel, Ilpo Järvinen,
Andy Shevchenko, Crescent Hsieh, Hugo Villeneuve, linux-serial
On 2026-08-28 18:04:08 [+0206], John Ogness wrote:
> For some platforms it is a problem to queue irq_work when entering
> cpuidle states. Since irq_work is used for deferred MSR handling,
> any atomic console printing when entering cpuidle states can lead
> to the affected hardware hanging. Tegra20 and Tegra30 are examples
> of such platforms. Avoiding raising the irq_work IRQ has shown to
> circumvent the problem.
I would argue that this is done for the benefit of less interrupts since
there no need to handle console_msr_work immediately. With the side
effect that it might fix a bug that was not yet reported on Tegra[23]0.
Ideally the Tegra folks should figure out what exactly is broken instead
of adding duct tape everywhere else.
> Change the console_msr_work to be IRQ_WORK_LAZY, thus not raising
> an IRQ upon irq_work queuing. The irq_work is then handled on the
> next interrupt (worst case, kernel tick).
Not on the next interrupt, on the next jiffies tick. Should you run
tickless and should the CPU have the tick switch off then it will raise
the irq-work interrupt anyway.
side-note: Wasn't there another tegra workaround in v5/take1?
Sebastian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
2026-08-28 16:06 ` Sebastian Andrzej Siewior
@ 2026-08-28 16:41 ` John Ogness
2026-08-28 17:06 ` Jon Hunter
1 sibling, 0 replies; 6+ messages in thread
From: John Ogness @ 2026-08-28 16:41 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Petr Mladek,
Jon Hunter, Thierry Reding, linux-kernel, Ilpo Järvinen,
Andy Shevchenko, Crescent Hsieh, Hugo Villeneuve, linux-serial
On 2026-08-28, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> On 2026-08-28 18:04:08 [+0206], John Ogness wrote:
>> For some platforms it is a problem to queue irq_work when entering
>> cpuidle states. Since irq_work is used for deferred MSR handling,
>> any atomic console printing when entering cpuidle states can lead
>> to the affected hardware hanging. Tegra20 and Tegra30 are examples
>> of such platforms. Avoiding raising the irq_work IRQ has shown to
>> circumvent the problem.
>
> I would argue that this is done for the benefit of less interrupts since
> there no need to handle console_msr_work immediately.
Indeed that is a better argument, but strictly speaking, it isn't the
motivation. I think it is important to clarify that _currently_ there is
a problem that the explicit lazy is working around.
I expect most irq_work users could be changed to lazy with the argument
of reducing interrupts.
> side-note: Wasn't there another tegra workaround in v5/take1?
Yes, related to suspend/resume, implemented at the printk level [0]. Now
that we better understand the problem, that could be reverted. However,
it also provided a side-effect benefit: switching to atomic mode on
suspend when no_console_suspend is specified. I suppose at some point
(once the nbcon churn settles down) we will clean those changes so that
the naming and semantics really focus on "switching to atomic" rather
than "block irqwork".
John
[0] https://lore.kernel.org/lkml/20251113160351.113031-3-john.ogness@linutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
2026-08-28 16:06 ` Sebastian Andrzej Siewior
2026-08-28 16:41 ` John Ogness
@ 2026-08-28 17:06 ` Jon Hunter
2026-08-30 7:42 ` Andy Shevchenko
1 sibling, 1 reply; 6+ messages in thread
From: Jon Hunter @ 2026-08-28 17:06 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, John Ogness
Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko, Petr Mladek,
Thierry Reding, linux-kernel, Ilpo Järvinen,
Andy Shevchenko, Crescent Hsieh, Hugo Villeneuve, linux-serial,
linux-tegra
On 28/08/2026 17:06, Sebastian Andrzej Siewior wrote:
> On 2026-08-28 18:04:08 [+0206], John Ogness wrote:
>> For some platforms it is a problem to queue irq_work when entering
>> cpuidle states. Since irq_work is used for deferred MSR handling,
>> any atomic console printing when entering cpuidle states can lead
>> to the affected hardware hanging. Tegra20 and Tegra30 are examples
>> of such platforms. Avoiding raising the irq_work IRQ has shown to
>> circumvent the problem.
>
> I would argue that this is done for the benefit of less interrupts since
> there no need to handle console_msr_work immediately. With the side
> effect that it might fix a bug that was not yet reported on Tegra[23]0.
>
> Ideally the Tegra folks should figure out what exactly is broken instead
> of adding duct tape everywhere else.
Yes that would be ideal. Unfortunately these are old devices now and very
much in maintenance mode so getting to the bottom of this now is unlikely.
You may say then why don't we completely deprecate these, but then you
could argue the other way and say they have been working fine up until
now.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY
2026-08-28 17:06 ` Jon Hunter
@ 2026-08-30 7:42 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2026-08-30 7:42 UTC (permalink / raw)
To: Jon Hunter
Cc: Sebastian Andrzej Siewior, John Ogness, Greg Kroah-Hartman,
Jiri Slaby, Andy Shevchenko, Petr Mladek, Thierry Reding,
linux-kernel, Ilpo Järvinen, Crescent Hsieh,
Hugo Villeneuve, linux-serial, linux-tegra
On Fri, Aug 28, 2026 at 06:06:50PM +0100, Jon Hunter wrote:
> On 28/08/2026 17:06, Sebastian Andrzej Siewior wrote:
> > On 2026-08-28 18:04:08 [+0206], John Ogness wrote:
> > > For some platforms it is a problem to queue irq_work when entering
> > > cpuidle states. Since irq_work is used for deferred MSR handling,
> > > any atomic console printing when entering cpuidle states can lead
> > > to the affected hardware hanging. Tegra20 and Tegra30 are examples
> > > of such platforms. Avoiding raising the irq_work IRQ has shown to
> > > circumvent the problem.
> >
> > I would argue that this is done for the benefit of less interrupts since
> > there no need to handle console_msr_work immediately. With the side
> > effect that it might fix a bug that was not yet reported on Tegra[23]0.
> >
> > Ideally the Tegra folks should figure out what exactly is broken instead
> > of adding duct tape everywhere else.
>
> Yes that would be ideal. Unfortunately these are old devices now and very
> much in maintenance mode so getting to the bottom of this now is unlikely.
> You may say then why don't we completely deprecate these, but then you
> could argue the other way and say they have been working fine up until
> now.
This is a trade-off between burden of supporting them vs. developing and move
on on more important things. Personally I consider non-blocking console feature
is *much* more important than a few "working fine up until now" outdated
platforms (side example, recently the whole i486 support was ripped off, while
working fine...).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-30 7:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 15:58 [PATCH tty 0/1] Make 8250 deferred MSR handling LAZY John Ogness
2026-08-28 15:58 ` [PATCH tty 1/1] serial: 8250: Change console_msr_work to IRQ_WORK_LAZY John Ogness
2026-08-28 16:06 ` Sebastian Andrzej Siewior
2026-08-28 16:41 ` John Ogness
2026-08-28 17:06 ` Jon Hunter
2026-08-30 7:42 ` Andy Shevchenko
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®