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

Sagi Grimberg sagi at grimberg.me
Mon Jan 1 01:23:05 PST 2024


>> 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().



More information about the Linux-nvme mailing list