From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Oliver Neukum <oliver@neukum.org>
Cc: mjg59@srcf.ucam.org, Miklos Szeredi <miklos@szeredi.hu>,
linux-kernel@vger.kernel.org, pavel@ucw.cz,
johannes@sipsolutions.net, linux-pm@lists.linux-foundation.org
Subject: Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway
Date: Sat, 07 Jul 2007 12:44:45 +1000 [thread overview]
Message-ID: <1183776285.3388.201.camel@localhost.localdomain> (raw)
In-Reply-To: <200707061131.08475.oliver@neukum.org>
On Fri, 2007-07-06 at 11:31 +0200, Oliver Neukum wrote:
> Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
> > On Fri, 2007-07-06 at 09:13 +0200, Rafael J. Wysocki wrote:
> > >
> > > The only reason (I know of) why we don't handle uninterruptible tasks in the
> > > freezer is that we're afraid of the suspend process deadlocking with an
> > > uninterruptible task holding a lock, but AFAICS the probability of such an
> > > event is extremely small.
> >
> > What would deadlock specifically ? One of the drivers trying to acquire
> > that lock ? It would be a driver bug then.
>
> Your driver's write method looks like:
>
> mutex_lock();
> poke_some_hardware();
> wait_event_uninterruptible(); //for result
> res = evaluate_result();
> mutex_unlock();
> return res;
>
> If you put a task into the refrigerator at wait_event_interruptible()
> you will deadlock if you need this lock for the driver to go to suspend.
> The suspend method then must not take the lock _and_ it must be
> aware that there may be an ongoing operation.
Well... 2 things here. Either you have a freezer in which case the
chances of the above scenario are increased, or you don't, in which case
your suspend method will just sleep on the lock until outstanding HW
accesses that have that lock are completed, and everything is fine.
You need to be careful with one thing though, whether you have a freezer
or not. If you driver, in some code path, whatever it is (ioctl, kernel
thread, workqueue, ...) does something like:
mutex_lock
kmalloc(...,GFP_KERNEL);
mutex_unlock
And it's suspend callback then does:
mutex_lock
The problem here is that the disks might already have been suspended
prior to your driver being called. Thus, any attempt at pushing things
out to swap or dirty mmap'ings back to storage will hang, thus kmalloc
can potentially hang (afaik), and you will deadlock.
That's what I've been talking about earlier when I said that we should
have some security in SLAB/SLUB/Buddy allocators, to silently turn
GFP_KERNEL to at least GFP_NOIO or even ATOMIC before we start
suspending drivers.
Now, another way to deal with that would have to use
pre-suspend/post-resume notifications, and have drivers avoid doing the
above between those, but that's much harder. (Essentially, drivers would
have to either make sure they don't do things like blocking allocations,
even implicitely, or possibly fall back to a degraded synchronous mode
or that sort of thing).
I think it's much simpler to tweak slab/slub/buddy instead :-)
Note that the above issue is orthogonal to our freezer discussion, it's
just one of the potential deadlock cause we have with suspend that needs
to be fixed.
Cheers,
Ben.
next prev parent reply other threads:[~2007-07-07 2:44 UTC|newest]
Thread overview: 143+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44L0.0707051713440.2753-100000@iolanthe.rowland.org>
2007-07-05 21:26 ` Re: [PATCH] Remove process freezer from suspend to RAM pathway Miklos Szeredi
2007-07-05 21:37 ` Oliver Neukum
[not found] ` <200707052337.27066.oliver@neukum.org>
2007-07-06 7:13 ` Rafael J. Wysocki
[not found] ` <200707060913.24131.rjw@sisk.pl>
2007-07-06 8:59 ` Benjamin Herrenschmidt
2007-07-06 9:31 ` Oliver Neukum
[not found] ` <200707061131.08475.oliver@neukum.org>
2007-07-06 9:53 ` Rafael J. Wysocki
2007-07-07 2:44 ` Benjamin Herrenschmidt [this message]
2007-07-07 20:48 ` Rafael J. Wysocki
[not found] ` <200707072248.06970.rjw@sisk.pl>
2007-07-08 0:50 ` Benjamin Herrenschmidt
[not found] ` <200707061153.05091.rjw@sisk.pl>
2007-07-07 2:46 ` Benjamin Herrenschmidt
[not found] <Pine.LNX.4.44L0.0707051014180.3728-100000@iolanthe.rowland.org>
2007-07-05 22:59 ` Benjamin Herrenschmidt
2007-07-06 7:20 ` Rafael J. Wysocki
2007-07-06 15:13 ` Alan Stern
2007-07-07 7:56 ` Pavel Machek
[not found] ` <Pine.LNX.4.44L0.0707061111050.3737-100000@iolanthe.rowland.org>
2007-07-08 7:19 ` Paul Mackerras
[not found] <Pine.LNX.4.44L0.0707051704580.2557-100000@iolanthe.rowland.org>
2007-07-05 21:15 ` Oliver Neukum
[not found] ` <200707052315.38770.oliver@neukum.org>
2007-07-05 21:31 ` Miklos Szeredi
[not found] <E1I6YXX-0001yE-00@dorka.pomaz.szeredi.hu>
2007-07-05 21:15 ` Alan Stern
[not found] <18059.6726.218205.104212@cargo.ozlabs.ibm.com>
2007-07-04 15:12 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.0707041104140.25704-100000@netrider.rowland.org>
2007-07-05 0:35 ` Paul Mackerras
2007-07-05 14:42 ` Alan Stern
[not found] <18059.7151.841436.329553@cargo.ozlabs.ibm.com>
2007-07-04 15:04 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.0707041057230.25704-100000@netrider.rowland.org>
2007-07-05 0:28 ` Paul Mackerras
2007-07-03 19:32 Oliver Neukum
2007-07-03 20:02 ` Alan Stern
2007-07-03 20:19 ` Miklos Szeredi
2007-07-03 20:45 ` Oliver Neukum
[not found] ` <E1I5oq4-0004sc-00@dorka.pomaz.szeredi.hu>
2007-07-03 21:20 ` Rafael J. Wysocki
[not found] <8CIbE-3y1-1@gated-at.bofh.it>
[not found] ` <8CJKt-62G-35@gated-at.bofh.it>
[not found] ` <8CKZS-7Ur-3@gated-at.bofh.it>
[not found] ` <8CLjc-8iq-29@gated-at.bofh.it>
[not found] ` <8CO7m-4k4-11@gated-at.bofh.it>
2007-07-03 12:03 ` Bodo Eggert
[not found] <20070703042916.GA17240@srcf.ucam.org>
[not found] ` <200707031608.06348.nigel@nigel.suspend2.net>
[not found] ` <1183447184.10386.102.camel@localhost.localdomain>
2007-07-03 7:44 ` Oliver Neukum
[not found] ` <200707030944.18702.oliver@neukum.org>
2007-07-03 10:47 ` Miklos Szeredi
[not found] ` <E1I5fug-0003ZS-00@dorka.pomaz.szeredi.hu>
2007-07-03 11:07 ` Oliver Neukum
[not found] ` <200707031307.41366.oliver@neukum.org>
2007-07-03 11:22 ` Miklos Szeredi
[not found] ` <E1I5gSu-0003f4-00@dorka.pomaz.szeredi.hu>
2007-07-03 11:27 ` Oliver Neukum
[not found] ` <200707031327.56577.oliver@neukum.org>
2007-07-03 11:45 ` Benjamin Herrenschmidt
[not found] ` <1183463113.10386.114.camel@localhost.localdomain>
2007-07-03 11:50 ` Oliver Neukum
2007-07-05 0:02 ` Pavel Machek
2007-07-03 11:44 ` Benjamin Herrenschmidt
2007-07-03 11:55 ` Oliver Neukum
[not found] ` <200707031355.51028.oliver@neukum.org>
2007-07-03 23:40 ` Paul Mackerras
[not found] ` <18058.56956.595143.15424@cargo.ozlabs.ibm.com>
2007-07-04 7:02 ` Miklos Szeredi
2007-07-04 8:02 ` Paul Mackerras
2007-07-04 8:26 ` Miklos Szeredi
[not found] ` <E1I60CR-00066n-00@dorka.pomaz.szeredi.hu>
2007-07-04 10:26 ` Rafael J. Wysocki
2007-07-03 12:58 ` Rafael J. Wysocki
2007-07-03 15:46 ` Miklos Szeredi
2007-07-03 11:23 ` Paul Mackerras
2007-07-03 11:40 ` Benjamin Herrenschmidt
2007-07-03 11:46 ` Oliver Neukum
2007-07-03 13:07 ` Rafael J. Wysocki
[not found] ` <18058.12724.163599.707035@cargo.ozlabs.ibm.com>
2007-07-03 11:42 ` Oliver Neukum
2007-07-03 23:11 ` Paul Mackerras
[not found] ` <18058.55215.185633.434117@cargo.ozlabs.ibm.com>
2007-07-04 8:11 ` Oliver Neukum
[not found] ` <200707041011.33279.oliver@neukum.org>
2007-07-04 8:27 ` Paul Mackerras
[not found] ` <18059.23015.860618.268754@cargo.ozlabs.ibm.com>
2007-07-04 8:39 ` Oliver Neukum
[not found] ` <200707041039.30015.oliver@neukum.org>
2007-07-04 9:21 ` Paul Mackerras
[not found] ` <18059.26259.765791.62319@cargo.ozlabs.ibm.com>
2007-07-04 10:08 ` Oliver Neukum
[not found] ` <200707041208.40735.oliver@neukum.org>
2007-07-04 10:46 ` Paul Mackerras
2007-07-04 10:53 ` Oliver Neukum
2007-07-04 10:59 ` Paul Mackerras
[not found] ` <18059.32169.906914.258802@cargo.ozlabs.ibm.com>
2007-07-04 11:02 ` Oliver Neukum
2007-07-04 14:44 ` Alan Stern
2007-07-03 15:58 ` Alan Stern
2007-07-04 4:02 ` Paul Mackerras
[not found] ` <200707031456.40890.rjw@sisk.pl>
2007-07-03 14:21 ` Johannes Berg
[not found] ` <1183472474.3722.13.camel@johannes.berg>
2007-07-03 14:50 ` Alan Stern
2007-07-03 14:59 ` Johannes Berg
[not found] ` <1183474748.3722.33.camel@johannes.berg>
2007-07-03 15:22 ` Rafael J. Wysocki
2007-07-03 17:38 ` Miklos Szeredi
2007-07-03 20:54 ` Rafael J. Wysocki
2007-07-03 20:21 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.0707031609070.7671-100000@iolanthe.rowland.org>
2007-07-04 4:59 ` Paul Mackerras
2007-07-04 14:57 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.0707041045150.25704-100000@netrider.rowland.org>
2007-07-05 0:23 ` Paul Mackerras
2007-07-05 6:58 ` Oliver Neukum
[not found] ` <200707050858.03638.oliver@neukum.org>
2007-07-05 8:17 ` Miklos Szeredi
[not found] ` <E1I6MWb-0008Tq-00@dorka.pomaz.szeredi.hu>
2007-07-05 8:24 ` Oliver Neukum
[not found] ` <200707051024.23528.oliver@neukum.org>
2007-07-05 8:41 ` Miklos Szeredi
[not found] ` <E1I6Mtu-000058-00@dorka.pomaz.szeredi.hu>
2007-07-05 8:48 ` Oliver Neukum
[not found] ` <200707051048.46202.oliver@neukum.org>
2007-07-05 8:58 ` Miklos Szeredi
[not found] ` <E1I6NAH-00008t-00@dorka.pomaz.szeredi.hu>
2007-07-05 10:02 ` Oliver Neukum
[not found] ` <200707051202.59375.oliver@neukum.org>
2007-07-05 10:14 ` Miklos Szeredi
2007-07-05 11:40 ` Rafael J. Wysocki
[not found] ` <200707051340.41901.rjw@sisk.pl>
2007-07-05 11:54 ` Miklos Szeredi
2007-07-05 13:23 ` Rafael J. Wysocki
[not found] ` <200707051523.44826.rjw@sisk.pl>
2007-07-05 13:28 ` Oliver Neukum
[not found] ` <200707051528.34754.oliver@neukum.org>
2007-07-05 13:46 ` Matthew Garrett
2007-07-05 14:02 ` Rafael J. Wysocki
[not found] ` <20070705134632.GA22177@srcf.ucam.org>
2007-07-05 14:09 ` Rafael J. Wysocki
[not found] ` <200707051609.25887.rjw@sisk.pl>
2007-07-05 14:23 ` Matthew Garrett
[not found] ` <20070705142318.GA22598@srcf.ucam.org>
2007-07-05 14:46 ` Ray Lee
2007-07-05 14:59 ` Rafael J. Wysocki
[not found] ` <2c0942db0707050746v2b8cdc9ew2c4656736b52895d@mail.gmail.com>
2007-07-05 15:00 ` Matthew Garrett
2007-07-05 16:06 ` Jeremy Maitin-Shepard
2007-07-06 5:45 ` Daniel Pittman
2007-07-05 22:38 ` Benjamin Herrenschmidt
2007-07-06 7:04 ` Rafael J. Wysocki
2007-07-06 7:30 ` Oliver Neukum
2007-07-05 9:18 ` Pavel Machek
[not found] ` <20070705091801.GB3084@elf.ucw.cz>
2007-07-05 9:31 ` Miklos Szeredi
[not found] ` <E1I6NgZ-0000F6-00@dorka.pomaz.szeredi.hu>
2007-07-05 11:54 ` Pavel Machek
2007-07-05 11:58 ` Rafael J. Wysocki
[not found] ` <20070705115400.GF3984@ucw.cz>
2007-07-05 12:07 ` Miklos Szeredi
2007-07-05 13:28 ` Rafael J. Wysocki
2007-07-05 19:38 ` Oliver Neukum
[not found] ` <200707052138.56920.oliver@neukum.org>
2007-07-05 19:44 ` Miklos Szeredi
[not found] ` <E1I6XFM-0001ek-00@dorka.pomaz.szeredi.hu>
2007-07-05 20:19 ` Rafael J. Wysocki
2007-07-05 20:34 ` Oliver Neukum
2007-07-05 20:46 ` Miklos Szeredi
2007-07-05 20:49 ` Oliver Neukum
[not found] ` <200707052249.45495.oliver@neukum.org>
2007-07-05 20:53 ` Oliver Neukum
2007-07-05 21:06 ` Alan Stern
2007-07-05 21:07 ` Miklos Szeredi
[not found] ` <200707052220.00555.rjw@sisk.pl>
2007-07-05 20:38 ` Miklos Szeredi
2007-07-05 21:01 ` Rafael J. Wysocki
2007-07-05 23:05 ` Benjamin Herrenschmidt
2007-07-06 3:59 ` Jeremy Maitin-Shepard
2007-07-06 7:32 ` Oliver Neukum
2007-07-07 12:17 ` Pavel Machek
2007-07-07 20:42 ` Miklos Szeredi
[not found] ` <200707051358.26963.rjw@sisk.pl>
2007-07-05 12:24 ` Miklos Szeredi
2007-07-05 13:31 ` Rafael J. Wysocki
[not found] ` <200707051531.37532.rjw@sisk.pl>
2007-07-05 13:50 ` Miklos Szeredi
[not found] ` <E1I6RjE-0000pP-00@dorka.pomaz.szeredi.hu>
2007-07-05 14:14 ` Rafael J. Wysocki
[not found] ` <200707051614.19300.rjw@sisk.pl>
2007-07-05 14:14 ` Miklos Szeredi
2007-07-05 22:04 ` Pavel Machek
[not found] ` <20070705220444.GD3881@elf.ucw.cz>
2007-07-06 7:07 ` Miklos Szeredi
2007-07-07 12:19 ` Pavel Machek
2007-07-06 7:16 ` Rafael J. Wysocki
2007-07-05 14:23 ` Alan Stern
2007-07-04 3:55 ` Paul Mackerras
2007-07-03 14:51 ` Rafael J. Wysocki
2007-07-03 14:48 ` Johannes Berg
[not found] ` <1183497290.3388.4.camel@localhost.localdomain>
[not found] ` <200707032332.49694.rjw@sisk.pl>
2007-07-04 3:29 ` Paul Mackerras
[not found] ` <18059.5165.861038.392332@cargo.ozlabs.ibm.com>
2007-07-04 10:33 ` Rafael J. Wysocki
2007-07-04 10:48 ` Paul Mackerras
[not found] ` <18059.31464.183382.358931@cargo.ozlabs.ibm.com>
2007-07-04 11:10 ` Rafael J. Wysocki
[not found] ` <200707041310.11336.rjw@sisk.pl>
2007-07-04 11:24 ` Paul Mackerras
2007-07-04 14:30 ` Rafael J. Wysocki
[not found] ` <200707041630.30048.rjw@sisk.pl>
2007-07-05 0:15 ` Paul Mackerras
[not found] ` <18060.14341.341604.666867@cargo.ozlabs.ibm.com>
2007-07-05 11:54 ` Rafael J. Wysocki
2007-07-07 12:09 ` Pavel Machek
2007-07-04 11:25 ` Paul Mackerras
[not found] ` <200707031454.42078.nigel@nigel.suspend2.net>
[not found] ` <1183441706.10386.73.camel@localhost.localdomain>
[not found] ` <20070705000301.GE2719@elf.ucw.cz>
2007-07-05 0:46 ` Paul Mackerras
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=1183776285.3388.201.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=miklos@szeredi.hu \
--cc=mjg59@srcf.ucam.org \
--cc=oliver@neukum.org \
--cc=pavel@ucw.cz \
/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