linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	linux-serial <linux-serial@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH] Revert "serial: fsl_lpuart: Reset prior to registration"
Date: Mon, 10 Oct 2022 11:09:30 +0200	[thread overview]
Message-ID: <20221010090930.GA23968@wunner.de> (raw)
In-Reply-To: <AS8PR04MB84047F39CD10C00CEE29213F92219@AS8PR04MB8404.eurprd04.prod.outlook.com>

On Sun, Oct 09, 2022 at 10:23:13AM +0000, Sherry Sun wrote:
> I am not familiar with 8250 serial, but at least for imx uart driver
> and lpuart driver, the following behavior is same.
> For the "real" consoles (everything which is not a bootconsole),
> the (port)->cons and (port)->cons->index are initialized through
> uart_add_one_port()->uart_configure_port()->register_console()->
> try_enable_new_console(), here the console index is assigned by
> the console cmdline parameters.

Hm, uart_add_one_port() does the following *before* calling
uart_configure_port():

	/*
	 * If this port is in use as a console then the spinlock is already
	 * initialised.
	 */
	if (!uart_console_enabled(uport))
		uart_port_spin_lock_init(uport);

It sounds like in the case of fsl_lpuart.c, the spin lock is *always*
initialized, even though a concurrent lpuart_console_write() may be
holding it.  That's not solved by moving lpuart_global_reset() around.

The problem with performing lpuart_global_reset() after UART registration
is that as soon as uart_add_one_port() returns, the port is available
for user space to use.  So resetting it is a no-go.

Thanks,

Lukas

  reply	other threads:[~2022-10-10  9:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29  8:53 [PATCH] Revert "serial: fsl_lpuart: Reset prior to registration" Sherry Sun
2022-09-29 10:51 ` Ilpo Järvinen
2022-09-29 11:10   ` Sherry Sun
2022-09-29 11:19     ` Ilpo Järvinen
2022-09-30  8:02       ` Sherry Sun
2022-09-30 12:59         ` Ilpo Järvinen
2022-10-09 10:23           ` Sherry Sun
2022-10-10  9:09             ` Lukas Wunner [this message]
2022-10-11  8:07               ` Sherry Sun
2022-12-06 14:51 ` Francesco Dolcini
2022-12-06 15:08   ` Francesco Dolcini

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=20221010090930.GA23968@wunner.de \
    --to=lukas@wunner.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sherry.sun@nxp.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;
as well as URLs for NNTP newsgroup(s).