driver core: fix async device shutdown hang
Subsystems (2)
PATCH 1/1 driver core: fix async device shutdown hang
Modify device_shutdown() so that supplier devices do not wait for consumer devices to be shut down first when the devlink is sync state only, since the consumer is not dependent on the supplier in this case.
Without this change, a circular dependency could hang the system.
---
The patch this fixes is in driver-core-next and linux-next.
Please let me know if this needs to be a V2 or if it needs anything else... it is the identical patch I sent in yesterday, except I added a "Fixes:" tag and the comments. Thank you for the help!
drivers/base/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/base/core.c +9 -1
@@ -4898,8 +4898,16 @@ void device_shutdown(void) idx =device_links_read_lock ();list_for_each_entry_rcu (link, &dev->links.suppliers, c_node, -device_links_read_lock_held ()) +device_links_read_lock_held ()) { +/* +* sync_state_only suppliers don't need to wait, +* aren't reordered on devices_kset, so making them +* wait could result in a hang +*/ +if (device_link_flag_is_sync_state_only (link->flags)) +continue ; link->supplier->p->shutdown_after = cookie; + }device_links_read_unlock (idx);put_device (dev);
Signature · 1 line
2.39.3
Greg Kroah-Hartman
maintainerQuoted 9 lines · Stuart Hayes
Modify
device_shutdown()so that supplier devices do not wait for consumer devices to be shut down first when the devlink is sync state only, since the consumer is not dependent on the supplier in this case.Without this change, a circular dependency could hang the system.
Fixes 8064952c6504 ("driver core: shut down devices asynchronously")Signed-off-by Stuart Hayes <[email protected]>
Nit, no blank line between Fixes: and signed-off-by is needed.
Quoted 6 lines
---
The patch this fixes is in driver-core-next and linux-next.Please let me know if this needs to be a V2 or if it needs anything else... it is the identical patch I sent in yesterday, except I added a "Fixes:" tag and the comments. Thank you for the help!
In theory, yes, this is a v2 as something did change, but I can take this as-is for now, thanks.
greg k-h
Quoted 9 lines · Stuart Hayes
Modify
device_shutdown()so that supplier devices do not wait for consumer devices to be shut down first when the devlink is sync state only, since the consumer is not dependent on the supplier in this case.Without this change, a circular dependency could hang the system.
Fixes 8064952c6504 ("driver core: shut down devices asynchronously")Signed-off-by Stuart Hayes <[email protected]>
All of my virtual testing seems happy with this change.
Quoted 35 lines
---
The patch this fixes is in driver-core-next and linux-next.Please let me know if this needs to be a V2 or if it needs anything else... it is the identical patch I sent in yesterday, except I added a "Fixes:" tag and the comments. Thank you for the help!
drivers/base/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/base/core.c +9
-1@@ -4898,8 +4898,16 @@ void device_shutdown(void) idx =device_links_read_lock ();list_for_each_entry_rcu (link, &dev->links.suppliers, c_node, -device_links_read_lock_held ()) +device_links_read_lock_held ()) { +/* +* sync_state_only suppliers don't need to wait, +* aren't reordered on devices_kset, so making them +* wait could result in a hang +*/ +if (device_link_flag_is_sync_state_only (link->flags)) +continue ; link->supplier->p->shutdown_after = cookie; + }device_links_read_unlock (idx);put_device (dev);Signature · 1 line
2.39.3