linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Jan Kara <jack@suse.cz>
Cc: Tejun Heo <tj@kernel.org>, Peter Chen <hzpeterchen@gmail.com>,
	<florian@mickler.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<usb-storage@lists.one-eyed-alien.net>, Jan Kara <jack@suse.com>,
	<jkosina@suse.cz>
Subject: Re: Freezable workqueue blocks non-freezable workqueue during the system resume process
Date: Mon, 14 Mar 2016 10:37:22 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1603141030070.1464-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20160314072234.GC5213@quack.suse.cz>

On Mon, 14 Mar 2016, Jan Kara wrote:

> On Fri 11-03-16 12:56:10, Tejun Heo wrote:
> > Hello, Jan.
> > 
> > On Thu, Mar 03, 2016 at 10:33:10AM +0100, Jan Kara wrote:
> > > > Ugh... that's nasty.  I wonder whether the right thing to do is making
> > > > writeback workers non-freezable.  IOs are supposed to be blocked from
> > > > lower layer anyway.  Jan, what do you think?
> > > 
> > > Well no, at least currently IO is not blocked in lower layers AFAIK - for
> > > that you'd need to freeze block devices & filesystems and there are issues
> > 
> > At least libata does and I think SCSI does too, but yeah, there
> > probably are drivers which depend on block layer blocking IOs, which
> > btw is a pretty fragile way to go about as upper layers might not be
> > the only source of activities.
> > 
> > > with that (Jiri Kosina was the last one which was trying to make this work
> > > AFAIR). And I think you need to stop writeback (and generally any IO) to be
> > > generated so that it doesn't interact in a strange way with device drivers
> > > being frozen. So IMO until suspend freezes filesystems & devices properly
> > > you have to freeze writeback workqueue.

What do you mean by "freezes ... devices"?  Only a piece of code can be 
frozen -- not a device.

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.

> > I still think the right thing to do is plugging that block layer or
> > low level drivers.  It's like we're trying to plug multiple sources
> > when we can plug the point where they come together anyway.
> 
> I agree that freezing writeback workers is a workaround for real issues at
> best and ideally we shouldn't have to do that. But at least for now I had
> the impression that it is needed for suspend to work reasonably reliably.

The design is not to plug low-level drivers, but instead to prevent
them from receiving any requests by plugging or freezing high-level
code.

It's pretty clear that we don't want to have ongoing I/O during a 
system suspend, right?  And that means the I/O has to be prevented (or 
"plugged", if you prefer) somewhere -- either at an upper layer or at a 
lower layer.  There was a choice to be made, and the decision was to do 
it at an upper layer.

Alan Stern

  reply	other threads:[~2016-03-14 14:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23  3:20 Freezable workqueue blocks non-freezable workqueue during the system resume process Peter Chen
2016-02-23  9:47 ` Peter Chen
2016-02-23 15:34 ` Alan Stern
2016-02-24  7:24   ` Peter Chen
2016-02-25 22:01     ` Tejun Heo
2016-02-26  6:19       ` Peter Chen
2016-03-02 16:00         ` Tejun Heo
2016-03-03  9:33           ` Jan Kara
2016-03-11 17:56             ` Tejun Heo
2016-03-14  7:22               ` Jan Kara
2016-03-14 14:37                 ` Alan Stern [this message]
2016-03-15  9:25                   ` Jan Kara
2016-03-16 15:00                     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44L0.1603141030070.1464-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=florian@mickler.org \
    --cc=hzpeterchen@gmail.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=usb-storage@lists.one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).