From: ebiederm@xmission.com (Eric W. Biederman)
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Pavel Machek <pavel@ucw.cz>,
nigel@nigel.suspend2.net, "Rafael J. Wysocki" <rjw@sisk.pl>,
Jeremy Maitin-Shepard <jbms@cmu.edu>,
linux-kernel@vger.kernel.org,
linux-pm@lists.linux-foundation.org,
Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: [PATCH 0/2] Kexec jump: The first step to kexec base hibernation
Date: Fri, 13 Jul 2007 10:43:03 -0600 [thread overview]
Message-ID: <m1k5t4dzl4.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <1184368525.1069.68.camel@caritas-dev.intel.com> (Ying Huang's message of "Fri, 13 Jul 2007 23:15:25 +0000")
"Huang, Ying" <ying.huang@intel.com> writes:
> On Thu, 2007-07-12 at 10:32 -0600, Eric W. Biederman wrote:
>> >
>> > 1. Separate device suspend from device hibernate.
>>
>> Actually in some very practical sense we already have two copies of
>> this in the kernel. device_shutdown and the hotunplug/module
>> remove code. So it is should be mostly a matter of using what we have.
>
> Maybe I misuse the terminology. The "device hibernate" here means put
> device into quiescent state and save the device state into memory for
> later restore.
>
> But, how to restore device state after jumping back from kexeced kernel
> if device_shutdown or hotplug/module removing code is used?
With device_shutdown there really isn't a path (although putting
the device into a quiescent state is exactly what that method does).
However with the module remove path you disassociate the pci device
and the pci device driver and then after restore you go through
the pci devices and you redo the association (as if the pci
device or the module had just been loaded).
For devices that have a really slow probe/initialization this might be
an issue but it will work, and generally it will work fairly quickly.
So in that sense restore may be the wrong concept for devices.
At least for prototypes.
>> Basically all this entails is to modify sys_reboot()
>> and adding a LINUX_REBOOT_CMD_KSPAWN and have that command
>> enter the kexec path with the appropriate set of calls.
>> I would be really surprised if this winds up with much
>> more code then the current kernel_kexec function.
>
> Yes, this is the right place to trigger kexec jump. Thank you for your
> valuable comments. It seems that just the device state
> quiesce/save/restore and CPU state save/restore code need to be
> added.
Yes.
For cpu state I'm fairly certain we don't need to do anything fancy.
At least for the first pass prototyping with a uniprocessor kernel
will remove that hurdle.
>> For prototyping I would:
>> - reserve a chunk of memory (possibly with the crashkernel= option)
>> and run a relocatable kernel out of it.
>>
>> By using the normal kexec you can boot a relocatable restore kernel
>> in that reserved region. It is an extra step but it makes things
>> work today.
>>
>> - I would use the normal sys_kexec_load.
>>
>> - I would debug/tweak the user space and the code to reenter the
>> old kernel. I.e. the device driver stop/start code.
>
> The above 3 steps are exactly what I have done in this patch. I reserve
> memory with crashkernel=, use sys_kexec_load (kexec -p ...) to load the
> kexec kernel and manage to jump back to normal kernel. But I should not
> mix the kexec jump trigger code with the software suspend code, that is,
> use "kexec -e", not "echo disk > /sys/power/state".
Right. That caused all kinds of weirdness in your patch.
>> > 5. A smooth resume process. Maybe it is not needed to kexec a new kernel
>> > for resume. For example, in the first stage of kernel boot, just first
>> > 16M (or a little more) RAM is used, if the resume image is found, the
>> > saved kernel image is resumed; if the resume image is not found, turn on
>> > the remaining RAM. This will depends on 3.
>>
>> Well I expect the resume will be load the resumed kernel into reserved
>> memory. And kexec a very small assembly stub that will jump back
>> to the code in relocate_kernel.S which will call ret.
>>
>> Then either hot add the rest of our memory or kexec to a kernel without
>> restrictions.
>
> Why a assembly stub is necessary? Is it not sufficient that just
> continue to complete a normal boot (hot add the reset of memory) or load
> the hibernated kernel (hibernated image) and jump to it?
I was thinking the assembly stub would be the small piece that jumps
to loaded hibernated kernel. Quite possibly we could just get away
with providing no memory and just an entry point to kexec but it
makes sense to me to plan on running a couple of instructions.
Actually the way the kexec infrastructure it might be reasonable to
just use sys_kexec_load to load the entire hibernated image. Except
for the fact that sys_kexec_load requires the source pages to be
in the processes memory image the code shouldn't have the 50% of
memory limitation already.
If we can get that going we don't even need to restrict the first
kernels memory. So it might just require teaching sys_kexec_load
how to steal process pages. Anyway something to think about.
>> Well just not loading drivers you aren't going to use and generally avoiding
>> long disk probing times will help here. We control all of the code so
>> it should be relatively straight forward.
>
> Just not loading unnecessary drivers may be sufficient. But further
> optimization is also possible.
>
> The basic idea of optimization is:
>
> For first run:
>
> 1. boot the normal kernel A
> 2. kexec the hibernate kernel B
> 3. jump back to kernel A
> 4. Save the kernel B into a image
> 5. Work under kernel A.
>
> For normal use:
>
> 1. boot the normal kernel A
> 2. resume the image of kernel B
> 3. jump to kernel B
> 4. Save the kernel A into image
Yes. That may help. Cooperative multitasking between kernels.
Anyway all of that comes after we get something simple working.
Then we can see what really needs to be optimized, and what works
well enough.
Eric
next prev parent reply other threads:[~2007-07-13 16:47 UTC|newest]
Thread overview: 125+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-11 15:30 Huang, Ying
2007-07-11 11:13 ` Pavel Machek
2007-07-12 16:28 ` Huang, Ying
2007-07-12 8:54 ` Pavel Machek
2007-07-13 23:18 ` Huang, Ying
2007-07-12 0:22 ` Andrew Morton
2007-07-12 5:48 ` Jeremy Fitzhardinge
2007-07-12 6:43 ` david
2007-07-12 12:46 ` Rafael J. Wysocki
2007-07-12 13:51 ` Mark Lord
2007-07-12 14:49 ` Pavel Machek
2007-07-12 15:35 ` Rafael J. Wysocki
2007-07-12 16:03 ` Mark Lord
2007-07-12 16:35 ` Mark Lord
2007-07-12 20:05 ` Jeremy Maitin-Shepard
2007-07-13 2:38 ` Mark Lord
2007-07-12 16:09 ` [linux-pm] " Alan Stern
2007-07-12 18:49 ` david
2007-07-12 18:42 ` david
2007-07-12 19:20 ` Rafael J. Wysocki
2007-07-12 19:14 ` david
2007-07-12 19:45 ` Rafael J. Wysocki
2007-07-12 17:09 ` Huang, Ying
2007-07-12 12:47 ` Rafael J. Wysocki
2007-07-12 12:38 ` Rafael J. Wysocki
2007-07-12 14:43 ` Huang, Ying
2007-07-12 7:03 ` david
2007-07-12 17:18 ` Huang, Ying
2007-07-12 10:10 ` david
2007-07-12 13:01 ` Rafael J. Wysocki
2007-07-12 13:22 ` jimmy bahuleyan
2007-07-12 19:03 ` david
2007-07-12 13:55 ` Mark Lord
2007-07-12 19:05 ` david
2007-07-12 14:06 ` Pavel Machek
2007-07-12 12:53 ` Rafael J. Wysocki
2007-07-12 18:57 ` david
2007-07-12 19:34 ` Rafael J. Wysocki
2007-07-12 19:55 ` Jeremy Maitin-Shepard
2007-07-12 20:45 ` Rafael J. Wysocki
2007-07-13 3:12 ` david
2007-07-13 9:17 ` Rafael J. Wysocki
2007-07-13 9:25 ` david
2007-07-13 11:41 ` Rafael J. Wysocki
2007-07-14 7:51 ` david
2007-07-14 8:33 ` david
2007-07-14 9:24 ` Rafael J. Wysocki
2007-07-14 20:00 ` Rafael J. Wysocki
2007-07-14 20:34 ` david
2007-07-14 21:06 ` Rafael J. Wysocki
2007-07-14 21:13 ` david
2007-07-15 10:31 ` Rafael J. Wysocki
2007-07-15 19:23 ` david
2007-07-15 22:59 ` Rafael J. Wysocki
2007-07-15 23:22 ` david
2007-07-16 12:17 ` Rafael J. Wysocki
2007-07-16 14:42 ` Huang, Ying
2007-07-16 15:40 ` Rafael J. Wysocki
2007-07-17 4:18 ` david
2007-07-17 11:46 ` Rafael J. Wysocki
2007-07-14 21:34 ` david
2007-07-15 10:39 ` Rafael J. Wysocki
2007-07-15 19:33 ` david
2007-07-15 23:11 ` Rafael J. Wysocki
2007-07-15 23:33 ` david
2007-07-13 3:06 ` david
2007-07-13 5:42 ` Hibernating To Swap Considered Harmful Joseph Fannin
2007-07-13 5:57 ` david
2007-07-13 6:20 ` Joseph Fannin
2007-07-13 6:27 ` david
2007-07-13 7:15 ` Joseph Fannin
2007-07-13 14:35 ` Jeremy Maitin-Shepard
2007-07-17 0:12 ` Joseph Fannin
2007-07-17 5:44 ` Oliver Neukum
2007-07-17 6:28 ` Joseph Fannin
2007-07-17 6:42 ` david
2007-07-17 7:26 ` Joseph Fannin
2007-07-17 7:34 ` david
2007-07-17 11:54 ` Rafael J. Wysocki
2007-07-17 11:52 ` Rafael J. Wysocki
2007-07-17 7:10 ` Oliver Neukum
2007-07-13 9:30 ` Rafael J. Wysocki
2007-07-14 0:45 ` Joseph Fannin
2007-07-14 9:48 ` Rafael J. Wysocki
2007-07-16 5:37 ` Joseph Fannin
2007-07-13 9:29 ` [PATCH 0/2] Kexec jump: The first step to kexec base hibernation Rafael J. Wysocki
2007-07-13 9:38 ` david
2007-07-13 11:59 ` Rafael J. Wysocki
2007-07-13 14:37 ` [linux-pm] " Alan Stern
2007-07-13 15:31 ` Rafael J. Wysocki
2007-07-14 7:13 ` david
2007-07-13 15:12 ` Jeremy Maitin-Shepard
2007-07-13 15:45 ` Rafael J. Wysocki
2007-07-13 15:50 ` Alan Stern
2007-07-13 16:54 ` Eric W. Biederman
2007-07-13 18:15 ` Alan Stern
2007-07-13 21:08 ` Rafael J. Wysocki
2007-07-13 20:55 ` Rafael J. Wysocki
2007-07-13 16:48 ` Jeremy Maitin-Shepard
2007-07-13 21:23 ` Rafael J. Wysocki
2007-07-14 7:12 ` david
2007-07-13 17:32 ` Huang, Ying
2007-07-13 12:01 ` Rafael J. Wysocki
2007-07-12 16:32 ` Eric W. Biederman
2007-07-12 19:09 ` david
2007-07-12 19:49 ` Eric W. Biederman
2007-07-13 23:15 ` Huang, Ying
2007-07-13 16:43 ` Eric W. Biederman [this message]
2007-07-14 5:48 ` Huang, Ying
2007-07-14 9:59 ` Rafael J. Wysocki
2007-07-14 10:55 ` Huang, Ying
2007-07-14 19:16 ` Rafael J. Wysocki
2007-07-15 9:30 ` Huang, Ying
2007-07-15 10:49 ` Rafael J. Wysocki
2007-07-24 14:00 ` Huang, Ying
2007-07-24 15:27 ` Rafael J. Wysocki
2007-07-17 8:13 ` david
2007-07-17 11:59 ` Rafael J. Wysocki
2007-07-17 12:48 ` Huang, Ying
2007-07-17 14:22 ` Rafael J. Wysocki
2007-07-18 0:25 ` david
2007-07-13 5:08 [PATCH 0/2] Kexec jump: The first step to kexec base Al Boldi
2007-07-13 15:28 ` [PATCH 0/2] Kexec jump: The first step to kexec base hibernation Al Boldi
2007-07-13 15:50 ` Rafael J. Wysocki
2007-07-14 6:07 ` Al Boldi
2007-07-13 15:28 ` Al Boldi
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=m1k5t4dzl4.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=jbms@cmu.edu \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=nigel@nigel.suspend2.net \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--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
all inboxes | Powered by JetHome®