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

Saravana Kannan saravanak at google.com
Wed Feb 14 13:36:28 PST 2024


On Wed, Feb 14, 2024 at 12:10 AM Christoph Hellwig <hch at lst.de> wrote:
>
> On Tue, Feb 13, 2024 at 07:36:35PM -0800, Saravana Kannan wrote:
> > > 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.
> >
> > This sounds more like you need a parallelized async shutdown than a
> > two-pass shutdown. Similar to how async probes are done today. Why not
> > do that so it'll actually be useful in a more general fashion? You can
> > even add a flag like we have for probes so that drivers don't need to
> > do anything special to allow this parallelism.
>
> Well, we had that discussion before.

Can you point me to this please? I looked around and wasn't able to find it.

> The typically time consuming
> part in a shutdown is waiting for the device to actually shut down.
> An submit and then wait later scheme is more efficient for that,

This seems like yet another one of those "who needs more than X
levels" issue we run into with initcalls. We are finally getting rid
of that with fw_devlink and device links. This two stage approach
breaks down as soon as there is any kind of dependency order that
needs to be maintained across device shutdown.

> even if the "simple" async shutdown that just spawns more threads
> will also work, while being a lot less efficient.

Lot less efficient how? Shutdown is not a frequent / hot path event. I
don't think the number of threads spawned is an efficiency concern as
long as it's faster and is not fragile to use in a generic fashion for
all devices.

> So unless we
> have a strong reason for that the two-phase scheme seems preferable
> to me.

I think the strong reason is dependency tracking and ordering doesn't
work with a 2 pass system. Dependency levels are often several levels
deep.

-Saravana



More information about the Linux-nvme mailing list