Re: Freezable workqueue blocks non-freezable workqueue during the system resume process

From: Tejun Heo
Date: Wed Mar 16 2016 - 11:01:03 EST


Hello, Jan, Alan.

On Tue, Mar 15, 2016 at 10:25:43AM +0100, Jan Kara wrote:
> > The kernel does suspend device drivers; that is, it invokes their
> > suspend callbacks. But it doesn't "freeze" them in any sense. Once a
> > driver has been suspended, it assumes it won't receive any I/O requests
> > until it has been resumed. Therefore the kernel first has to prevent
> > all the upper layers from generating such requests and/or sending them
> > to the low-level drivers.
>
> OK, so Tejun and you should talk together because you both seem to want
> something else... If I understand it right, Tejun wants suspended devices
> to just queue requests that have been submitted after these devices were
> suspended and complete them once they are resumed...

Yeah, I suppose that's why we have the code base we do now. I don't
think freezing kernel threads is the right mechanism to plug IO
devices during suspend. It's way too error-prone and causes a
dependency nightmare as it acts essentially as a system-wide lock.

More complex drivers already plug themselves which are necessary no
matter what as upper layers or some kthreads aren't the only sources
of commands to devices. We can plug at block layer for IOs coming
down from higher layers. We can even provide a mechanism to plug
certain kthreads if necessary but they should be contained in the
driver - e.g. the suspend callback specifically blocking certain
specific kthreads - instead of the vague "the system is generally
stopped now and it seems to work most of the time" that we're doing
now.

Thanks.

--
tejun