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

Bjorn Helgaas helgaas at kernel.org
Wed Dec 27 12:33:37 PST 2023


On Thu, Dec 21, 2023 at 09:22:54AM -0800, Jeremy Allison 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.

Bjorn



More information about the Linux-nvme mailing list