shut down devices asynchronously
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v22 Latest posting 2/29 patches 1 replyIn review
- v22 posting 1/29 patches 1 replySuperseded
- v219 patches 1 replySuperseded
Earlier versions · 9
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v20 | 9 patches | 2 replies | Superseded | |
| v18 | 5 patches | 2 replies | Superseded | |
| v17 | 5 patches | 2 replies | Superseded | |
| v16 | 5 patches | 2 replies | Superseded | |
| v15 | 5 patches | 4 replies | Superseded | |
| v14 | 5 patches | 7 replies | Superseded | |
| v13 | 5 patches | 6 replies | Superseded | |
| v12 | 5 patches | 4 replies | Superseded | |
| v11 | 0 of 5 patches | 1 reply | Superseded |
Changes in v22 from the cover letter
- Check a device is alive before accessing its bus pointer
Patches in v22 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | driver core: rely on put_device to free dev->pdrivers/ | +1 | 0 replies | |
| 2/9 | driver core: prevent device_add() during system shutdowndrivers/ | +29 | 0 replies | |
| 3/9 | driver core: warn should device_move try to move a need_parent_lock devicedrivers/ | +8 | 0 replies | |
| 4/9 | driver core: separate function to shutdown one devicedrivers/ | +35 | 0 replies | |
| 5/9 | driver core: do not always lock parent in shutdowndrivers/ | +28 | 0 replies | |
| 6/9 | driver core: async device shutdown infrastructureDocumentation/ drivers/ drivers/ +1 more | +154 | 1 reply | |
| 7/9 | PCI: Link a virtual function to its physical functiondrivers/ | +9 | 0 replies | |
| 8/9 | PCI: Enable async shutdown supportdrivers/ | +2 | 0 replies | |
| 9/9 | scsi: Enable async shutdown supportdrivers/ drivers/ | +5 | 0 replies |
Reviews trailers per patch
4 of 9 patches have a Reviewed-by or Acked-by.
| Patch | Laurence Oberman | Martin K. Petersen | Pasha Tatashin | Bjorn Helgaas | John Garry |
|---|---|---|---|---|---|
| 1/9 | T-b | ||||
| 2/9 | T-b | ||||
| 3/9 | T-b | ||||
| 4/9 | T-b | R-b | R-b | ||
| 5/9 | T-b | ||||
| 6/9 | T-b | ||||
| 7/9 | T-b | R-b | |||
| 8/9 | T-b | R-b | R-b | R-b | |
| 9/9 | T-b | R-b | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.
Cover letter [PATCH RESEND v22 0/9] shut down devices asynchronously
These patches are rebased against the driver-core tree's driver-core-next branch and should also apply against recent linux-next. No issues were found by sashiko on original posting of v22.
Would this series be more acceptable if default enablement of async shutdown was controlled by Kconfig and either disabled by default or only enabled on x86_64 by default?
This patchset allows the kernel to shutdown devices asynchronously and unrelated async devices to be shut down in parallel to each other.
Only devices which explicitly enable it are shut down asynchronously. The default is for a device to be shut down from the synchronous shutdown loop.
This can dramatically reduce system shutdown/reboot time on systems that have multiple devices that take many seconds to shut down (like certain NVMe drives). On one system tested, the shutdown time went from 11 minutes without this patch to 55 seconds with the patch. And on another system from 80 seconds to 11.
Changes from V21:
- Check a device is alive before accessing its bus pointer
Changes from V20:
- Move PCI bridge async enablement to before its call to device_add
- Use srcu to prevent ensure any active device_add is completed before device_shutdown begins shutting down devices.
Changes from V19:
- Convert initial creation of shutdown_one_device to a code move with no changes or side effects
- Add a warning to device_move should some device ever mix need_parent_lock with device_move in the future
- Link a PCI virtual function as consumer of its associated physical function to ensure proper shutdown order
Changes from V18:
- Fix deadlock and race condition on concurrent device_add
- Use local variable to device_shutdown for caching async_shutdown
- Added dev->p check to avoid NULL pointer deference and tell if the device is not registered so no need to be shutdown. This is to handle the cases when devices consumers list might have devices that are not yet registered.
Changes from V17:
Fix mangled text in kernel parameter description
Re-protect the list removal with the spinlock
* Hold a device reference to ensure the device cannot be freed before attempting list removal
Changes from V16:
Drop spinlock before async subsystem call which uses GFP_KERNEL Handle that async shutdown can widen races between device shutdown and deletion
* __shutdown_one_device will immediately return if a device is dead
* Set shutdown device completion to complete when marking a device dead to prevent waiting on a dead device
* Only late-access a parent pointer if device is in a non-dead state to ensure the pointer is still valid
Changes from V15:
The async_shutdown bit field is converted to a device flags bit Convert all patches to use the flag bit accessor macros to set or check if
async shutdown should be used
Added documentation on the kernel parameter to control use of async shutdown
Changes from V14:
Remove unneeded use of '!!' with boolean type
Changes from V13:
Remove duplicate flagging of async shutdown on scsi hosts/targets/devices
Changes from V12:
Only acquire a parent reference if acquiring the parent's lock device_enable_async_shutdown should return void Minor comment and description cleanups
Changes from V11:
* Swap the order of the first two patches
* Rework conditional parent locking so that lock and unlock no longer use separate conditional checks
* Remove an used variable
* Comment and description text cleanups
Changes from V10:
Reworked to more closely match the design used for async suspend
* No longer uses async subsystem cookies for synchronization
* Minimized changes to struct device
* Enable async shutdown for pci and scsi devices which support async suspend
Changes from V9:
Address resource and timing issues when spawning a unique async thread for every device during shutdown:
* Make the asynchronous threads able to shut down multiple devices, instead of spawning a unique thread for every device.
* Modify core kernel async code with a custom wake function so it doesn't wake up a thread waiting to synchronize on a cookie until the cookie has reached the desired value, instead of waking up every waiting thread to check the cookie every time an async thread ends.
Changes from V8:
Deal with shutdown hangs resulting when a parent/supplier device is
later in the devices_kset list than its children/consumers:
* Ignore sync_state_only devlinks for shutdown dependencies
* Ignore shutdown_after for devices that don't want async shutdown
* Add a sanity check to revert to sync shutdown for any device that would otherwise wait for a child/consumer shutdown that hasn't already been scheduled
Changes from V7:
Do not expose driver async_shutdown_enable in sysfs. Wrapped a long line.
Changes from V6:
Removed a sysfs attribute that allowed the async device shutdown to be "on" (with driver opt-out), "safe" (driver opt-in), or "off"... what was previously "safe" is now the only behavior, so drivers now only need to have the option to enable or disable async shutdown.
Changes from V5:
Separated into multiple patches to make review easier. Reworked some code to make it more readable
Made devices wait for consumers to shut down, not just children
(suggested by David Jeffery)
Changes from V4:
Change code to use cookies for synchronization rather than async domains Allow async shutdown to be disabled via sysfs, and allow driver opt-in or
opt-out of async shutdown (when not disabled), with ability to control driver opt-in/opt-out via sysfs
Changes from V3:
Bug fix (used "parent" not "dev->parent" in device_shutdown)
Changes from V2:
Removed recursive functions to schedule children to be shutdown before
parents, since existing device_shutdown loop will already do this
Changes from V1:
Rewritten using kernel async code (suggested by Lukas Wunner)
David Jeffery (7):
driver core: warn should device_move try to move a need_parent_lock
device
driver core: separate function to shutdown one device driver core: do not always lock parent in shutdown driver core: async device shutdown infrastructure
PCI: Link a virtual function to its physical function
PCI: Enable async shutdown support
scsi: Enable async shutdown support
Tarun Sahu (2):
driver core: rely on put_device to free dev->p driver core: prevent device_add() during system shutdown
.../admin-guide/kernel-parameters.txt | 10 + drivers/base/base.h | 2 + drivers/base/core.c | 269 +++++++++++++++--- drivers/pci/iov.c | 11 +- drivers/pci/probe.c | 2 + drivers/scsi/hosts.c | 2 + drivers/scsi/scsi_sysfs.c | 3 + include/linux/device.h | 2 + 8 files changed, 260 insertions(+), 41 deletions(-)
Signature · 1 line
2.55.0