diff mbox series

[RESEND,2/2] serial: 8250: omap: Move pm_runtime_get_sync

Message ID 20241011173356.870883-3-jm@ti.com
State Superseded
Headers show
Series Misc OMAP GPIO/UART fixes | expand

Commit Message

Judith Mendez Oct. 11, 2024, 5:33 p.m. UTC
Currently in omap_8250_shutdown, the dma->rx_running
flag is set to zero in omap_8250_rx_dma_flush. Next
pm_runtime_get_sync is called, which is a runtime
resume call stack which can re-set the flag. When the
call omap_8250_shutdown returns, the flag is expected
to be UN-SET, but this is not the case. This is causing
issues the next time UART is re-opened and omap_8250_rx_dma
is called. Fix by moving pm_runtime_get_sync before the
omap_8250_rx_dma_flush.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Judith Mendez <jm@ti.com>
---
 drivers/tty/serial/8250/8250_omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kevin Hilman Oct. 12, 2024, 12:19 a.m. UTC | #1
Judith Mendez <jm@ti.com> writes:

> Currently in omap_8250_shutdown, the dma->rx_running
> flag is set to zero in omap_8250_rx_dma_flush. Next
> pm_runtime_get_sync is called, which is a runtime
> resume call stack which can re-set the flag. When the
> call omap_8250_shutdown returns, the flag is expected
> to be UN-SET, but this is not the case. This is causing
> issues the next time UART is re-opened and omap_8250_rx_dma
> is called. Fix by moving pm_runtime_get_sync before the
> omap_8250_rx_dma_flush.
>
> Signed-off-by: Bin Liu <b-liu@ti.com>
> Signed-off-by: Judith Mendez <jm@ti.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>

Gave this a quick boot test on am335x-boneblack and am57xx-beagle-x15.

I realize that doesn't really test the DMA paths involved here, but at
least it doesn't break basic boot to serial console, and the change
looks coorect.

Thanks for sending a fix for this.

Kevin
Greg KH Oct. 12, 2024, 8:03 a.m. UTC | #2
On Fri, Oct 11, 2024 at 12:33:56PM -0500, Judith Mendez wrote:
> Currently in omap_8250_shutdown, the dma->rx_running
> flag is set to zero in omap_8250_rx_dma_flush. Next
> pm_runtime_get_sync is called, which is a runtime
> resume call stack which can re-set the flag. When the
> call omap_8250_shutdown returns, the flag is expected
> to be UN-SET, but this is not the case. This is causing
> issues the next time UART is re-opened and omap_8250_rx_dma
> is called. Fix by moving pm_runtime_get_sync before the
> omap_8250_rx_dma_flush.

You can go to 72 columns :)

> Signed-off-by: Bin Liu <b-liu@ti.com>
> Signed-off-by: Judith Mendez <jm@ti.com>

Wait, who wrote this, Bin?  If so, there needs to be a "From:" line
saying so.

What commit id does this fix?  Do you want it backported to older
kernels?  Why mix two different subsystems in the same patch series, who
is supposed to take it?

thanks,

greg k-h
Andreas Kemnade Oct. 12, 2024, 12:27 p.m. UTC | #3
Am Fri, 11 Oct 2024 12:33:56 -0500
schrieb Judith Mendez <jm@ti.com>:

> Currently in omap_8250_shutdown, the dma->rx_running
> flag is set to zero in omap_8250_rx_dma_flush. Next
> pm_runtime_get_sync is called, which is a runtime
> resume call stack which can re-set the flag. When the
> call omap_8250_shutdown returns, the flag is expected
> to be UN-SET, but this is not the case. This is causing
> issues the next time UART is re-opened and omap_8250_rx_dma
> is called. Fix by moving pm_runtime_get_sync before the
> omap_8250_rx_dma_flush.
> 
> Signed-off-by: Bin Liu <b-liu@ti.com>
> Signed-off-by: Judith Mendez <jm@ti.com>

Is this a theorectical problem or some real practical problem?
So you are running a system with runtime pm enabled on serial
console.
How did you come across this issue?
I could run the serial console/getty with runtime pm autosuspend enabled
without issues all the years.

Regards,
Andreas
Judith Mendez Oct. 17, 2024, 6:47 p.m. UTC | #4
Hi Greg,

On 10/12/24 3:03 AM, Greg KH wrote:
> On Fri, Oct 11, 2024 at 12:33:56PM -0500, Judith Mendez wrote:
>> Currently in omap_8250_shutdown, the dma->rx_running
>> flag is set to zero in omap_8250_rx_dma_flush. Next
>> pm_runtime_get_sync is called, which is a runtime
>> resume call stack which can re-set the flag. When the
>> call omap_8250_shutdown returns, the flag is expected
>> to be UN-SET, but this is not the case. This is causing
>> issues the next time UART is re-opened and omap_8250_rx_dma
>> is called. Fix by moving pm_runtime_get_sync before the
>> omap_8250_rx_dma_flush.
> 
> You can go to 72 columns :)

ok, will fix, thanks!

> 
>> Signed-off-by: Bin Liu <b-liu@ti.com>
>> Signed-off-by: Judith Mendez <jm@ti.com>
> 
> Wait, who wrote this, Bin?  If so, there needs to be a "From:" line
> saying so.

I did not realize I could create a patch for someone, apologies, I
will be sending v3 with correct "From:".

> 
> What commit id does this fix?  Do you want it backported to older
> kernels?  Why mix two different subsystems in the same patch series, who
> is supposed to take it?


I suppose it should be backported to older kernels so I will add back
the fixes tag.

Apologies for sending two different subsystems in one series, I thought
describing as "misc" would be good enough to mix the two, but I can
separate the patches and respin. Thanks.

~ Judith


> 
> thanks,
> 
> greg k-h
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 88b58f44e4e9..0dd68bdbfbcf 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -776,12 +776,12 @@  static void omap_8250_shutdown(struct uart_port *port)
 	struct uart_8250_port *up = up_to_u8250p(port);
 	struct omap8250_priv *priv = port->private_data;
 
+	pm_runtime_get_sync(port->dev);
+
 	flush_work(&priv->qos_work);
 	if (up->dma)
 		omap_8250_rx_dma_flush(up);
 
-	pm_runtime_get_sync(port->dev);
-
 	serial_out(up, UART_OMAP_WER, 0);
 	if (priv->habit & UART_HAS_EFR2)
 		serial_out(up, UART_OMAP_EFR2, 0x0);