From: John Ogness <john.ogness@linutronix.de>
To: "Toshiyuki Sato (Fujitsu)" <fj6611ie@fujitsu.com>,
'Michael Kelley' <mhklinux@outlook.com>
Cc: "pmladek@suse.com" <pmladek@suse.com>,
'Ryo Takakura' <ryotkkr98@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Toshiyuki Sato (Fujitsu)" <fj6611ie@fujitsu.com>
Subject: RE: Problem with nbcon console and amba-pl011 serial port
Date: Wed, 04 Jun 2025 09:58:19 +0206 [thread overview]
Message-ID: <84tt4wndu4.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <TY4PR01MB13777674C22721FCD8ACF4FCCD76CA@TY4PR01MB13777.jpnprd01.prod.outlook.com>
On 2025-06-04, "Toshiyuki Sato (Fujitsu)" <fj6611ie@fujitsu.com> wrote:
> This is a proposed fix to force termination by returning false from
> nbcon_reacquire_nobuf when a panic occurs within pl011_console_write_thread.
> (I believe this is similar to what John suggested in his previous reply.)
>
> While I couldn't reproduce the issue using sysrq-trigger in my environment
> (It seemed that the panic was being executed before the thread processing),
> I did observe nbcon_reacquire_nobuf failing to complete when injecting an
> NMI (SError) during pl011_console_write_thread.
> Applying this fix seems to have resolved the "SMP: failed to stop secondary
> CPUs" issue.
>
> This patch is for test.
> Modifications to imx and other drivers, as well as adding __must_check,
> will likely be required.
>
> Michael, could you please test this fix in your environment?
>
> Regards,
> Toshiyuki Sato
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 11d650975..c3a2b22e6 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -2577,8 +2577,10 @@ pl011_console_write_thread(struct console *co, struct nbcon_write_context *wctxt
> }
> }
>
> - while (!nbcon_enter_unsafe(wctxt))
> - nbcon_reacquire_nobuf(wctxt);
> + while (!nbcon_enter_unsafe(wctxt)) {
I realize this is just a test patch. But for the real patch, there needs
to be some comment here about bailing out. On panic, the driver is
leaving the clock enabled and not restoring REG_CR. At a quick glance
this appears to be a bug. So the comment is needed to make it clear that
the driver is exiting on purpose without proper completion. And perhaps
also mentioning why this is safe during panic. Thanks.
> + if (!nbcon_reacquire_nobuf(wctxt))
> + return;
> + }
>
> while ((pl011_read(uap, REG_FR) ^ uap->vendor->inv_fr) & uap->vendor->fr_busy)
> cpu_relax();
John Ogness
next prev parent reply other threads:[~2025-06-04 7:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 3:18 Problem with nbcon console and amba-pl011 serial port Michael Kelley
2025-06-03 9:03 ` Ryo Takakura
2025-06-03 9:36 ` Toshiyuki Sato (Fujitsu)
2025-06-03 10:13 ` John Ogness
2025-06-03 10:44 ` John Ogness
2025-06-04 1:22 ` Toshiyuki Sato (Fujitsu)
2025-06-04 7:44 ` John Ogness
2025-06-04 8:11 ` Russell King (Oracle)
2025-06-03 11:09 ` John Ogness
2025-06-04 4:11 ` Toshiyuki Sato (Fujitsu)
2025-06-04 7:52 ` John Ogness [this message]
2025-06-04 11:08 ` Petr Mladek
2025-06-04 11:50 ` John Ogness
2025-06-04 13:42 ` Petr Mladek
2025-06-05 5:27 ` Toshiyuki Sato (Fujitsu)
2025-06-05 13:39 ` Petr Mladek
2025-06-06 6:46 ` Toshiyuki Sato (Fujitsu)
2025-06-06 10:19 ` John Ogness
2025-06-06 10:35 ` John Ogness
2025-06-06 14:01 ` Petr Mladek
2025-06-06 16:58 ` John Ogness
2025-06-05 2:49 ` Michael Kelley
2025-06-05 6:22 ` Toshiyuki Sato (Fujitsu)
2025-06-05 7:42 ` John Ogness
2025-06-09 3:38 ` Michael Kelley
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=84tt4wndu4.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=fj6611ie@fujitsu.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mhklinux@outlook.com \
--cc=pmladek@suse.com \
--cc=ryotkkr98@gmail.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