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

Christoph Hellwig
2024-06-27T05:55:39Z

On Wed, Jun 26, 2024 at 02:46:49PM -0500, Stuart Hayes wrote:
> Add code to allow asynchronous shutdown of devices, ensuring that each
> device is shut down before its parents & suppliers.
>
> Add async_shutdown_enable to struct device_driver, and expose it via sysfs.
> This can be used to view or change driver opt-in to asynchronous shutdown.
> Only devices with drivers that have async_shutdown_enable enabled will be
> shut down asynchronously.
>
> 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.

We discussed this before, but there is no summary of it and I of course
forgot the conclusion:

- why don't we do this by default?
- why is it safe to user enable it?

> + * @shutdown_after - used during device shutdown to ensure correct shutdown ordering.

Overly long line.

> +static ssize_t async_shutdown_enable_store(struct device_driver *drv, const char *buf,

.. and here.