Re: [PATCH 0/2] Kexec jump: The first step to kexec base hibernation

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric W. Biederman <ebiederm@...>
Cc: Andrew Morton <akpm@...>, Pavel Machek <pavel@...>, <nigel@...>, Rafael J. Wysocki <rjw@...>, Jeremy Maitin-Shepard <jbms@...>, <linux-kernel@...>, <linux-pm@...>, Kexec Mailing List <kexec@...>
Date: Saturday, July 14, 2007 - 1:48 am

On Fri, 2007-07-13 at 10:43 -0600, Eric W. Biederman wrote:

Oh, I got it. In my patch, there is such assembly stub in
arch/i386/kernel/kexec_jump.S. I think it is needed to restore basic CPU
state and accommodate some position independent restore code (such as
memory restore code).


As for memory backupping and restoring during hibernating and resuming,
I think a possible picture can be as follow:

Memory:

  Total memory: 512M
  Memory used by hibernating/resuming kernel: 0~16M


Hibernating process:

  1. Normal kernel running
  2. Hibernating is triggered, sys_kexec_load is used to load
     hibernating kernel and initramfs into memory. Then
     sys_reboot(LINUX_REBOOT_CMD_KSPAWN) is invoked.
  3. In sys_reboot, kexec_jump is called to save device/CPU state,
     then relocate_kernel is called. kexec_jump and relocate_kernel
     reside in individual page in 16M~512M.
  4. In relocate_kernel, 0~16M is backupped firstly, then the
     hibernating kernel and initramfs is copied to 0~16M, after that,
     the hibernating kernel is booted.
  5. In hibernating kernel, the memory of normal kernel (it is in
     16M~512M) is saved into a hibernation image through /dev/mem
     and ELF header.


Resume process:

  1. Resuming kernel is booted as a normal kernel, but the memory is
     restricted to 0~16M.
  2. Checking whether there is a effective hibernation image. If
     there isn't, the memory of 16M~512M is hot added, and the normal
     boot up process continues; If there is, a resuming process is
     triggered.
  3. sys_kexec_load is used to restore the memory state of hibernated
     kernel. The sys_kexec_load works in crashdump way, that is, the
     hibernation image is copied to destination location in 16M~512M
     in sys_kexec_load instead of relocate_kernel. There is no half
     of memory size restriction.
  4. sys_reboot is called to trigger jumping back, which will jump back
     to kexec_jump of hibernated kernel.
  5. In kexec_jump of hibernated kernel, the memory of 0~16M is copied
     back from the backup area in 16M~512M. The memory state of
     hibernated kernel is restored totally. The CPU and device state
     can be restored after that.


If there is too much difficulty to hot add memory in step 2. A more
conservative method can be used as step 1 and step 2.

  1. A normal kernel is booted.
  2. Checking whether there is a effective hibernation image. If there
     isn't, continue the normal boot process; otherwise, a resuming
     kernel is kexeced in memory 0~16M. The resuming process will
     continue in kexeced resuming kernel.

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

Messages in current thread:
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 8:38 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Eric W. Biederman, (Thu Jul 12, 12:32 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Eric W. Biederman, (Fri Jul 13, 12:43 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Huang, Ying, (Sat Jul 14, 1:48 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sat Jul 14, 5:59 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sat Jul 14, 3:16 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec , Rafael J. Wysocki, (Tue Jul 17, 10:22 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec , Rafael J. Wysocki, (Tue Jul 17, 7:59 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sun Jul 15, 6:49 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Tue Jul 24, 11:27 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Eric W. Biederman, (Thu Jul 12, 3:49 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 8:53 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 3:34 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Fri Jul 13, 8:01 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Fri Jul 13, 5:29 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Fri Jul 13, 7:59 am)
Re: [linux-pm] Re: [PATCH 0/2] Kexec jump: The first step to..., Rafael J. Wysocki, (Fri Jul 13, 11:31 am)
Hibernating To Swap Considered Harmful, Joseph Fannin, (Fri Jul 13, 1:42 am)
Re: Hibernating To Swap Considered Harmful, Rafael J. Wysocki, (Fri Jul 13, 5:30 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Fri Jul 13, 8:45 pm)
Re: Hibernating To Swap Considered Harmful, Rafael J. Wysocki, (Sat Jul 14, 5:48 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Mon Jul 16, 1:37 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Fri Jul 13, 2:20 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Fri Jul 13, 3:15 am)
Re: Hibernating To Swap Considered Harmful, Jeremy Maitin-Shepard, (Fri Jul 13, 10:35 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Mon Jul 16, 8:12 pm)
Re: Hibernating To Swap Considered Harmful, Oliver Neukum, (Tue Jul 17, 1:44 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Tue Jul 17, 2:28 am)
Re: Hibernating To Swap Considered Harmful, Oliver Neukum, (Tue Jul 17, 3:10 am)
Re: Hibernating To Swap Considered Harmful, Joseph Fannin, (Tue Jul 17, 3:26 am)
Re: Hibernating To Swap Considered Harmful, Rafael J. Wysocki, (Tue Jul 17, 7:52 am)
Re: Hibernating To Swap Considered Harmful, Rafael J. Wysocki, (Tue Jul 17, 7:54 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Jeremy Maitin-Shepard, (Thu Jul 12, 3:55 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Fri Jul 13, 5:17 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Fri Jul 13, 7:41 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sat Jul 14, 4:00 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sun Jul 15, 6:39 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sun Jul 15, 7:11 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sat Jul 14, 5:06 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sun Jul 15, 6:31 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sun Jul 15, 6:59 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Mon Jul 16, 8:17 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Mon Jul 16, 11:40 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Tue Jul 17, 7:46 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Sat Jul 14, 5:24 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 4:45 pm)
Re: [PATCH 0/2] Kexec jump: The first step to , Rafael J. Wysocki, (Thu Jul 12, 9:01 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Jeremy Fitzhardinge, (Thu Jul 12, 1:48 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 8:47 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 8:46 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 3:20 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 3:45 pm)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Rafael J. Wysocki, (Thu Jul 12, 11:35 am)
Re: [PATCH 0/2] Kexec jump: The first step to kexec base hib..., Jeremy Maitin-Shepard, (Thu Jul 12, 4:05 pm)