On Sunday, 15 July 2007 21:23, david@xxxxxxx wrote:On Sun, 15 Jul 2007, Rafael J. Wysocki wrote:
I think this is far more complicated then it needs to be.
it sounds like it should be possible to do the following
1. figure out what pages should be backed up (creating a data structure to
hold them)
That should be done after step 2, because the memory contents can change
in this step.
no, this needs to be done by the main kernel, becouse only it knows how to
find this info. the kernel that you kexec into could be very different
(including different versions) and the ways to identify this data is not
part of any existing API
If the memory contents changes in step 2, then the information collected by
the main kernel will be inaccurate.
why would the memory use change when the new kernel is run? is it becouse
of whatever it does to the devices for the hand-off?
Yes, I think so, although I'm not sure, because I don't know what happens to
devices during a "normal" kexec.
during the wakeup stage, I thought you said that al that was needed was to
feed the suspend image to /dev/suspend and the kernel in the suspend image
would re-probe, or otherwise re-initialize all the devices it needs. am I
misunderstanding this?
Perhaps. Currently, the hibernated kernel will run device_resume() after
the restore, which is not exactly compatible with what kexec does.
but kexec isn't needed during the restore process, is it?
Generally, it's not needed. _However_, the current handling of devices is
such that:
(a) hibernated kernel uses device_suspend() to put them into low power states
and creates the image
(b) hibernated kernel uses device_resume() to get devices back to work and
saves the image
(c) during the restore the boot kernel loads the image and uses
device_suspend() to prepare devices for the "old" kernel
(d) hibernated kernel gets control and uses device_resume() to get devices back
to work.
Now, if you use kexec instead of (a) and (b), then whatever it does to devices
is generally incompatible with the device_resume() in (d) (because, for
instance, some device driver's .resume() routine may expect some data to be
saved by the corresponding .suspend() at specific locations).