Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH v2] serial: xilinx_uartps: fix runtime PM race during probe
@ 2026-11-09  7:19 Radhey Shyam Pandey
  2026-11-09  7:31 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Radhey Shyam Pandey @ 2026-11-09  7:19 UTC (permalink / raw)
  To: gregkh, jirislaby, michal.simek
  Cc: linux-kernel, linux-serial, linux-arm-kernel, git,
	Shubhrajyoti Datta, Radhey Shyam Pandey

From: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>

pm_runtime_enable() was called with usage_count=0, allowing the PM
core to immediately queue a deferred suspend via pm_runtime_work.
This raced with console write, causing cdns_runtime_suspend to
fire before the port was fully registered.

Hold a reference with pm_runtime_get_noresume() before enabling
runtime PM.

Fixes: d62100f1aac2 ("serial: xilinx_uartps: Add pm runtime support")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
---
Changes for v2:
- Add my signed-off tag.
Link to v1: https://lore.kernel.org/all/20261109070915.727524-1-radhey.shyam.pandey@amd.com
- Use latest base.
---
 drivers/tty/serial/xilinx_uartps.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index e8c4b1fa7658..aa3e820760b1 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1799,6 +1799,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT);
 	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_get_noresume(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 	device_init_wakeup(port->dev, true);
 
@@ -1823,6 +1824,8 @@ static int cdns_uart_probe(struct platform_device *pdev)
 			"uart_add_one_port() failed; err=%i\n", rc);
 		goto err_out_pm_disable;
 	}
+	pm_runtime_mark_last_busy(&pdev->dev);
+	pm_runtime_put_autosuspend(&pdev->dev);
 
 #ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
 	/* This is not port which is used for console that's why clean it up */
@@ -1841,6 +1844,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
 	return 0;
 
 err_out_pm_disable:
+	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);

base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
-- 
2.44.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] serial: xilinx_uartps: fix runtime PM race during probe
  2026-11-09  7:19 [PATCH v2] serial: xilinx_uartps: fix runtime PM race during probe Radhey Shyam Pandey
@ 2026-11-09  7:31 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-09  7:31 UTC (permalink / raw)
  To: Radhey Shyam Pandey; +Cc: linux-serial

> From: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
> 
> pm_runtime_enable() was called with usage_count=0, allowing the PM
> core to immediately queue a deferred suspend via pm_runtime_work.
> This raced with console write, causing cdns_runtime_suspend to
> fire before the port was fully registered.
> 
> Hold a reference with pm_runtime_get_noresume() before enabling
> runtime PM.
> 
> Fixes: d62100f1aac2 ("serial: xilinx_uartps: Add pm runtime support")
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109071916.731116-1-radhey.shyam.pandey@amd.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-09  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09  7:19 [PATCH v2] serial: xilinx_uartps: fix runtime PM race during probe Radhey Shyam Pandey
2026-11-09  7:31 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox