[PATCH 1/3] driver core: Support asynchronous driver shutdown

Jeremy Allison jra at samba.org
Mon Dec 18 22:19:43 PST 2023


On Tue, Dec 19, 2023 at 06:33:18AM +0100, Christoph Hellwig wrote:
>On Thu, Dec 14, 2023 at 04:03:56PM -0800, Jeremy Allison wrote:
>> From: Tanjore Suresh <tansuresh at google.com>
>>
>> This changes the bus driver interface with additional entry points
>> to enable devices to implement asynchronous shutdown. The existing
>> synchronous interface to shutdown is unmodified and retained for
>> backward compatibility. shutdown_pre is only called if a matching
>> shutdown_post function is also registered, otherwise the synchronous
>> synchronous interface is used.
>>
>> This changes the common device shutdown code to enable devices to
>> participate in asynchronous shutdown implementation.
>
>Is there any reason to have a separate shutdown_pre method?
>Especially with all the method wrapping in the driver core, yet
>another method just keeps confusing everyone.

Currently in the patch the existence of a shutdown_pre() method
for a device causes it to be added to the async_shutdown_list
which is walked to reap the completion status after all the
calls to shutdown_pre().

I could change this so that the existing shutdown() method
is always called, and the device is only added to the async_shutdown_list
if a shutdown_post() (or as requested below, shutdown_wait())
method is defined for the device.

That makes sense to me and I'm happy to make that change.

>And on the post side, might shutdown_wait be a better name to
>describe the operation, but I'm open to opinions.

I'm happy to change shutdown_post() -> shudown_wait().

shutdown_pre()/post() seemed a natural fit, but if we're removing
shutdown_pre() then shudown_wait() works.



More information about the Linux-nvme mailing list