Linux Tegra architecture development
 help / color / mirror / Atom feed
* Re: [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2
       [not found] ` <20260724103654.133654-2-john.ogness@linutronix.de>
@ 2026-08-18  5:32   ` Jon Hunter
  2026-08-18  6:14     ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Hunter @ 2026-08-18  5:32 UTC (permalink / raw)
  To: John Ogness, Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Shevchenko, Petr Mladek, Sebastian Andrzej Siewior,
	linux-kernel, Ilpo Järvinen, Andy Shevchenko,
	Hugo Villeneuve, Fushuai Wang, Kees Cook, Stepan Ionichev,
	linux-serial, linux-tegra@vger.kernel.org

Hi John,

On 24/07/2026 11:36, John Ogness wrote:
> Implement the necessary callbacks to switch the 8250 console driver
> to perform as an nbcon console.
> 
> Add implementations for the nbcon console callbacks:
> 
>    ->write_atomic()
>    ->write_thread()
>    ->device_lock()
>    ->device_unlock()
> 
> and add CON_NBCON to the initial @flags.
> 
> All hardware access in the callbacks is within unsafe sections.
> The ->write_atomic() and ->write_thread() callbacks allow safe
> handover/takeover per byte and add a preceding newline if they
> take over from another context mid-line.
> 
> For the ->write_atomic() callback, a new irq_work is used to defer
> modem control since it may be called from a context that does not
> allow waking up tasks. During suspend/resume the irq_work is not
> used as this has been shown to cause suspend problems for some
> hardware. Upon resume, any pending modem control is performed.
> 
> Note: A new __serial8250_clear_IER() is introduced for direct
> clearing of UART_IER during console writing (which will not be
> holding the port lock for atomic printing or KDB/KGDB). This
> allows restoring a lockdep check to serial8250_clear_IER() in
> a follow-up commit.
> 
> Signed-off-by: John Ogness <john.ogness@linutronix.de>


This change is causing a boot regression for our Tegra20 and Tegra30 
platforms. Reverting this on top of -next fixes the issue. Previously 
with V5 I did not see a boot issue only an issue in suspend. So far the 
only interesting thing I have observed is that if I add 'keep_bootcon' 
to the command line the board does boot.

Jon

-- 
nvpublic


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

* Re: [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2
  2026-08-18  5:32   ` [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2 Jon Hunter
@ 2026-08-18  6:14     ` Andy Shevchenko
  2026-08-18  6:20       ` Jon Hunter
  2026-08-18  9:24       ` Petr Mladek
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-08-18  6:14 UTC (permalink / raw)
  To: Jon Hunter
  Cc: John Ogness, Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Petr Mladek, Sebastian Andrzej Siewior, linux-kernel,
	Ilpo Järvinen, Hugo Villeneuve, Fushuai Wang, Kees Cook,
	Stepan Ionichev, linux-serial, linux-tegra@vger.kernel.org

On Tue, Aug 18, 2026 at 06:32:12AM +0100, Jon Hunter wrote:
> On 24/07/2026 11:36, John Ogness wrote:
> > Implement the necessary callbacks to switch the 8250 console driver
> > to perform as an nbcon console.
> > 
> > Add implementations for the nbcon console callbacks:
> > 
> >    ->write_atomic()
> >    ->write_thread()
> >    ->device_lock()
> >    ->device_unlock()
> > 
> > and add CON_NBCON to the initial @flags.
> > 
> > All hardware access in the callbacks is within unsafe sections.
> > The ->write_atomic() and ->write_thread() callbacks allow safe
> > handover/takeover per byte and add a preceding newline if they
> > take over from another context mid-line.
> > 
> > For the ->write_atomic() callback, a new irq_work is used to defer
> > modem control since it may be called from a context that does not
> > allow waking up tasks. During suspend/resume the irq_work is not
> > used as this has been shown to cause suspend problems for some
> > hardware. Upon resume, any pending modem control is performed.
> > 
> > Note: A new __serial8250_clear_IER() is introduced for direct
> > clearing of UART_IER during console writing (which will not be
> > holding the port lock for atomic printing or KDB/KGDB). This
> > allows restoring a lockdep check to serial8250_clear_IER() in
> > a follow-up commit.
> 
> This change is causing a boot regression for our Tegra20 and Tegra30
> platforms. Reverting this on top of -next fixes the issue. Previously with
> V5 I did not see a boot issue only an issue in suspend.

Wasn't v11 applied and not v9?

> So far the only
> interesting thing I have observed is that if I add 'keep_bootcon' to the
> command line the board does boot.

keep_bootcon defers driver taking over, that's why it works, it uses just
simple primitives instead of full-featured driver.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2
  2026-08-18  6:14     ` Andy Shevchenko
@ 2026-08-18  6:20       ` Jon Hunter
  2026-08-18  9:24       ` Petr Mladek
  1 sibling, 0 replies; 4+ messages in thread
From: Jon Hunter @ 2026-08-18  6:20 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: John Ogness, Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Petr Mladek, Sebastian Andrzej Siewior, linux-kernel,
	Ilpo Järvinen, Hugo Villeneuve, Fushuai Wang, Kees Cook,
	Stepan Ionichev, linux-serial, linux-tegra@vger.kernel.org


On 18/08/2026 07:14, Andy Shevchenko wrote:
> On Tue, Aug 18, 2026 at 06:32:12AM +0100, Jon Hunter wrote:
>> On 24/07/2026 11:36, John Ogness wrote:
>>> Implement the necessary callbacks to switch the 8250 console driver
>>> to perform as an nbcon console.
>>>
>>> Add implementations for the nbcon console callbacks:
>>>
>>>     ->write_atomic()
>>>     ->write_thread()
>>>     ->device_lock()
>>>     ->device_unlock()
>>>
>>> and add CON_NBCON to the initial @flags.
>>>
>>> All hardware access in the callbacks is within unsafe sections.
>>> The ->write_atomic() and ->write_thread() callbacks allow safe
>>> handover/takeover per byte and add a preceding newline if they
>>> take over from another context mid-line.
>>>
>>> For the ->write_atomic() callback, a new irq_work is used to defer
>>> modem control since it may be called from a context that does not
>>> allow waking up tasks. During suspend/resume the irq_work is not
>>> used as this has been shown to cause suspend problems for some
>>> hardware. Upon resume, any pending modem control is performed.
>>>
>>> Note: A new __serial8250_clear_IER() is introduced for direct
>>> clearing of UART_IER during console writing (which will not be
>>> holding the port lock for atomic printing or KDB/KGDB). This
>>> allows restoring a lockdep check to serial8250_clear_IER() in
>>> a follow-up commit.
>>
>> This change is causing a boot regression for our Tegra20 and Tegra30
>> platforms. Reverting this on top of -next fixes the issue. Previously with
>> V5 I did not see a boot issue only an issue in suspend.
> 
> Wasn't v11 applied and not v9?

Ah may be I replied to the wrong version. However, I am testing 
next-20260817. So whatever is in -next.
>> So far the only
>> interesting thing I have observed is that if I add 'keep_bootcon' to the
>> command line the board does boot.
> 
> keep_bootcon defers driver taking over, that's why it works, it uses just
> simple primitives instead of full-featured driver.

Yes that makes sense then.
Jon

-- 
nvpublic


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

* Re: [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2
  2026-08-18  6:14     ` Andy Shevchenko
  2026-08-18  6:20       ` Jon Hunter
@ 2026-08-18  9:24       ` Petr Mladek
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Mladek @ 2026-08-18  9:24 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jon Hunter, John Ogness, Greg Kroah-Hartman, Jiri Slaby,
	Andy Shevchenko, Sebastian Andrzej Siewior, linux-kernel,
	Ilpo Järvinen, Hugo Villeneuve, Fushuai Wang, Kees Cook,
	Stepan Ionichev, linux-serial, linux-tegra@vger.kernel.org

On Tue 2026-08-18 09:14:51, Andy Shevchenko wrote:
> On Tue, Aug 18, 2026 at 06:32:12AM +0100, Jon Hunter wrote:
> > On 24/07/2026 11:36, John Ogness wrote:
> > > Implement the necessary callbacks to switch the 8250 console driver
> > > to perform as an nbcon console.
> > > 
> > > Add implementations for the nbcon console callbacks:
> > > 
> > >    ->write_atomic()
> > >    ->write_thread()
> > >    ->device_lock()
> > >    ->device_unlock()
> > > 
> > > and add CON_NBCON to the initial @flags.
> > > 
> > > All hardware access in the callbacks is within unsafe sections.
> > > The ->write_atomic() and ->write_thread() callbacks allow safe
> > > handover/takeover per byte and add a preceding newline if they
> > > take over from another context mid-line.
> > > 
> > > For the ->write_atomic() callback, a new irq_work is used to defer
> > > modem control since it may be called from a context that does not
> > > allow waking up tasks. During suspend/resume the irq_work is not
> > > used as this has been shown to cause suspend problems for some
> > > hardware. Upon resume, any pending modem control is performed.
> > > 
> > > Note: A new __serial8250_clear_IER() is introduced for direct
> > > clearing of UART_IER during console writing (which will not be
> > > holding the port lock for atomic printing or KDB/KGDB). This
> > > allows restoring a lockdep check to serial8250_clear_IER() in
> > > a follow-up commit.
> > 
> > This change is causing a boot regression for our Tegra20 and Tegra30
> > platforms. Reverting this on top of -next fixes the issue. Previously with
> > V5 I did not see a boot issue only an issue in suspend.
> 
> Wasn't v11 applied and not v9?
> 
> > So far the only
> > interesting thing I have observed is that if I add 'keep_bootcon' to the
> > command line the board does boot.
> 
> keep_bootcon defers driver taking over, that's why it works, it uses just
> simple primitives instead of full-featured driver.

It is the other way. The full-featured driver is used even with
keep_bootcon. The option causes that the simple boot driver stays
registered in parallel. You probably see duplicated lines because
of this.

Anyway, the most important effect of "keep_bootcon" is that
boot consoles prevent using the printk kthreads. Even the nbcon
consoles need to be handled in the legacy loop.

There reason is a combination of two things:

  1. Boot consoles are synchronized only using the legacy
     console_lock (console_sem). port->lock does not exist
     at boot time.

  2. There is no simple way how to match boot console drivers
     with the full-featured drivers. They use a different interface
     to access the same HW.

As a result, even the full featured console drivers have to rely
on the legacy console_lock as long as any boot console is used.

The regression seems to be when the uart 8250 port become handled
by the printk kthread.

Best Regards,
Petr

PS: I am not sure whether to continue the discussion here.
    It might be better to move it to v11. see
    https://lore.kernel.org/all/20260729120439.281252-1-john.ogness@linutronix.de/
    I am going to reply there as well.

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

end of thread, other threads:[~2026-08-18  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260724103654.133654-1-john.ogness@linutronix.de>
     [not found] ` <20260724103654.133654-2-john.ogness@linutronix.de>
2026-08-18  5:32   ` [PATCH tty v9 1/2] serial: 8250: Switch to nbcon console, take 2 Jon Hunter
2026-08-18  6:14     ` Andy Shevchenko
2026-08-18  6:20       ` Jon Hunter
2026-08-18  9:24       ` Petr Mladek

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