All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	u.kleine-koenig@pengutronix.de,
	"Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: sherry.sun@nxp.com, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH] tty: serial: fsl_lpuart: mark last busy before uart_add_one_port
Date: Thu, 08 Aug 2024 17:27:40 +0200	[thread overview]
Message-ID: <3306657.aeNJFYEL58@steina-w> (raw)
In-Reply-To: <20240808140325.580105-1-peng.fan@oss.nxp.com>

Am Donnerstag, 8. August 2024, 16:03:25 CEST schrieb Peng Fan (OSS):
> From: Peng Fan <peng.fan@nxp.com>
> 
> With "earlycon initcall_debug=1 loglevel=8" in bootargs, kernel
> sometimes boot hang. It is because normal console still is not ready,
> but runtime suspend is called, so early console putchar will hang
> in waiting TRDE set in UARTSTAT.
> 
> The lpuart driver has auto suspend delay set to 3000ms, but during
> uart_add_one_port, a child device serial ctrl will added and probed with
> its pm runtime enabled(see serial_ctrl.c).
> The runtime suspend call path is:
> device_add
>      |-> bus_probe_device
>            |->device_initial_probe
> 	           |->__device_attach
>                          |-> pm_runtime_get_sync(dev->parent);
> 			 |-> pm_request_idle(dev);
> 			 |-> pm_runtime_put(dev->parent);
> 
> So in the end, before normal console ready, the lpuart get runtime
> suspended. And earlycon putchar will hang.
> 
> To address the issue, mark last busy just after pm_runtime_enable,
> three seconds is long enough to switch from bootconsole to normal
> console.
> 
> Fixes: 43543e6f539b ("tty: serial: fsl_lpuart: Add runtime pm support")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/tty/serial/fsl_lpuart.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index 615291ea9b5e..77efa7ee6eda 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
> @@ -2923,6 +2923,7 @@ static int lpuart_probe(struct platform_device *pdev)
>  	pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT);
>  	pm_runtime_set_active(&pdev->dev);
>  	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_mark_last_busy(&pdev->dev);

This change looks sensible to me. Is maybe [1] addressing the same issue at a
different level?

Best regards,
Alexander

[1] https://lore.kernel.org/all/20240808-gs101-non-essential-clocks-2-v6-0-e91c537acedc@linaro.org/

>  
>  	ret = lpuart_global_reset(sport);
>  	if (ret)
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



  reply	other threads:[~2024-08-08 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 14:03 [PATCH] tty: serial: fsl_lpuart: mark last busy before uart_add_one_port Peng Fan (OSS)
2024-08-08 15:27 ` Alexander Stein [this message]
2024-08-09  7:09   ` Peng Fan

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=3306657.aeNJFYEL58@steina-w \
    --to=alexander.stein@ew.tq-group.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=sherry.sun@nxp.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.