[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+-xHTG2E3zMmQSKdEJHC=nnf1AX-UQ=tPY0DDHDsozP+-QL_Q@mail.gmail.com>
Date: Wed, 14 Feb 2024 15:55:36 -0500
From: David Jeffery <djeffery@...hat.com>
To: Saravana Kannan <saravanak@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>, Laurence Oberman <loberman@...hat.com>,
Android Kernel Team <kernel-team@...roid.com>
Subject: Re: [RFC PATCH 1/6] minimal async shutdown infrastructure
On Tue, Feb 13, 2024 at 10:43 PM Saravana Kannan <saravanak@...gle.com> wrote:
>
> On Wed, Feb 7, 2024 at 10:40 AM David Jeffery <djeffery@...hat.com> wrote:
> >
> > + * Wait for all async shutdown operations currently active to complete
> > + */
> > +static void wait_for_active_async_shutdown(void)
> > +{
> > + struct device *dev, *parent;
> > +
> > + while (!list_empty(&async_shutdown_list)) {
> > + dev = list_entry(async_shutdown_list.next, struct device,
> > + kobj.entry);
> > +
> > + parent = dev->parent;
>
> I didn't check the code thoroughly, but so there might be other big
> issues. But you definitely need to take device links into account.
> Shutdown all your consumers first similar to how you shutdown the
> children devices first. Look at the async suspend/resume code for some
> guidance.
>
Sure, I'll work on adding that into the order rules.
> > @@ -110,6 +115,8 @@ struct device_driver {
> > void (*sync_state)(struct device *dev);
> > int (*remove) (struct device *dev);
> > void (*shutdown) (struct device *dev);
> > + void (*async_shutdown_start) (struct device *dev);
> > + void (*async_shutdown_end) (struct device *dev);
>
> Why not use the existing shutdown and call it from an async thread and
> wait for it to finish? Similar to how async probes are handled. Also,
> adding separate ops for this feels clunky and a very narrow fix. Just
> use a flag to indicate the driver can support async shutdown using the
> existing shutdown() op.
>
It is rather clunky. It was carried from older patches where I
mistakenly thought people wanted this separate interface. And adding
threads seemed like overkill. Others have been working on similar
patches on linux-nvme that I was unaware of. They add an optional
shutdown_wait call instead of this interface. I had planned on
adapting to work with their interface design.
David Jeffery
Powered by blists - more mailing lists