From: Tony Lindgren <tony@atomide.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Johan Hovold <johan@kernel.org>,
linux-serial@vger.kernel.org, kernel@pengutronix.de,
Steffen Trumtrar <s.trumtrar@pengutronix.de>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
regressions@lists.linux.dev
Subject: Re: [PATCH] serial: 8250: Return early in .start_tx() if there are no chars to send
Date: Thu, 7 Apr 2022 16:27:22 +0300 [thread overview]
Message-ID: <Yk7muv2McT5Sjqbk@atomide.com> (raw)
In-Reply-To: <20220217211839.443039-1-u.kleine-koenig@pengutronix.de>
Hi,
* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [700101 02:00]:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>
> Don't start the whole chain for TX if there is no data to send. This is
> mostly relevant for rs485 mode as there might be rts-before-send and
> rts-after-send delays involved.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> a few other drivers have such an early exit already (imx, stm32-usart).
> I wonder if it applies to all UART drivers that there is nothing to do
> in .start_tx() if the circ buffer is empty and there is no x_char to
> send. In this case it would be more sensible to ensure in serial_core
> that .start_tx() is only ever called if there is something to do.
This patch seems to cause a runtime PM regression in v5.18-rc1 where
8250 is never idled for omaps.
Looks like the return added here is not paired with put for the
serial8250_rpm_get_tx() call above?
Regards,
Tony
#regzbot ^introduced 932d596378b0
> drivers/tty/serial/8250/8250_port.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 3b12bfc1ed67..5d4668f12f71 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1657,6 +1657,9 @@ static void serial8250_start_tx(struct uart_port *port)
>
> serial8250_rpm_get_tx(up);
>
> + if (!port->x_char && uart_circ_empty(&port->state->xmit))
> + return;
> +
> if (em485 &&
> em485->active_timer == &em485->start_tx_timer)
> return;
>
> base-commit: 754e0b0e35608ed5206d6a67a791563c631cec07
> --
> 2.34.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Johan Hovold <johan@kernel.org>,
linux-serial@vger.kernel.org, kernel@pengutronix.de,
Steffen Trumtrar <s.trumtrar@pengutronix.de>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
regressions@lists.linux.dev
Subject: Re: [PATCH] serial: 8250: Return early in .start_tx() if there are no chars to send
Date: Thu, 7 Apr 2022 16:27:22 +0300 [thread overview]
Message-ID: <Yk7muv2McT5Sjqbk@atomide.com> (raw)
In-Reply-To: <20220217211839.443039-1-u.kleine-koenig@pengutronix.de>
Hi,
* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [700101 02:00]:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>
> Don't start the whole chain for TX if there is no data to send. This is
> mostly relevant for rs485 mode as there might be rts-before-send and
> rts-after-send delays involved.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> a few other drivers have such an early exit already (imx, stm32-usart).
> I wonder if it applies to all UART drivers that there is nothing to do
> in .start_tx() if the circ buffer is empty and there is no x_char to
> send. In this case it would be more sensible to ensure in serial_core
> that .start_tx() is only ever called if there is something to do.
This patch seems to cause a runtime PM regression in v5.18-rc1 where
8250 is never idled for omaps.
Looks like the return added here is not paired with put for the
serial8250_rpm_get_tx() call above?
Regards,
Tony
#regzbot ^introduced 932d596378b0
> drivers/tty/serial/8250/8250_port.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 3b12bfc1ed67..5d4668f12f71 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1657,6 +1657,9 @@ static void serial8250_start_tx(struct uart_port *port)
>
> serial8250_rpm_get_tx(up);
>
> + if (!port->x_char && uart_circ_empty(&port->state->xmit))
> + return;
> +
> if (em485 &&
> em485->active_timer == &em485->start_tx_timer)
> return;
>
> base-commit: 754e0b0e35608ed5206d6a67a791563c631cec07
> --
> 2.34.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-04-07 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 21:18 [PATCH] serial: 8250: Return early in .start_tx() if there are no chars to send Uwe Kleine-König
2022-02-22 8:20 ` Jiri Slaby
2022-04-07 13:27 ` Tony Lindgren [this message]
2022-04-07 13:27 ` Tony Lindgren
2022-04-11 9:56 ` Tony Lindgren
2022-04-11 9:56 ` Tony Lindgren
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=Yk7muv2McT5Sjqbk@atomide.com \
--to=tony@atomide.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=s.trumtrar@pengutronix.de \
--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.