mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PM: sleep: Don't wait for SYNC_STATE_ONLY device links
@ 2025-09-09  9:43 Pin-yen Lin
  2025-09-10 11:56 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Pin-yen Lin @ 2025-09-09  9:43 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
	Danilo Krummrich, Saravana Kannan
  Cc: Hsin-Te Yuan, linux-kernel, linux-pm, Chen-Yu Tsai, Pin-yen Lin

Device links with DL_FLAG_SYNC_STATE_ONLY should not affect suspend
and resume, and functions like device_reorder_to_tail() and
device_link_add() doesn't try to reorder the consumers with such flag.

However, dpm_wait_for_consumers() and dpm_wait_for_suppliers() doesn't
check this flag before triggering dpm_wait, leading to potential hang
during suspend/resume.

Add DL_FLAG_SYNC_STATE_ONLY in dpm_wait_for_consumers() and
dpm_wait_for_suppliers() to fix this.

Fixes: 05ef983e0d65a ("driver core: Add device link support for SYNC_STATE_ONLY flag")
Signed-off-by: Pin-yen Lin <treapking@chromium.org>
---

 drivers/base/power/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 2ea6e05e6ec90..3271f4af2cb65 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -282,7 +282,8 @@ static void dpm_wait_for_suppliers(struct device *dev, bool async)
 	 * walking.
 	 */
 	list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
-		if (READ_ONCE(link->status) != DL_STATE_DORMANT)
+		if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
+		    !device_link_test(link, DL_FLAG_SYNC_STATE_ONLY))
 			dpm_wait(link->supplier, async);
 
 	device_links_read_unlock(idx);
@@ -339,7 +340,8 @@ static void dpm_wait_for_consumers(struct device *dev, bool async)
 	 * unregistration).
 	 */
 	list_for_each_entry_rcu_locked(link, &dev->links.consumers, s_node)
-		if (READ_ONCE(link->status) != DL_STATE_DORMANT)
+		if (READ_ONCE(link->status) != DL_STATE_DORMANT &&
+		    !device_link_test(link, DL_FLAG_SYNC_STATE_ONLY))
 			dpm_wait(link->consumer, async);
 
 	device_links_read_unlock(idx);
-- 
2.51.0.384.g4c02a37b29-goog


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

end of thread, other threads:[~2025-09-10 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-09  9:43 [PATCH] PM: sleep: Don't wait for SYNC_STATE_ONLY device links Pin-yen Lin
2025-09-10 11:56 ` Rafael J. Wysocki
2025-09-10 12:43   ` Pin-yen Lin
2025-09-10 13:09     ` Rafael J. Wysocki

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

all inboxes | Powered by JetHome®