[PATCH v6 3/4] driver core: shut down devices asynchronously

Jeremy Allison jra at samba.org
Wed Jun 12 14:02:31 PDT 2024


On Wed, Jun 12, 2024 at 02:55:11PM -0600, Keith Busch wrote:
>On Thu, May 16, 2024 at 10:49:19AM -0500, Stuart Hayes wrote:
>> Add code to shut down devices asynchronously, while ensuring that each
>> device is shut down before its parents & suppliers, and allowing devices
>> that share a driver to be shutdown one at a time if necessary.
>>
>> Add /sys/kernel/async_shutdown to allow user control of this feature:
>>
>>   safe: shut down all devices synchronously, unless driver prefers async
>> 	shutdown (driver opt-in) (default)
>>   on:	shut down all devices asynchronously, unless disabled by the driver
>> 	(driver opt-out)
>>   off:	shut down all devices synchronously
>>
>> Add async_shutdown to struct device_driver, and expose it via sysfs.
>> This will be used to view or change driver opt-in/opt-out of asynchronous
>> shutdown, if it is globally enabled.
>>
>>  async:   driver opt-in to async device shutdown (devices will be shut down
>>           asynchronously if async_shutdown is "on" or "safe")
>>  sync:    driver opt-out of async device shutdown (devices will always be
>>           shut down synchronously)
>>  default: devices will be shutdown asynchronously if async_shutdown is "on"
>>
>> 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.
>
>I've successfully tested this out on a few systems, and noticing a very
>decent shutdown time on my nvme systems. I also like the current
>solution here, as the two-pass method was harder to follow.
>
>So I think just remove the extra options that Christoph mentioned and
>always use the driver's preferred shutdown method, then this would all
>look good to me.

Yes, I have tested this patch on my systems and am greatly in
favour of this instead of the two-pass version I was trying
to make work. It is easy to understand and fixes the problem
for my NVME issue.

Jeremy.



More information about the Linux-nvme mailing list