All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: nigel@nigel.suspend2.net,
	Kexec Mailing List <kexec@lists.infradead.org>,
	linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Pavel Machek <pavel@ucw.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-pm@lists.linux-foundation.org,
	Jeremy Maitin-Shepard <jbms@cmu.edu>
Subject: Re: [PATCH 0/2] Kexec jump: The first step to kexec base hibernation
Date: Sat, 14 Jul 2007 18:55:54 +0800	[thread overview]
Message-ID: <1184410554.1898.84.camel@caritas-dev.intel.com> (raw)
In-Reply-To: <200707141159.47289.rjw@sisk.pl>

On Sat, 2007-07-14 at 11:59 +0200, Rafael J. Wysocki wrote:
> > 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.
> 
> OK
> What's going to happen to devices at this point?
> 

The devices should be quiesced and the state of devices should be saved
in kexec_jump, before relocate_kernel is called. This needs the
implementation of device hibernating as you mentioned before.

> >   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.
> 
> I don't think it can be _that_ simple:
> (a) what about processes' memory
> (b) what about areas that shouldn't be saved?

The mem_map (struct page[]) of every zone of hibernated kernel is
checked.  Necessary pages are saved, like memory snapshot of software
suspend, but in user space.

> > 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.
> 
> Well, I don't know why this needs to be that complicated.  We already have
> code in the mainline that's able to load a large hibernation image into memory
> and jump to the kernel being restored.  And it has _no_ 50% of RAM limitation,
> this is the _saving_ part of the current code that this limitation comes from.

There is much similarity between sys_kexec_load and software resuming.
If resuming can be done by sys_kexec_load, then we need not two similar
functionality in kernel.

Best Regards,
Huang Ying

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: "Huang, Ying" <ying.huang@intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pavel Machek <pavel@ucw.cz>,
	nigel@nigel.suspend2.net, 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: Sat, 14 Jul 2007 18:55:54 +0800	[thread overview]
Message-ID: <1184410554.1898.84.camel@caritas-dev.intel.com> (raw)
In-Reply-To: <200707141159.47289.rjw@sisk.pl>

On Sat, 2007-07-14 at 11:59 +0200, Rafael J. Wysocki wrote:
> > 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.
> 
> OK
> What's going to happen to devices at this point?
> 

The devices should be quiesced and the state of devices should be saved
in kexec_jump, before relocate_kernel is called. This needs the
implementation of device hibernating as you mentioned before.

> >   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.
> 
> I don't think it can be _that_ simple:
> (a) what about processes' memory
> (b) what about areas that shouldn't be saved?

The mem_map (struct page[]) of every zone of hibernated kernel is
checked.  Necessary pages are saved, like memory snapshot of software
suspend, but in user space.

> > 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.
> 
> Well, I don't know why this needs to be that complicated.  We already have
> code in the mainline that's able to load a large hibernation image into memory
> and jump to the kernel being restored.  And it has _no_ 50% of RAM limitation,
> this is the _saving_ part of the current code that this limitation comes from.

There is much similarity between sys_kexec_load and software resuming.
If resuming can be done by sys_kexec_load, then we need not two similar
functionality in kernel.

Best Regards,
Huang Ying

  parent reply	other threads:[~2007-07-14 10:56 UTC|newest]

