From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Power management list <linux-pm@lists.osdl.org>,
Pavel Machek <pavel@ucw.cz>
Subject: suspend/resume issue (Was: [PATCH 2/2] Fix console handling during suspend/resume)
Date: Fri, 16 Jun 2006 11:02:13 +1000 [thread overview]
Message-ID: <1150419733.7725.51.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0606141042260.5498@g5.osdl.org>
> My Mac Mini (Intel dual-core CPU) now resumes and suspends in SMP mode
> too, which was not true just a couple of days ago. It even seems to do it
> fairly reliable.
>
> The debugging patch helped me figure out a number of the problems (and
> even more problems that then didn't actually make any difference once I
> started getting things working ;)
Hi Linus !
Heh, good to see you on the PM wagon :) One thing we really need to look
into is the problem that when the suspend process starts, at any point
in time, kmalloc() might block forever.
The basic issue is as usual the swap device(s) going down, thus any
allocation that might try to push things out to swap will possibly sleep
forever.
I think we might need something like kmalloc silently switching to NOIO
or something like that when the system state changes to "suspending".
As-is, we have all sort of well hidden possible deadlocks, where a
driver will have some part (a bottom half for example) blocked in a
kmalloc & holding mutex X while that driver's suspend routine gets
called and tries to acquire that same mutex... there are plenty
others... driver suspend calling thigns that implicitely will block on a
kmalloc, etc etc...
My very early proposal for suspend callbacks (years ago, maybe you
remember), had an additional round of callbacks to drivers called
"prepare for suspend" for that. Drivers were supposed to enter a state
where they avoided blocking allocation etc...
Of course, I realize that this was not a good approach: too complex and
we would never have all drivers to properly handle that.
Another source of problems is the request_firmware() interface. Most
drivers use it synchronously and do it at resume() time, when coming
back from sleep. However, on resume, userland is still frozen...the
kernel might still be able to launch things but I wouldn't be too much
on the result, especially since the swap device might potentially be
still suspended too. This is a typical cause of either deadlocks or
non-working wireless devices on resume. Not sure what the perfect
solution here... drivers will _have_ to delay their resume process for
that... one possibility would be to make request_firmware() kind of
interfaces asynchronous only (with a completion callback) and have the
core delay it... that leads to the next issue .. :)
... which is hotplug events happening during the suspend process...
Very similar to the above problem: Trying to run userland things when
userland isn't supposed to be in a state where it can handle them.
I proposed a while ago that a way to fix both issues is to 1- make
request_firmware type of interfaces asynchronous only and 2- have the
"core" queue up all userland helper calls when the suspend process is
in progress and send them as a batch on resume. Of course, that isn't
necessarily totally efficient. A more elaborate option would be to drop
them relying on: 1- for normal hotplug events, we only send a single
"rescan all" event to userland at the end of the resume process where it
basically re-does what it does at boot. 2- call_usermodehelper just
fails with something like -EAGAIN when called in the suspend/resume
process. Thus normal hotplug events are just dropped on the floor. For
request_firmware, the fix is hidden in the implementation of
request_firmware_async which will then queue up the request and re-emit
after the suspend process is over.
All these issues lead to a need to globally:
- Know that the suspend process has started. That is, userland can't be
relied upon and touching swap is not an option (GFP_KERNEL can
deadlock).
- Be notified of the above and of the end of the above situation
(suspend process aborted or resume finished). Could just be a global
notifier, I don't think we need that much ordering for this.
With the above, some subsystems could enter a "suspend safe" state that
would make things a lot more reliable. One example is slab/buddy turning
gfp_kernel into noio (and sync'ing all CPUs after doing that to avoid
having a big lock), the usermodehelper stuff, the request firmware
stuff, etc...
Ideas ?
Ben.
next prev parent reply other threads:[~2006-06-16 1:02 UTC|newest]
Thread overview: 348+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-13 21:30 [PATCH 0/2] suspend-to-ram debugging patches Linus Torvalds
2006-06-13 21:35 ` [PATCH 1/2] Add some basic resume trace facilities Linus Torvalds
2006-06-13 22:10 ` Nigel Cunningham
2006-06-13 22:50 ` Linus Torvalds
2006-06-14 10:25 ` Pavel Machek
2006-06-13 21:40 ` [PATCH 2/2] Fix console handling during suspend/resume Linus Torvalds
2006-06-13 23:20 ` David Brownell
2006-06-13 23:46 ` Linus Torvalds
2006-06-14 0:00 ` Nigel Cunningham
2006-06-14 0:06 ` Randy.Dunlap
2006-06-14 0:18 ` Greg KH
2006-06-14 0:29 ` Nigel Cunningham
2006-06-14 0:34 ` Linus Torvalds
2006-06-14 0:29 ` David Brownell
2006-06-14 10:28 ` Pavel Machek
2006-06-14 11:15 ` Nigel Cunningham
2006-06-14 15:28 ` David Brownell
2006-06-14 10:34 ` Pavel Machek
2006-06-14 15:21 ` Linus Torvalds
2006-06-14 17:52 ` Linus Torvalds
2006-06-14 18:09 ` Dave Jones
2006-06-14 18:29 ` Linus Torvalds
2006-06-14 19:13 ` Peter Jones
2006-06-14 19:17 ` Dave Jones
2006-06-14 21:40 ` Pavel Machek
2006-06-14 22:03 ` Linus Torvalds
2006-06-14 22:12 ` Pavel Machek
2006-06-14 22:26 ` Peter Jones
2006-06-14 22:38 ` Linus Torvalds
2006-06-14 22:44 ` Pavel Machek
2006-06-14 22:59 ` Linus Torvalds
2006-06-14 23:57 ` Pavel Machek
2006-06-15 0:07 ` Linus Torvalds
2006-06-15 1:54 ` Nigel Cunningham
2006-06-15 2:48 ` David Brownell
2006-06-15 8:39 ` Pavel Machek
2006-06-15 14:56 ` Alan Stern
2006-06-15 16:14 ` Pavel Machek
2006-06-15 16:26 ` Linus Torvalds
2006-06-15 18:24 ` Pavel Machek
2006-06-15 19:35 ` Linus Torvalds
2006-06-15 20:03 ` Pavel Machek
2006-06-15 20:28 ` Linus Torvalds
2006-06-15 20:43 ` Pavel Machek
2006-06-15 21:04 ` Linus Torvalds
2006-06-15 21:27 ` Pavel Machek
2006-06-15 22:31 ` Linus Torvalds
2006-06-15 23:01 ` Pavel Machek
2006-06-16 4:15 ` Benjamin Herrenschmidt
2006-06-16 13:26 ` Pavel Machek
2006-06-16 23:05 ` Benjamin Herrenschmidt
2006-06-15 16:43 ` David Brownell
2006-06-15 16:52 ` Pavel Machek
2006-06-16 6:02 ` David Brownell
2006-06-15 16:17 ` Pavel Machek
2006-06-15 16:53 ` Linus Torvalds
2006-06-15 16:59 ` Pavel Machek
2006-06-15 17:41 ` Linus Torvalds
2006-06-15 17:51 ` Pavel Machek
2006-06-16 1:09 ` Benjamin Herrenschmidt
2006-06-15 17:04 ` Alan Stern
2006-06-15 22:17 ` Paul Mackerras
2006-06-15 22:24 ` Pavel Machek
2006-06-16 1:17 ` Benjamin Herrenschmidt
2006-06-16 1:15 ` Benjamin Herrenschmidt
2006-06-16 2:28 ` Linus Torvalds
2006-06-16 2:50 ` Nigel Cunningham
2006-06-16 3:22 ` Linus Torvalds
2006-06-16 3:36 ` Nigel Cunningham
2006-06-16 14:03 ` Pavel Machek
2006-06-16 15:53 ` Alan Stern
2006-06-15 1:46 ` David Brownell
2006-06-15 6:00 ` Nigel Cunningham
2006-06-15 16:22 ` David Brownell
2006-06-15 8:41 ` Pavel Machek
2006-06-15 16:57 ` David Brownell
2006-06-15 18:03 ` Pavel Machek
2006-06-15 18:31 ` Linus Torvalds
2006-06-15 19:19 ` Pavel Machek
2006-06-15 19:40 ` Linus Torvalds
2006-06-15 20:30 ` Alan Stern
2006-06-15 20:56 ` Linus Torvalds
2006-06-15 21:10 ` Pavel Machek
2006-06-15 22:01 ` Linus Torvalds
2006-06-15 22:20 ` Pavel Machek
2006-06-15 22:41 ` Linus Torvalds
2006-06-16 13:29 ` Pavel Machek
2006-06-15 22:21 ` Pavel Machek
2006-06-15 22:44 ` Linus Torvalds
2006-06-15 21:27 ` Alan Stern
2006-06-15 22:18 ` Linus Torvalds
2006-06-16 12:49 ` Pavel Machek
2006-06-16 13:22 ` Pavel Machek
2006-06-16 1:31 ` Benjamin Herrenschmidt
2006-06-16 2:53 ` Nigel Cunningham
2006-06-16 3:16 ` Linus Torvalds
2006-06-16 4:04 ` Benjamin Herrenschmidt
2006-06-16 1:26 ` Benjamin Herrenschmidt
2006-06-16 2:36 ` Linus Torvalds
2006-06-16 3:37 ` Benjamin Herrenschmidt
2006-06-16 4:37 ` Linus Torvalds
2006-06-16 6:02 ` Benjamin Herrenschmidt
2006-06-16 13:56 ` Pavel Machek
2006-06-16 1:21 ` Benjamin Herrenschmidt
2006-06-16 2:29 ` Linus Torvalds
2006-06-16 3:33 ` Benjamin Herrenschmidt
2006-06-16 4:35 ` David Brownell
2006-06-16 5:23 ` Linus Torvalds
2006-06-16 6:18 ` Benjamin Herrenschmidt
2006-06-16 13:42 ` Pavel Machek
2006-06-16 16:48 ` David Brownell
2006-06-16 13:58 ` Pavel Machek
2006-06-16 14:04 ` David Brownell
2006-06-16 18:31 ` Linus Torvalds
2006-06-16 18:45 ` Linus Torvalds
2006-06-16 23:04 ` Benjamin Herrenschmidt
2006-06-18 17:16 ` David Brownell
2006-06-16 21:28 ` Pavel Machek
2006-06-18 17:09 ` David Brownell
2006-06-18 17:16 ` David Brownell
2006-06-18 17:48 ` Linus Torvalds
2006-06-18 18:18 ` Linus Torvalds
2006-06-19 0:34 ` David Brownell
2006-06-20 2:15 ` Linus Torvalds
2006-06-20 22:47 ` Benjamin Herrenschmidt
2006-06-19 3:54 ` David Brownell
2006-06-20 22:06 ` Linus Torvalds
2006-06-21 21:17 ` David Brownell
2006-06-20 22:44 ` Benjamin Herrenschmidt
2006-06-21 0:49 ` Linus Torvalds
2006-06-21 1:10 ` Benjamin Herrenschmidt
2006-06-21 2:40 ` Linus Torvalds
2006-06-21 2:57 ` Benjamin Herrenschmidt
2006-06-21 3:23 ` Linus Torvalds
2006-06-21 3:59 ` Benjamin Herrenschmidt
2006-06-21 4:22 ` Linus Torvalds
2006-06-21 4:36 ` Linus Torvalds
2006-06-21 5:04 ` Benjamin Herrenschmidt
2006-06-21 15:15 ` Linus Torvalds
2006-06-21 15:33 ` Alan Stern
2006-06-21 16:03 ` Linus Torvalds
2006-06-21 16:35 ` Alan Stern
2006-06-21 17:04 ` Linus Torvalds
2006-06-21 18:53 ` Alan Stern
2006-06-21 20:49 ` Linus Torvalds
2006-06-22 2:16 ` David Brownell
2006-06-22 1:04 ` Benjamin Herrenschmidt
2006-06-22 1:01 ` Benjamin Herrenschmidt
2006-06-22 2:22 ` Linus Torvalds
2006-06-22 2:47 ` Linus Torvalds
2006-06-22 3:21 ` Benjamin Herrenschmidt
2006-06-22 3:18 ` Benjamin Herrenschmidt
2006-06-22 4:08 ` Linus Torvalds
2006-06-22 4:58 ` Benjamin Herrenschmidt
2006-06-22 16:10 ` Linus Torvalds
2006-06-22 18:30 ` David Brownell
2006-06-22 19:23 ` Linus Torvalds
2006-06-22 22:43 ` Benjamin Herrenschmidt
2006-06-23 18:06 ` David Brownell
2006-06-23 19:23 ` Linus Torvalds
2006-06-23 23:32 ` Adam Belay
2006-06-23 23:44 ` Linus Torvalds
2006-06-24 0:10 ` Linus Torvalds
2006-06-24 0:39 ` Benjamin Herrenschmidt
2006-06-24 3:30 ` David Brownell
2006-06-24 4:10 ` Linus Torvalds
2006-06-24 0:22 ` Benjamin Herrenschmidt
2006-06-24 0:29 ` Benjamin Herrenschmidt
2006-06-24 1:00 ` Linus Torvalds
2006-06-24 2:42 ` Adam Belay
2006-06-24 3:12 ` Linus Torvalds
2006-06-24 4:04 ` David Brownell
2006-06-24 4:35 ` Linus Torvalds
2006-06-25 8:23 ` Adam Belay
2006-06-25 17:15 ` Linus Torvalds
2006-06-26 23:30 ` Greg KH
2006-06-24 4:07 ` Linus Torvalds
2006-06-24 11:16 ` Nigel Cunningham
2006-06-24 16:24 ` Alan Stern
2006-06-24 22:28 ` Linus Torvalds
2006-06-24 22:41 ` Pavel Machek
2006-06-25 1:30 ` Linus Torvalds
2006-06-25 2:16 ` Alan Stern
2006-06-25 2:32 ` Linus Torvalds
2006-06-25 16:35 ` Alan Stern
2006-06-25 2:02 ` Alan Stern
2006-06-25 23:56 ` Nigel Cunningham
2006-06-26 23:31 ` Greg KH
2006-06-24 22:39 ` Pavel Machek
2006-06-29 0:37 ` Greg KH
2006-06-29 0:48 ` Linus Torvalds
2006-06-29 3:09 ` Greg KH
2006-06-29 3:24 ` Linus Torvalds
2006-06-29 4:21 ` Greg KH
2006-06-29 6:26 ` Greg KH
2006-06-29 22:58 ` Greg KH
2006-06-29 9:50 ` Pavel Machek
2006-07-06 22:27 ` David Brownell
2006-07-06 22:31 ` Greg KH
2006-07-08 17:45 ` PM_TRACE causing FSCK David Brownell
2006-07-06 23:27 ` [PATCH 2/2] Fix console handling during suspend/resume Dave Jones
2006-07-06 23:43 ` Linus Torvalds
2006-07-06 23:59 ` Dave Jones
2006-07-07 4:48 ` Linus Torvalds
2006-07-07 8:35 ` Pavel Machek
2006-07-06 23:51 ` David Brownell
2006-07-09 23:28 ` David Brownell
2006-07-10 7:53 ` Pavel Machek
2006-07-25 18:17 ` bus.suspend_prepare() David Brownell
2006-07-25 18:29 ` bus.suspend_prepare() Linus Torvalds
2006-07-25 19:17 ` bus.suspend_prepare() David Brownell
2006-07-25 22:24 ` bus.suspend_prepare() Nigel Cunningham
2006-07-26 10:12 ` bus.suspend_prepare() Pavel Machek
2006-07-26 10:11 ` bus.suspend_prepare() Pavel Machek
2006-06-24 4:52 ` [PATCH 2/2] Fix console handling during suspend/resume Benjamin Herrenschmidt
2006-06-24 5:18 ` Linus Torvalds
2006-06-24 6:30 ` Benjamin Herrenschmidt
2006-06-24 17:06 ` Rafael J. Wysocki
2006-06-27 6:08 ` Adam Belay
2006-06-27 6:18 ` Linus Torvalds
2006-06-27 6:58 ` Benjamin Herrenschmidt
2006-06-27 18:50 ` Linus Torvalds
2006-06-27 22:09 ` Benjamin Herrenschmidt
2006-06-27 7:07 ` Adam Belay
2006-06-27 15:33 ` Alan Stern
2006-06-28 0:16 ` Linus Torvalds
2006-07-05 18:40 ` David Brownell
2006-07-05 20:12 ` Linus Torvalds
2006-07-05 23:03 ` David Brownell
2006-07-06 1:15 ` Pavel Machek
2006-07-06 1:52 ` Nigel Cunningham
2006-07-06 7:15 ` Nigel Cunningham
2006-07-06 13:22 ` memcpy() in swsusp (was: Re: [PATCH 2/2] Fix console handling during suspend/resume) Rafael J. Wysocki
2006-07-06 14:19 ` David Brownell
2006-07-06 14:26 ` Rafael J. Wysocki
2006-07-06 20:35 ` Rafael J. Wysocki
2006-07-06 23:36 ` Pavel Machek
2006-07-06 20:44 ` David Brownell
2006-07-06 20:55 ` Rafael J. Wysocki
2006-07-06 21:01 ` Dave Jones
2006-07-06 21:07 ` David Brownell
2006-07-06 21:18 ` Rafael J. Wysocki
2006-07-06 22:06 ` Dave Jones
2006-07-07 8:20 ` Rafael J. Wysocki
2006-06-24 6:41 ` [PATCH 2/2] Fix console handling during suspend/resume Benjamin Herrenschmidt
2006-06-24 11:58 ` Nigel Cunningham
2006-06-24 21:20 ` Linus Torvalds
2006-06-25 1:10 ` David Brownell
2006-06-28 22:13 ` Pavel Machek
2006-06-24 3:33 ` David Brownell
2006-06-23 23:53 ` Benjamin Herrenschmidt
2006-06-24 3:28 ` David Brownell
2006-06-24 21:33 ` Pavel Machek
2006-06-25 1:00 ` David Brownell
2006-06-24 3:28 ` David Brownell
2006-06-24 11:57 ` Jim Gettys
2006-06-25 23:03 ` Pavel Machek
2006-06-25 23:18 ` Jim Gettys
2006-07-03 21:32 ` Pavel Machek
2006-06-26 0:16 ` David Brownell
2006-06-28 22:16 ` Pavel Machek
2006-06-28 23:38 ` David Brownell
2006-06-22 22:21 ` Benjamin Herrenschmidt
2006-06-22 22:31 ` Linus Torvalds
2006-06-22 23:11 ` Benjamin Herrenschmidt
2006-06-22 23:19 ` Linus Torvalds
2006-06-22 23:21 ` Linus Torvalds
2006-06-22 23:31 ` Benjamin Herrenschmidt
2006-06-22 23:41 ` Linus Torvalds
2006-06-23 0:01 ` Pavel Machek
2006-06-23 0:14 ` Benjamin Herrenschmidt
2006-06-23 0:05 ` Benjamin Herrenschmidt
2006-06-23 0:08 ` Benjamin Herrenschmidt
2006-06-23 16:26 ` David Brownell
2006-06-23 20:36 ` Adam Belay
2006-06-23 21:48 ` cpufreq-related updates [WAS: Fix console handling during suspend/resume] David Brownell
2006-06-23 22:10 ` Greg KH
2006-06-23 23:54 ` David Brownell
2006-06-23 22:53 ` Adam Belay
2006-06-22 23:31 ` [PATCH 2/2] Fix console handling during suspend/resume Pavel Machek
2006-06-22 23:42 ` Linus Torvalds
2006-06-22 23:51 ` Pavel Machek
2006-06-23 18:15 ` David Brownell
2006-06-24 21:35 ` Pavel Machek
2006-06-24 22:00 ` Linus Torvalds
2006-06-25 0:57 ` Benjamin Herrenschmidt
2006-06-25 1:05 ` Linus Torvalds
2006-06-25 1:12 ` Benjamin Herrenschmidt
2006-06-25 1:34 ` Linus Torvalds
2006-06-25 2:21 ` Benjamin Herrenschmidt
2006-06-25 23:09 ` Pavel Machek
2006-06-22 23:53 ` Linus Torvalds
2006-06-22 23:56 ` Pavel Machek
2006-06-23 16:37 ` David Brownell
2006-06-22 23:13 ` suspend debuggability [was Re: [PATCH 2/2] Fix console handling during suspend/resume] Pavel Machek
2006-06-22 5:52 ` [PATCH 2/2] Fix console handling during suspend/resume David Brownell
2006-06-22 6:28 ` Benjamin Herrenschmidt
2006-06-22 16:43 ` Linus Torvalds
2006-06-22 18:19 ` David Brownell
2006-06-23 17:18 ` David Brownell
2006-06-23 17:43 ` David Brownell
2006-06-23 18:18 ` wakeup events [WAS: Re*N Fix console handling] David Brownell
2006-06-21 21:13 ` [PATCH 2/2] Fix console handling during suspend/resume David Brownell
2006-06-22 0:42 ` Benjamin Herrenschmidt
2006-06-21 22:54 ` Benjamin Herrenschmidt
2006-06-22 0:15 ` Benjamin Herrenschmidt
2006-06-22 2:21 ` David Brownell
2006-06-22 3:23 ` Benjamin Herrenschmidt
2006-06-22 5:36 ` David Brownell
2006-06-22 16:17 ` Alan Stern
2006-06-22 18:27 ` David Brownell
2006-06-22 20:31 ` Alan Stern
2006-06-22 23:48 ` David Brownell
2006-06-23 2:41 ` Alan Stern
2006-06-23 16:43 ` David Brownell
2006-06-23 18:32 ` Alan Stern
2006-06-24 3:39 ` David Brownell
2006-06-24 16:19 ` Alan Stern
2006-06-25 2:20 ` Alan Stern
2006-06-22 22:30 ` Benjamin Herrenschmidt
2006-06-23 2:35 ` Alan Stern
2006-06-21 21:22 ` David Brownell
2006-06-21 4:45 ` Benjamin Herrenschmidt
2006-06-21 15:08 ` Linus Torvalds
2006-06-21 22:51 ` Benjamin Herrenschmidt
2006-06-22 0:48 ` Linus Torvalds
2006-06-21 21:21 ` David Brownell
2006-06-21 21:18 ` David Brownell
2006-06-22 1:08 ` Benjamin Herrenschmidt
2006-06-22 1:24 ` Linus Torvalds
2006-06-22 1:33 ` Benjamin Herrenschmidt
2006-06-14 23:02 ` Rafael J. Wysocki
2006-06-14 23:32 ` Pavel Machek
2006-06-15 9:39 ` Rafael J. Wysocki
2006-06-16 0:47 ` Benjamin Herrenschmidt
2006-06-16 1:03 ` Benjamin Herrenschmidt
2006-06-14 22:37 ` Linus Torvalds
2006-06-15 0:00 ` Pavel Machek
2006-06-15 0:12 ` Linus Torvalds
2006-06-15 9:11 ` suspend-devices-not-cpu [was Re: [PATCH 2/2] Fix console handling during suspend/resume] Pavel Machek
2006-06-15 0:39 ` [PATCH 2/2] Fix console handling during suspend/resume Adam Belay
2006-06-15 0:40 ` Greg KH
2006-06-15 1:50 ` Adam Belay
2006-06-15 0:01 ` Linus Torvalds
2006-06-15 8:23 ` Pavel Machek
2006-06-16 1:02 ` Benjamin Herrenschmidt [this message]
2006-06-16 8:01 ` Benjamin Herrenschmidt
2006-06-16 0:45 ` [PATCH 0/2] suspend-to-ram debugging patches Benjamin Herrenschmidt
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=1150419733.7725.51.camel@localhost.localdomain \
--to=benh@kernel.crashing.org \
--cc=linux-pm@lists.osdl.org \
--cc=pavel@ucw.cz \
--cc=torvalds@osdl.org \
/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