From: Milton Miller <miltonm@bga.com>
To: david@lang.hm
Cc: Alan Stern <stern@rowland.harvard.edu>,
LKML <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Huang, Ying" <ying.huang@intel.com>,
linux-pm <linux-pm@lists.linuxfoundation.org>,
Jeremy Maitin-Shepard <jbms@cmu.edu>
Subject: Re: [linux-pm] Re: Hibernation considerations
Date: Fri, 20 Jul 2007 09:24:03 -0500 [thread overview]
Message-ID: <86863e635f75f5b0e3746202893cb231@bga.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0707191018520.28721@asgard.lang.hm>
On Jul 19, 2007, at 12:31 PM, david@lang.hm wrote:
> On Thu, 19 Jul 2007, Milton Miller wrote:
>>> (2) Upon start-up (by which I mean what happens after the user has
>>> pressed
>>> the power button or something like that):
>>> * check if the image is present (and valid) _without_ enabling
>>> ACPI (we
>>> don't
>>> do that now, but I see no reason for not doing it in the new
>>> framework)
>>> * if the image is present (and valid), load it
>>> * turn on ACPI (unless already turned on by the BIOS, that is)
>>> * execute the _BFS global control method
>>> * execute the _WAK global control method
>>> * continue
>>> Here, the first two things should be done by the image-loading
>>> kernel, but
>>> the remaining operations have to be carried out by the restored
>>> kernel.
>>
>> Here I agree.
>>
>> Here is my proposal. Instead of trying to both write the image and
>> suspend, I think this all becomes much simpler if we limit the scope
>> the work of the second kernel. Its purpose is to write the image.
>> After that its done. The platform can be powered off if we are going
>> to S5. However, to support suspend to ram and suspend to disk, we
>> return to the first kernel.
>>
>> This means that the first kernel will need to know why it got
>> resumed. Was the system powered off, and this is the resume from the
>> user? Or was it restarted because the image has been saved, and its
>> now time to actually suspend until woken up? If you look at it, this
>> is the same interface we have with the magic arch_suspend hook -- did
>> we just suspend and its time to write the image, or did we just
>> resume and its time to wake everything up.
>>
>> I think this can be easily solved by giving the image saving kernel
>> two resume points: one for the image has been written, and one for we
>> rebooted and have restored the image. I'm not familiar with ACPI.
>> Perhaps we need a third to differentiate we read the image from S4
>> instead of from S5, but that information must be available to the OS
>> because it needs that to know if it should resume from hibernate.
>
> are we sure that there are only 2-3 possible actions? or should this
> be made into a simple jump table so that it's extendable?
At 2 I don't think we need a jump table. Even if we had a table, we
have to identify what each entry means. If we start getting more then
we can change from command line to table.
>> As noted in the thread
>>
>> Message-ID: <873azxwqhr.fsf@jbms.ath.cx>
>> Subject: [linux-pm] Re: hibernation/snapshot design
>> on Mon Jul 9 08:23:53 2007, Jeremy Maitin-Shepard wrote:
>>
>>> (3) how to communicate where to save the memory
>>
>> This is an intresting topic. The suspended kernel has most IO and
>> disk space. It also knows how much space is to be occupied by the
>> kernel. So communicating a block map to the second kernel would be
>> the obvious choice. But the second kernel must be able to find the
>> image to restore it, and it must have drivers for the media. Also,
>> this is not feasible for storing to nfs.
>>
>> I think we will end up with several methods.
>>
>> One would be supply a list of blocks, and implement a file system
>> that reads the file by reading the scatter list from media. The
>> restore kernel then only needs to read an anchor, and can build upon
>> that until the image is read into memory. Or do this in userspace.
>>
>> I don't know how this compares to the current restore path. I
>> wasn't able to identify the code that creates the on disk structure
>> in my 10 minute perusal of kernel/power/.
>>
>> A second method will be to supply a device and file that will be
>> mounted by the save kernel, then unmounted and restored. This would
>> require a partition that is not mounted or open by the suspended
>> kernel (or use nfs or a similar protocol that is designed for
>> multiple client concurrent access).
>>
>> A third method would be to allocate a file with the first kernel, and
>> make sure the blocks are flushed to disk. The save and restore
>> kernels map the file system using a snapshot device. Writing would
>> map the blocks and use the block offset to write to the real device
>> using the method from the first option; reading could be done
>> directly from the snapshot device.
>>
>> The first and third option are dead on log based file systems (where
>> the data is stored in the log).
>
> remember that the save and restore kernel can access the memory of the
> suspending kernel, so as long as the data is in a known format and
> there is a pointer to the data in a known location, the save and
> restore kernel can retreive the data from memory, there's no need to
> involve media.
I agree that the the save kernel can read the list from the being-saved
kernel.
However, when restoring, the being-saved (being-restored) kernel is not
accessable, so the save list has to be stored as part of the image.
>> Simplifying kjump: the proposal for v3.
>>
>> The current code is trying to use crash dump area as a safe, reserved
>> area to run the second kernel. However, that means that the kernel
>> has to be linked specially to run in the reserved area. I think we
>> need to finish separating kexec_jump from the other code paths.
>
> on x86 at least it's possible to compile a relocateable kernel, so it
> doesn't need to be compiled specificly for a particular reserved area.
> This would allow you to use the same kernel build as the suspending
> kernel if you wanted to (I think that the config of the save and
> restore kernel is going to be trivial enough to consider
> auto-configuring and building a specific kernel for each box a real
> possibility)
Yes, one *can* build x86 relocatable. But there are funny restrictions
like it has to be a bzImage or be loaded by kexec or something. And
not all architectures have relocatable support. I think making the
lists for the exsiting code to swap memory will not be that difficult
and it will make the solution have less restrictions. Maybe I should
shut up and write some code this weekend.
Actually, I think we can have the dedicated area as an option. If you
suspend frequently keep a relocated kernel booted. If you need more
ram or suspend infrequently allocate the pages on the fly.
>> As a first stage of suspend and resume, we can save to dedicated
>> partitions all memory (as supplied to crash_dump) that is not marked
>> nosave and not part of the save kernel's image. The fancy block
>> lists and memory lists can be added later.
>
> if the suspending kernel needs to tell the save and restore kernel
> what memory is not marked nosave have it do so useing a memory list of
> some kind. you need to setup a mechanism for communicating the data
> anyway, setup a mechansim that's useable in the long term.
I'm saying we can have people start to test by the simple save all ram
to dedicated while we figure out what the long term list looks like.
>> If we want to keep the second kernel booted, then we need to add a
>> save area for the booted jump target. Note that the save and
>> restore lists to relocate_new_kernel can be computed once and saved.
>> Longer term we could implement sys_kexec_load(UNLOAD) that would
>> retrieve the saved list back to application space to save to disk in
>> a file. This means you could save the booted save kernel, it just
>> couldn't have any shared storage open.
>
> since the kexec to the second kernel needs to handle the device
> intialization, do you really save much by doing this? from a
> reliability point of view it would seem simpler (and therefor more
> reliable) to initialize the save and restore kernel each time it's
> used, so that it always does the same thing (as opposed to carrying
> state from one use to the next)
You can save a bit of run time initialization, at the cost of saving
the whole image with the initialized pages instead of zeroing
uninitialized pages. The code to restore the devices is the same code
path as the code for the main kernel to restore the devices (as
implemented in the current patch), so we get more testing of that path.
> David Lang
milton
next prev parent reply other threads:[~2007-07-20 14:27 UTC|newest]
Thread overview: 220+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-15 12:33 Rafael J. Wysocki
2007-07-15 12:51 ` Nigel Cunningham
2007-07-15 12:58 ` Dr. David Alan Gilbert
2007-07-15 22:38 ` Rafael J. Wysocki
2007-07-15 22:27 ` david
2007-07-17 17:40 ` Dr. David Alan Gilbert
2007-07-17 17:49 ` david
2007-07-29 6:53 ` Vojtech Pavlik
2007-07-29 9:56 ` Rafael J. Wysocki
2007-08-05 19:56 ` encrypted hibernation (was Re: Hibernation considerations) Pavel Machek
2007-08-11 23:43 ` Dr. David Alan Gilbert
2007-08-12 22:12 ` Rafael J. Wysocki
2007-08-18 19:37 ` Dr. David Alan Gilbert
2007-08-21 7:29 ` Pavel Machek
2007-08-13 2:30 ` Michael Chang
2007-08-13 4:53 ` alon.barlev
2007-07-15 15:10 ` Hibernation considerations Al Boldi
2007-07-15 15:35 ` jimmy bahuleyan
2007-07-15 17:40 ` Al Boldi
2007-07-15 16:29 ` Alan Stern
2007-07-15 17:40 ` Al Boldi
2007-07-15 23:28 ` Alan Stern
2007-07-15 23:58 ` david
2007-07-16 5:02 ` Al Boldi
2007-07-16 6:49 ` david
2007-07-16 13:32 ` Al Boldi
2007-07-17 4:33 ` david
2007-07-17 12:08 ` Al Boldi
2007-07-17 14:18 ` Rafael J. Wysocki
2007-07-17 15:23 ` david
2007-07-16 14:53 ` Alan Stern
2007-07-16 16:51 ` Al Boldi
2007-07-17 4:37 ` david
2007-07-15 19:52 ` david
2007-07-15 20:13 ` david
2007-07-15 22:47 ` Rafael J. Wysocki
2007-07-15 22:42 ` david
2007-07-15 23:15 ` Alan Stern
2007-07-15 23:38 ` Nigel Cunningham
2007-07-16 14:15 ` Alan Stern
2007-07-16 15:25 ` Rafael J. Wysocki
2007-07-15 23:41 ` david
2007-07-16 14:21 ` Alan Stern
2007-07-17 4:45 ` david
2007-07-17 14:15 ` Alan Stern
2007-07-17 14:40 ` Rafael J. Wysocki
2007-07-17 15:29 ` david
2007-07-17 16:02 ` Rafael J. Wysocki
2007-07-17 17:06 ` david
2007-07-17 19:50 ` Rafael J. Wysocki
2007-07-17 20:18 ` david
2007-07-17 20:39 ` Jeremy Maitin-Shepard
2007-07-17 20:39 ` david
2007-07-17 20:58 ` Rafael J. Wysocki
2007-07-17 20:57 ` Rafael J. Wysocki
2007-07-17 20:53 ` david
2007-07-17 21:37 ` Rafael J. Wysocki
2007-07-17 21:42 ` david
2007-07-17 21:53 ` Jeremy Maitin-Shepard
2007-07-21 10:25 ` Pavel Machek
2007-07-21 15:35 ` Jeremy Maitin-Shepard
2007-07-21 17:56 ` Pavel Machek
2007-07-21 19:35 ` david
2007-07-21 19:49 ` Pavel Machek
2007-07-21 22:14 ` david
2007-08-01 16:58 ` Stefan Seyfried
2007-07-17 20:24 ` Jeremy Maitin-Shepard
2007-07-17 20:44 ` david
2007-07-17 21:00 ` Rafael J. Wysocki
2007-07-17 16:09 ` Jeremy Maitin-Shepard
2007-07-17 19:54 ` Rafael J. Wysocki
2007-07-17 18:32 ` Alan Stern
2007-07-17 20:17 ` Rafael J. Wysocki
2007-07-17 20:34 ` david
2007-07-17 20:54 ` Jeremy Maitin-Shepard
2007-07-17 21:04 ` david
2007-07-17 21:23 ` Rafael J. Wysocki
2007-07-17 21:17 ` david
2007-07-17 21:27 ` Jeremy Maitin-Shepard
2007-07-17 21:27 ` david
2007-07-17 21:54 ` Rafael J. Wysocki
2007-07-17 21:45 ` Rafael J. Wysocki
2007-07-17 21:43 ` Rafael J. Wysocki
2007-07-17 20:34 ` Jeremy Maitin-Shepard
2007-07-17 20:37 ` david
2007-07-17 20:56 ` Jeremy Maitin-Shepard
2007-07-17 21:06 ` david
2007-07-17 21:40 ` Rafael J. Wysocki
2007-07-17 21:24 ` Rafael J. Wysocki
2007-07-17 21:11 ` Rafael J. Wysocki
2007-07-17 20:27 ` david
2007-07-17 21:20 ` Rafael J. Wysocki
[not found] ` <ea7a437ca4038d408ac544bbc3c2434a@bga.com>
2007-07-19 17:31 ` [linux-pm] " david
2007-07-20 14:24 ` Milton Miller [this message]
2007-07-20 15:44 ` david
2007-07-19 20:28 ` Rafael J. Wysocki
2007-07-19 23:07 ` david
2007-07-20 11:17 ` Rafael J. Wysocki
2007-07-20 15:35 ` david
2007-07-20 16:15 ` Alan Stern
2007-07-20 21:46 ` Rafael J. Wysocki
2007-07-20 16:56 ` Milton Miller
2007-07-20 17:31 ` Jeremy Maitin-Shepard
2007-07-20 21:30 ` Rafael J. Wysocki
2007-07-20 19:26 ` david
2007-07-20 21:28 ` Rafael J. Wysocki
2007-07-20 21:33 ` Jeremy Maitin-Shepard
2007-07-20 22:19 ` Rafael J. Wysocki
[not found] ` <20070720152744.GH20529@grifter.jdc.home>
2007-07-20 15:36 ` david
2007-07-20 21:43 ` Rafael J. Wysocki
2007-07-20 21:39 ` david
2007-07-20 22:22 ` Rafael J. Wysocki
2007-07-20 22:39 ` david
2007-07-20 16:08 ` Milton Miller
2007-07-20 16:20 ` Alan Stern
2007-07-20 17:32 ` Milton Miller
2007-07-20 18:17 ` Alan Stern
2007-07-20 19:08 ` Milton Miller
2007-07-20 19:37 ` Alan Stern
2007-07-20 20:03 ` Oliver Neukum
2007-07-20 20:12 ` Alan Stern
2007-07-20 21:35 ` Oliver Neukum
2007-07-20 22:25 ` Alan Stern
2007-07-23 14:23 ` Oliver Neukum
2007-07-23 20:05 ` Towards eliminating the freezer Alan Stern
2007-07-24 8:21 ` Oliver Neukum
2007-07-24 14:27 ` Alan Stern
2007-07-24 9:33 ` Rafael J. Wysocki
2007-07-24 14:29 ` Alan Stern
2007-07-24 15:24 ` Rafael J. Wysocki
2007-07-24 16:06 ` Alan Stern
2007-07-24 19:20 ` Rafael J. Wysocki
2007-07-24 20:24 ` Alan Stern
2007-07-24 21:14 ` Rafael J. Wysocki
2007-07-24 22:14 ` Alan Stern
2007-07-25 12:23 ` Rafael J. Wysocki
2007-08-01 9:34 ` [linux-pm] Re: Hibernation considerations Pavel Machek
2007-08-03 3:50 ` david
2007-07-20 20:31 ` david
2007-07-20 21:24 ` Alan Stern
2007-07-20 21:34 ` david
2007-07-20 22:15 ` Rafael J. Wysocki
2007-07-20 21:37 ` Jeremy Maitin-Shepard
2007-07-20 22:35 ` Alan Stern
2007-07-20 22:43 ` david
2007-07-21 5:21 ` Nigel Cunningham
2007-07-21 14:10 ` Alan Stern
2007-07-22 3:43 ` david
2007-07-22 16:00 ` Alan Stern
2007-07-22 21:50 ` david
2007-07-23 15:19 ` Alan Stern
2007-07-23 19:01 ` david
2007-07-23 20:22 ` Alan Stern
2007-07-24 13:26 ` Huang, Ying
2007-07-24 14:50 ` Alan Stern
2007-07-20 22:48 ` Jeremy Maitin-Shepard
2007-07-20 21:02 ` Rafael J. Wysocki
2007-07-21 11:44 ` Miklos Szeredi
2007-07-21 12:43 ` Nigel Cunningham
2007-07-21 13:56 ` Alan Stern
2007-07-21 16:13 ` Jeremy Maitin-Shepard
2007-07-21 18:12 ` Miklos Szeredi
2007-07-21 19:20 ` Rafael J. Wysocki
2007-08-01 9:22 ` Pavel Machek
2007-08-02 17:02 ` Rafael J. Wysocki
2007-07-21 22:21 ` Nigel Cunningham
2007-07-21 22:16 ` Nigel Cunningham
2007-07-22 15:26 ` Alan Stern
2007-07-22 16:27 ` Miklos Szeredi
2007-07-22 20:09 ` Alan Stern
2007-07-22 21:54 ` david
2007-07-22 22:42 ` Nigel Cunningham
2007-07-22 23:09 ` Rafael J. Wysocki
2007-07-22 23:18 ` Nigel Cunningham
2007-07-23 0:04 ` Paul Mackerras
2007-07-23 3:11 ` Nigel Cunningham
2007-07-23 15:23 ` Alan Stern
2007-07-23 21:55 ` Nigel Cunningham
2007-07-23 22:10 ` Rafael J. Wysocki
2007-07-23 5:31 ` david
2007-07-23 10:24 ` Miklos Szeredi
2007-07-23 12:08 ` Rafael J. Wysocki
2007-07-23 12:14 ` Miklos Szeredi
2007-07-23 12:27 ` Rafael J. Wysocki
2007-07-23 12:31 ` Oliver Neukum
2007-07-23 13:08 ` Miklos Szeredi
2007-07-23 14:01 ` Rafael J. Wysocki
2007-07-23 14:01 ` Miklos Szeredi
2007-07-23 19:08 ` david
2007-08-01 9:19 ` Pavel Machek
[not found] ` <40fa2626aff7b6b590ad6aa4737fc873@bga.com>
2007-07-20 14:48 ` Huang, Ying
2007-07-20 15:48 ` david
2007-07-22 2:17 ` Huang, Ying
2007-07-22 2:32 ` david
2007-07-20 21:34 ` Rafael J. Wysocki
2007-07-17 22:38 ` Alan Stern
2007-07-17 22:37 ` david
2007-07-18 14:29 ` Alan Stern
2007-07-18 14:47 ` Rafael J. Wysocki
2007-07-20 4:40 ` Al Boldi
2007-07-20 10:59 ` Rafael J. Wysocki
2007-07-21 10:17 ` Pavel Machek
2007-07-15 23:22 ` Rafael J. Wysocki
2007-07-15 23:49 ` david
2007-07-16 12:06 ` Rafael J. Wysocki
[not found] ` <20070716123849.GC14212@grifter.jdc.home>
2007-07-16 15:29 ` Rafael J. Wysocki
2007-07-17 4:28 ` david
2007-07-17 10:42 ` Matthew Garrett
2007-07-17 15:19 ` david
2007-07-18 2:18 ` Matthew Garrett
2007-07-18 3:54 ` david
2007-07-18 11:10 ` Matthew Garrett
2007-07-18 12:56 ` david
2007-07-15 23:17 ` Alan Stern
2007-07-15 23:53 ` david
2007-07-16 5:18 ` Jeremy Maitin-Shepard
2007-07-15 20:35 ` Cornelius Riemenschneider
2007-07-15 19:46 ` david
2007-07-16 0:51 ` Matthew Garrett
2007-07-16 0:51 ` david
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=86863e635f75f5b0e3746202893cb231@bga.com \
--to=miltonm@bga.com \
--cc=david@lang.hm \
--cc=jbms@cmu.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linuxfoundation.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
--cc=ying.huang@intel.com \
/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
Powered by JetHome