public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Esben Haabendal <esben@geanix.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Arnd Bergmann <arnd@arndb.de>, Tony Lindgren <tony@atomide.com>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Serge Semin <fancer.lancer@gmail.com>,
	Andrew Murray <amurray@thegoodpenguin.co.uk>
Subject: Re: [RFC 0/1] serial: 8250: nbcon_atomic_flush_pending() might trigger watchdog warnigns
Date: Thu, 25 Sep 2025 13:12:11 +0206	[thread overview]
Message-ID: <84tt0qeqqk.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <aNQO-zl3k1l4ENfy@pathway.suse.cz>

Hi Petr,

Thanks for putting together this summary...

On 2025-09-24, Petr Mladek <pmladek@suse.com> wrote:
> We currently have the following solutions for the original
> problem (hardlockup in nbcon_reacquire_nobuf()):
>
>
> 1. Touch the watchdog in nbcon_reacquire_nobuf()
>
>    Pros:
> 	+ trivial
>
>    Cons:
> 	+ Two CPUs might be blocked by slow serial consoles.

Note that nbcon_reacquire_nobuf() is not the only function that behaves
this way. We also have the same thing in the port lock wrapper:
__uart_port_nbcon_acquire().

> 2. Yield nbcon console context ownership between each record
>    and block all kthreads from emergency_enter/exit API
>
>    Pros:
> 	+ Only one CPU is blocked by slow serial console
> 	+ Prevents repeated takeovers for "every" new message
>
>    Cons:
> 	+ More complex than 1
> 	+ Completely give up on parallel console handling in emergency

This seems like the most practical solution for now. It is simple and
will guarantee that no "kthread interference" occur. Note that only
consoles that implement write_atomic() need to have their kthread
blocked. (Also consoles with unsafe write_atomic() would not need to
have their kthread blocked.)

> 3. Yield nbcon console context ownership between each record
>    and block only one kthread from __nbcon_atomic_flush_pending_con()
>
>    Pros:
> 	+ Only one CPU is blocked by slow serial console
> 	+ Parallel console handling still possible in emergency
>
>    Cons:
> 	+ More complex than 1   (similar to 2)
> 	+ Possible repeated takeovers for "every" new emergency message

IMHO this is the most complex solution and will still not guarantee
avoiding kthread interference.

> Well, releasing the console context ownership after each record
> might solve also some other problems

Sure, like with the port lock wrapper.

> I am going to try implementing the 3rd solution and see how
> complicated  it would be.
>
> It would be possible to change it two 2nd easily just by
> using a global counter and updating it in emergency_enter/exit API.

Basically you are talking about changing the per-CPU emergency counter
to be global.

John

  reply	other threads:[~2025-09-25 11:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22 14:25 [RFC 0/1] serial: 8250: nbcon_atomic_flush_pending() might trigger watchdog warnigns Petr Mladek
2025-08-22 14:25 ` [RFC 1/1] serial: 8250: Touch watchdogs in write_atomic() Petr Mladek
2025-08-25 11:00 ` [RFC 0/1] serial: 8250: nbcon_atomic_flush_pending() might trigger watchdog warnigns John Ogness
2025-09-22 13:40   ` Petr Mladek
2025-09-22 17:02     ` John Ogness
2025-09-24  9:34       ` Petr Mladek
2025-09-24 12:42         ` John Ogness
2025-09-24 15:32           ` Petr Mladek
2025-09-25 11:06             ` John Ogness [this message]
2025-09-25 11:19               ` John Ogness
2025-09-29  8:50             ` Andrew Murray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84tt0qeqqk.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=amurray@thegoodpenguin.co.uk \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=esben@geanix.com \
    --cc=fancer.lancer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=schnelle@linux.ibm.com \
    --cc=senozhatsky@chromium.org \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox