Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexec jump

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Huang, Ying
Date: Friday, September 21, 2007 - 12:27 am

On Thu, 2007-09-20 at 20:55 -0600, Eric W. Biederman wrote:

I think the "device_shutdown" is not enough for hibernation. Because in
current implementation of the device shutdown method, "recover" is not
considered. For example, for hibernation, the current executing request
of device should be delayed or finished before shutdown, and may be
re-executing after "recover". So I think another pair of callbacks may
be needed for the purpose of hibernation.


I totally agree!


There is a thread on LKML about this:
http://lkml.org/lkml/2007/4/27/129

Do you agree with the conclusion there?


My description here has some problem. If the source page (shadow page)
is same as the target page, there is no copy or swap. I have thought
about that, and current implementation works in this situation too. In
original kernel it is a allocated page for kexec, so it will not be used
for other purpose; in kexeced, it can be used freely.


Yes. This is the existing implementation, just a little usage changing.
I load all memory area used by kexeced kernel in addition to kernel
image. This is done in kexec-tools. So the shadow page is allocated for
every pages used by kexeced kernel.


My code can handle that case. If everything allocated on the same page,
just do not swap or swap with itself. The same lists of generic kexec
code is used for swap too.


This protocol is mainly for loading the hibernation image from the
bootloader directly, not for kexec. An external protocol should be
defined for the bootloader, because they are external code.


A mechanism should be provided to pass the jump back entry to the
kexeced kernel. A kernel command line parameter constructed by
"purgatory" of kexec-tools may be better.


Unlike normal kexec, some information need to be read/written from/to
the control page both in virtual mode and real mode. The code copied to
control page is run both in virtual mode and real mode, so the NX bit
should be cleared for the control page. But in normal kexec, code copied
to control page is run in real mode only.


OK. This should be removed.


Yes. It seems that the two versions can be merged.


NORET_TYPE is accurate here, because the return point is not in
__machine_kexec.


This is an interface for external bootloader, not for kexec. And if the
version of the original kernel and the kexeced kernel is different, a
kexec jump back version may be needed.


Maybe this is not needed if the kernel command line mechanism is used to
pass jump back entry point. The user space tool can get that through
"cat /proc/cmdline".


I think the backup_pages_map can be used by kdump. Because some pages of
original kernel is swapped to the shadow page, If you want to examine
the contents of these pages, the map is needed.

And I think the page swapping provides a possibility to implement crash
dump without preserving memory. Just load the crash dump kernel image
and all memory used by crash dump kernel.


If I understand correctly. It seems that you think a function calling
style interface to "purgatory" of /sbin/kexec is better, and
the /sbin/kexec will convert the information to standard kernel
parameter passing mechanism if necessary.

My current implementation is something like a global variable
information passing mechanism.

Your method is more standard. But my method has some advantages too.

- It's more convenient to pass some information back from kexeced kernel
to original kernel.
- If loaded from bootloader directly, the bootloader can check the
information of hibernated kernel more easily.


Best Regards,
Huang Ying
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Eric W. Biederman, (Thu Sep 20, 7:55 pm)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Eric W. Biederman, (Thu Sep 20, 8:33 pm)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Eric W. Biederman, (Thu Sep 20, 9:01 pm)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Eric W. Biederman, (Thu Sep 20, 9:46 pm)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Huang, Ying, (Fri Sep 21, 12:27 am)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Rafael J. Wysocki, (Fri Sep 21, 4:56 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 5:09 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 5:10 am)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Rafael J. Wysocki, (Fri Sep 21, 5:18 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 7:31 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 8:50 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Jeremy Maitin-Shepard, (Fri Sep 21, 11:11 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 12:00 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 1:15 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Jeremy Maitin-Shepard, (Fri Sep 21, 1:26 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 1:53 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Jeremy Maitin-Shepard, (Fri Sep 21, 2:08 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Jeremy Maitin-Shepard, (Fri Sep 21, 2:16 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Fri Sep 21, 2:25 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Sat Sep 22, 3:34 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Sat Sep 22, 3:40 am)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Sat Sep 22, 2:51 pm)
Re: [RFC][PATCH 1/2 -mm] kexec based hibernation -v3: kexe ..., Nigel Cunningham, (Wed Sep 26, 11:35 pm)
Re: [linux-pm] Re: [RFC][PATCH 1/2 -mm] kexec based hibern ..., Rafael J. Wysocki, (Wed Oct 24, 1:38 pm)