Thread overview: 264+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-11 15:30 [PATCH 0/2] Kexec jump: The first step to kexec base hibernation Huang, Ying
2007-07-11 15:30 ` Huang, Ying
2007-07-11 11:13 ` Pavel Machek
2007-07-11 11:13 ` Pavel Machek
2007-07-12 16:28   ` Huang, Ying
2007-07-12  8:54     ` Pavel Machek
2007-07-12  8:54     ` Pavel Machek
2007-07-13 23:18       ` Huang, Ying
2007-07-13 23:18       ` Huang, Ying
2007-07-12 16:28   ` Huang, Ying
2007-07-12  0:22 ` Andrew Morton
2007-07-12  0:22   ` Andrew Morton
2007-07-12  5:48   ` Jeremy Fitzhardinge
2007-07-12  6:43     ` david
2007-07-12  6:43       ` david
2007-07-12 12:46       ` Rafael J. Wysocki
2007-07-12 13:51         ` Mark Lord
2007-07-12 13:51         ` Mark Lord
2007-07-12 14:49           ` Pavel Machek
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: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-13  2:38                   ` Mark Lord
2007-07-12 20:05                 ` Jeremy Maitin-Shepard
2007-07-12 16:35               ` Mark Lord
2007-07-12 15:35           ` Rafael J. Wysocki
2007-07-12 16:09           ` Alan Stern
2007-07-12 16:09           ` [linux-pm] " Alan Stern
2007-07-12 18:49           ` david
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 19:45                 ` Rafael J. Wysocki
2007-07-12 19:14             ` david
2007-07-12 19:20           ` Rafael J. Wysocki
2007-07-12 18:42         ` david
2007-07-12 12:46       ` Rafael J. Wysocki
2007-07-12 17:09     ` Huang, Ying
2007-07-12 12:47       ` Rafael J. Wysocki
2007-07-12 12:47         ` Rafael J. Wysocki
2007-07-12 17:09     ` Huang, Ying
2007-07-12  5:48   ` Jeremy Fitzhardinge
2007-07-12 12:38   ` 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 17:18       ` Huang, Ying
2007-07-12 10:10         ` david
2007-07-12 10:10           ` david
2007-07-12 13:01           ` Rafael J. Wysocki
2007-07-12 13:01           ` Rafael J. Wysocki
2007-07-12 13:22             ` jimmy bahuleyan
2007-07-12 13:22             ` jimmy bahuleyan
2007-07-12 19:03             ` david
2007-07-12 19:03             ` david
2007-07-12 13:55           ` Mark Lord
2007-07-12 13:55             ` Mark Lord
2007-07-12 19:05             ` david
2007-07-12 19:05             ` david
2007-07-12 14:06           ` Pavel Machek
2007-07-12 14:06           ` Pavel Machek
2007-07-12  7:03     ` david
2007-07-12 12:53     ` Rafael J. Wysocki
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-12 20:45             ` Rafael J. Wysocki
2007-07-13  3:12             ` david
2007-07-13  3:12             ` david
2007-07-13  9:17               ` Rafael J. Wysocki
2007-07-13  9:17                 ` Rafael J. Wysocki
2007-07-13  9:25                 ` david
2007-07-13  9:25                   ` david
2007-07-13 11:41                   ` Rafael J. Wysocki
2007-07-14  7:51                     ` david
2007-07-14  7:51                     ` david
2007-07-14  8:33                       ` david
2007-07-14  8:33                       ` david
2007-07-14  9:24                         ` Rafael J. Wysocki
2007-07-14  9:24                         ` Rafael J. Wysocki
2007-07-14 20:00                       ` Rafael J. Wysocki
2007-07-14 20:00                         ` Rafael J. Wysocki
2007-07-14 20:34                         ` david
2007-07-14 20:34                         ` david
2007-07-14 21:06                           ` Rafael J. Wysocki
2007-07-14 21:06                           ` Rafael J. Wysocki
2007-07-14 21:13                             ` david
2007-07-14 21:13                               ` david
2007-07-15 10:31                               ` Rafael J. Wysocki
2007-07-15 19:23                                 ` david
2007-07-15 19:23                                   ` david
2007-07-15 22:59                                   ` Rafael J. Wysocki
2007-07-15 22:59                                   ` Rafael J. Wysocki
2007-07-15 23:22                                     ` david
2007-07-15 23:22                                     ` david
2007-07-16 12:17                                       ` Rafael J. Wysocki
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  4:18                                               ` david
2007-07-17 11:46                                               ` Rafael J. Wysocki
2007-07-17 11:46                                               ` Rafael J. Wysocki
2007-07-16 15:40                                           ` Rafael J. Wysocki
2007-07-16 14:42                                         ` Huang, Ying
2007-07-15 10:31                               ` Rafael J. Wysocki
2007-07-14 21:34                         ` david
2007-07-14 21:34                           ` david
2007-07-15 10:39                           ` Rafael J. Wysocki
2007-07-15 19:33                             ` david
2007-07-15 19:33                             ` david
2007-07-15 23:11                               ` Rafael J. Wysocki
2007-07-15 23:33                                 ` david
2007-07-15 23:33                                 ` david
2007-07-15 23:11                               ` Rafael J. Wysocki
2007-07-15 10:39                           ` Rafael J. Wysocki
2007-07-13 11:41                   ` Rafael J. Wysocki
2007-07-12 19:55           ` Jeremy Maitin-Shepard
2007-07-13  3:06           ` david
2007-07-13  3:06             ` david
2007-07-13  5:42             ` Hibernating To Swap Considered Harmful Joseph Fannin
2007-07-13  5:42               ` Joseph Fannin
2007-07-13  5:57               ` david
2007-07-13  5:57                 ` david
2007-07-13  6:20                 ` Joseph Fannin
2007-07-13  6:20                 ` Joseph Fannin
2007-07-13  6:27                   ` david
2007-07-13  6:27                   ` david
2007-07-13  7:15                     ` Joseph Fannin
2007-07-13  7:15                     ` Joseph Fannin
2007-07-13 14:35                       ` Jeremy Maitin-Shepard
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  5:44                           ` Oliver Neukum
2007-07-17  6:28                             ` Joseph Fannin
2007-07-17  6:42                               ` david
2007-07-17  6:42                                 ` david
2007-07-17  7:26                                 ` Joseph Fannin
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:54                                     ` Rafael J. Wysocki
2007-07-17  7:34                                   ` david
2007-07-17 11:52                                   ` Rafael J. Wysocki
2007-07-17 11:52                                   ` Rafael J. Wysocki
2007-07-17  7:10                               ` Oliver Neukum
2007-07-17  7:10                                 ` Oliver Neukum
2007-07-17  6:28                             ` Joseph Fannin
2007-07-17  0:12                         ` Joseph Fannin
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-16  5:37                       ` Joseph Fannin
2007-07-14  9:48                   ` Rafael J. Wysocki
2007-07-14  0:45                 ` Joseph Fannin
2007-07-13  9:30               ` Rafael J. Wysocki
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  9:38                 ` david
2007-07-13 11:59                 ` Rafael J. Wysocki
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-13 15:31                     ` Rafael J. Wysocki
2007-07-14  7:13                     ` david
2007-07-14  7:13                       ` [linux-pm] " david
2007-07-13 14:37                   ` Alan Stern
2007-07-13 15:12                   ` Jeremy Maitin-Shepard
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 16:54                           ` Eric W. Biederman
2007-07-13 18:15                           ` Alan Stern
2007-07-13 18:15                           ` Alan Stern
2007-07-13 21:08                             ` Rafael J. Wysocki
2007-07-13 21:08                               ` Rafael J. Wysocki
2007-07-13 20:55                         ` Rafael J. Wysocki
2007-07-13 20:55                         ` Rafael J. Wysocki
2007-07-13 15:50                       ` Alan Stern
2007-07-13 16:48                       ` Jeremy Maitin-Shepard
2007-07-13 16:48                         ` Jeremy Maitin-Shepard
2007-07-13 21:23                         ` Rafael J. Wysocki
2007-07-13 21:23                         ` Rafael J. Wysocki
2007-07-13 15:45                     ` Rafael J. Wysocki
2007-07-14  7:12                   ` david
2007-07-14  7:12                     ` david
2007-07-13  9:29             ` Rafael J. Wysocki
2007-07-13 17:32             ` Huang, Ying
2007-07-13 12:01               ` Rafael J. Wysocki
2007-07-13 12:01               ` Rafael J. Wysocki
2007-07-13 17:32             ` Huang, Ying
2007-07-12 19:34         ` Rafael J. Wysocki
2007-07-12 18:57       ` david
2007-07-12 16:32     ` Eric W. Biederman
2007-07-12 16:32       ` Eric W. Biederman
2007-07-12 19:09       ` david
2007-07-12 19:09         ` david
2007-07-12 19:09         ` david
2007-07-12 19:49         ` Eric W. Biederman
2007-07-12 19:49         ` Eric W. Biederman
2007-07-12 19:49           ` Eric W. Biederman
2007-07-13 23:15       ` Huang, Ying
2007-07-13 23:15         ` Huang, Ying
2007-07-13 16:43         ` Eric W. Biederman
2007-07-13 16:43         ` Eric W. Biederman
2007-07-13 16:43           ` Eric W. Biederman
2007-07-14  5:48           ` Huang, Ying
2007-07-14  5:48             ` Huang, Ying
2007-07-14  9:59             ` Rafael J. Wysocki
2007-07-14  9:59               ` Rafael J. Wysocki
2007-07-14  9:59               ` Rafael J. Wysocki
2007-07-14 10:55               ` Huang, Ying
2007-07-14 10:55               ` Huang, Ying [this message]
2007-07-14 10:55                 ` Huang, Ying
2007-07-14 19:16                 ` Rafael J. Wysocki
2007-07-14 19:16                 ` Rafael J. Wysocki
2007-07-14 19:16                   ` Rafael J. Wysocki
2007-07-15  9:30                   ` Huang, Ying
2007-07-15  9:30                   ` Huang, Ying
2007-07-15  9:30                     ` Huang, Ying
2007-07-15 10:49                     ` Rafael J. Wysocki
2007-07-15 10:49                       ` Rafael J. Wysocki
2007-07-24 14:00                       ` Huang, Ying
2007-07-24 14:00                         ` Huang, Ying
2007-07-24 15:27                         ` Rafael J. Wysocki
2007-07-24 15:27                         ` Rafael J. Wysocki
2007-07-24 15:27                           ` Rafael J. Wysocki
2007-07-24 14:00                       ` Huang, Ying
2007-07-15 10:49                     ` Rafael J. Wysocki
2007-07-17  8:13                     ` david
2007-07-17  8:13                       ` david
2007-07-17 11:59                       ` Rafael J. Wysocki
2007-07-17 11:59                         ` Rafael J. Wysocki
2007-07-17 11:59                       ` Rafael J. Wysocki
2007-07-17 12:48                       ` Huang, Ying
2007-07-17 12:48                       ` Huang, Ying
2007-07-17 12:48                         ` Huang, Ying
2007-07-17 14:22                         ` Rafael J. Wysocki
2007-07-17 14:22                           ` Rafael J. Wysocki
2007-07-17 14:22                           ` Rafael J. Wysocki
2007-07-18  0:25                           ` david
2007-07-18  0:25                             ` david
2007-07-18  0:25                             ` david
2007-07-17  8:13                     ` david
2007-07-14  5:48           ` Huang, Ying
2007-07-13 23:15       ` Huang, Ying
2007-07-12 16:32     ` Eric W. Biederman
2007-07-12 14:43   ` Huang, Ying
  -- strict thread matches above, loose matches on Subject: below --
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=1184410554.1898.84.camel@caritas-dev.intel.com \
    --to=ying.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.