[PATCH 1/4] driver core: Support two-pass driver shutdown

Jeremy Allison jra at samba.org
Tue Jan 2 15:12:13 PST 2024


On Mon, Jan 01, 2024 at 11:23:05AM +0200, Sagi Grimberg wrote:
>
>>>From: Tanjore Suresh <tansuresh at google.com>
>>>
>>>This changes the bus driver interface with an additional entry point
>>>to enable devices to implement two-pass shutdown. The existing
>>>synchronous interface to shutdown is called, and if a shutdown_wait
>>>method is defined the device is moved to an alternate list.
>>>
>>>Once the shutdown method is called for all devices, the
>>>shutdown_wait method is then called synchronously for
>>>all devices on the alternate list.
>>
>>Christoph and Sagi noted that the objective is similar to "fire now
>>and wait for completion later."
>>
>>Would it be practical to actually *do* that, e.g., add a global
>>shutdown workqueue, have the .shutdown() method of nvme and similar
>>drivers add items to it, and have the driver core wait until
>>everything on that workqueue has completed?
>>
>>But I'm not a workqueue expert and I do see the scary warning at
>>https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/workqueue.h?id=v6.6#n619,
>>about not flushing system-wide workqueues, so maybe this wouldn't be
>>workable.
>
>I don't think that a workqueue is necessary. What I do think that we
>should document somewhere that .shutdown() can be synchronous or
>asynchronous when paired with .shutdown_wait().

It's not exactly asynchronous when paired with .shutdown_wait().
That's why I used the phrase "two-pass" instead of asynchronous.

Also, I already added this documentation:

+ * @shutdown_wait: Optional driver callback to allow two-pass shutdown.

in the struct pci_driver comment definition in one of the
previous patches.




More information about the Linux-nvme mailing list