Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Huang, Ying
On Mon, 2007-08-27 at 13:15 +, Pavel Machek wrote:
> Hi!
> 
> > >> > Does this make sense?
> > >> 
> > >> Yes, this is a sensible optimization. But I think it may be better to
> > >> make bootloader load kernel D directly into a specified memory location.
> > >> For example, we can add a option to "kernel" command of grub. 
> > >> 
> > >> And, I think we can do more in bootloader. Such as we can prepare
> > >> two
> > >
> > > Yes, that would be nice.
> > >
> > > It will mean quite a bit of work, but I guess it should be the long
> > > term goal. Loading restore kernel directly from bootloader means:
> > >
> > > 1) it is fast -- no need to boot another kernel
> > >
> > > 2) it is "classical" way of doing things
> > >
> > > On the other hand, we loose flexibility that way:
> > >
> > > 1) it locks you onto one bootloader
> > >
> > > 2) you no longer have userland there to do uncompression, decryption,
> > > etc..
> > 
> > True although for the uncompression and decryption those aren't exactly 
> > foreign
> > requirements for bootloaders.
> 
> Well, uncompression yes, but crypto? What is that, some kind of
> trusted computing thingie?
> 
> We do RSA for uswsusp, that may be a bit of problem for a bootloader,
> but I'm glad bootloaders are bloated already :-).

As far as I know, the grub 2.0 uses a modular implementation scheme.
That is, every OS loader (Multi-boot, Linux, FreeBSD etc), partition
table, file system is implemented as a module, and these modules can be
statically linked into the final image.

So I think the hibernation image loading can be implemented in grub 2.0
in a manageable way. :)

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Pavel Machek
Hi!

> >> > Does this make sense?
> >> 
> >> Yes, this is a sensible optimization. But I think it may be better to
> >> make bootloader load kernel D directly into a specified memory location.
> >> For example, we can add a option to "kernel" command of grub. 
> >> 
> >> And, I think we can do more in bootloader. Such as we can prepare
> >> two
> >
> > Yes, that would be nice.
> >
> > It will mean quite a bit of work, but I guess it should be the long
> > term goal. Loading restore kernel directly from bootloader means:
> >
> > 1) it is fast -- no need to boot another kernel
> >
> > 2) it is "classical" way of doing things
> >
> > On the other hand, we loose flexibility that way:
> >
> > 1) it locks you onto one bootloader
> >
> > 2) you no longer have userland there to do uncompression, decryption,
> > etc..
> 
> True although for the uncompression and decryption those aren't exactly 
> foreign
> requirements for bootloaders.

Well, uncompression yes, but crypto? What is that, some kind of
trusted computing thingie?

We do RSA for uswsusp, that may be a bit of problem for a bootloader,
but I'm glad bootloaders are bloated already :-).

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Eric W. Biederman
Pavel Machek <[EMAIL PROTECTED]> writes:

> Hi!
>
>> > Does this make sense?
>> 
>> Yes, this is a sensible optimization. But I think it may be better to
>> make bootloader load kernel D directly into a specified memory location.
>> For example, we can add a option to "kernel" command of grub. 
>> 
>> And, I think we can do more in bootloader. Such as we can prepare
>> two
>
> Yes, that would be nice.
>
> It will mean quite a bit of work, but I guess it should be the long
> term goal. Loading restore kernel directly from bootloader means:
>
> 1) it is fast -- no need to boot another kernel
>
> 2) it is "classical" way of doing things
>
> On the other hand, we loose flexibility that way:
>
> 1) it locks you onto one bootloader
>
> 2) you no longer have userland there to do uncompression, decryption,
> etc..

True although for the uncompression and decryption those aren't exactly foreign
requirements for bootloaders.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Pavel Machek
Hi!

> > Does this make sense?
> 
> Yes, this is a sensible optimization. But I think it may be better to
> make bootloader load kernel D directly into a specified memory location.
> For example, we can add a option to "kernel" command of grub. 
> 
> And, I think we can do more in bootloader. Such as we can prepare
> two

Yes, that would be nice.

It will mean quite a bit of work, but I guess it should be the long
term goal. Loading restore kernel directly from bootloader means:

1) it is fast -- no need to boot another kernel

2) it is "classical" way of doing things

On the other hand, we loose flexibility that way:

1) it locks you onto one bootloader

2) you no longer have userland there to do uncompression, decryption,
etc..
Pave
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Vivek Goyal
On Mon, Aug 27, 2007 at 02:18:49PM +0800, Huang, Ying wrote:

[..]
> > 
> > If one compiles the kernel C to boot from reserved memory area (subset
> > of memory area used by kernel B), then I can skip the step of kexecing
> > from C to D? (COFIG_PHYSICAL_START)
> 
> Yes. I think so.
> 
> > Alternatively, can we give hint to kernel C to run from a specified address
> > at run time with the help of command line parameters. What I mean 
> > boot-loader
> > can load the kernel at any address, but kernel will move itself to run
> > from a different location depending on command line parameter.  For example,
> > let say kernel_run_addr = 0x100. This parameter will tell the kernel
> > to move itself to 16MB address and run from there. I think it can be made
> > to work with little work in existing setup of relocatable kernel.
> > 
> > Kernel run address can be put by some user space script which will save
> > the hibernated image of original kernel. So after saving the /proc/vmcore,
> > script can modify the boot loader config file to append the right
> > command line to the kernel (kernel_run_addr).
> > 
> > After hibernation, user will shutdown/reboot. Next time the kernel boots
> > it will load at 16MB addr (because of kernel_run_addr) and then it can
> > restore the previously saved image.
> > 
> > We shall have to get rid of (kernel_run_addr) parameter from command
> > line while resuming. One can restore the image (krestore) and then edit
> > the boot loader config file to get rid of command line param, 
> > kernel_run_addr.
> > 
> > In this scheme, with the help of relocatable kernel, we can use a single
> > kernel for everything. (A, B, C, D). We will also avoid additional kexec
> > from kernel C to kernel D.
> > 
> > I think in the long run we shall have to work out so that a user does
> > not have to maintain multiple kernels. 
> 
> Only one relocatable kernel image is needed. In fact, I use one
> relocatable kernel image in testing during development.
> 
> > Does this make sense?
> 
> Yes, this is a sensible optimization. But I think it may be better to
> make bootloader load kernel D directly into a specified memory location.
> For example, we can add a option to "kernel" command of grub. 
> 

IIUC, you mean a command line option which is parsed by boot-loader and
then boot-loader loads the kernel at user specified address?

I think it might not be a very good idea as hibernation becomes boot-loader
dependent scheme. How many boot-loaders will one modify and hibernation
will not work with older versions of boot-loader. 

I think it is better to make kernel relocate to user specified address and
keep hibernation mechanism independent of specific boot-loader(grup, lilo,...)
and boot-loader version.

Thanks
Vivek
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Huang, Ying
On Mon, 2007-08-27 at 10:30 +0530, Vivek Goyal wrote:
> On Mon, Aug 27, 2007 at 09:14:05AM +0800, Huang, Ying wrote:
> > Kexec base hibernation has some potential advantages over uswsusp and
> > TuxOnIce (suspend2). Some most obvious advantages are:
> > 
> > 1. The hibernation image size can exceed half of memory size easily.
> > 
> > 2. The hibernation image can be written to and read from almost
> >anywhere, such as USB disk, NFS.
> > 
> > 3. It is possible to eliminate freezer from kexec based hibernation
> >implementation.
> > 
> > 4. Based on kexec/kdump implementation, the kernel code needed is
> >less.
> > 
> > 
> > This patch set implements a prototype of kexec based hibernation. The
> > kernel functionalities added are as follow:
> > 
> > 1. Jumping from kexeced kernel back to original kernel. This is used
> >by hibernation to save/load necessary state in original kernel and
> >jumping back to original kernel after restore the memory of
> >original kernel.
> > 
> > 2. Add writing support to /dev/oldmem. This is used by hibernation to
> >restore the memory of original kernel.
> > 
> > 
> > The hibernation process with the patch set is as follow:
> > 
> > 1. Boot a kernel A
> > 
> > 2. Work under kernel A
> > 
> > 3. Kexec another kernel B (crash dump enabled) in kernel A.
> > 
> > 4. Save the memory image of kernel A through crash dump (such as "cp
> >/proc/vmcore ~"). Save the "jump buffer pfn".
> > 
> > 5. Shutdown or reboot
> > 
> > 
> > The restore process with the patch set is as follow:
> > 
> > 1. Boot a kernel C
> > 
> > 2. Kexec another kernel D (crash dump enabled) in kernel C. The memory
> >area used by kernel D must be a subset of memory area used by
> >kernel B.
> > 
> 
> If one compiles the kernel C to boot from reserved memory area (subset
> of memory area used by kernel B), then I can skip the step of kexecing
> from C to D? (COFIG_PHYSICAL_START)

Yes. I think so.

> Alternatively, can we give hint to kernel C to run from a specified address
> at run time with the help of command line parameters. What I mean boot-loader
> can load the kernel at any address, but kernel will move itself to run
> from a different location depending on command line parameter.  For example,
> let say kernel_run_addr = 0x100. This parameter will tell the kernel
> to move itself to 16MB address and run from there. I think it can be made
> to work with little work in existing setup of relocatable kernel.
> 
> Kernel run address can be put by some user space script which will save
> the hibernated image of original kernel. So after saving the /proc/vmcore,
> script can modify the boot loader config file to append the right
> command line to the kernel (kernel_run_addr).
> 
> After hibernation, user will shutdown/reboot. Next time the kernel boots
> it will load at 16MB addr (because of kernel_run_addr) and then it can
> restore the previously saved image.
> 
> We shall have to get rid of (kernel_run_addr) parameter from command
> line while resuming. One can restore the image (krestore) and then edit
> the boot loader config file to get rid of command line param, kernel_run_addr.
> 
> In this scheme, with the help of relocatable kernel, we can use a single
> kernel for everything. (A, B, C, D). We will also avoid additional kexec
> from kernel C to kernel D.
> 
> I think in the long run we shall have to work out so that a user does
> not have to maintain multiple kernels. 

Only one relocatable kernel image is needed. In fact, I use one
relocatable kernel image in testing during development.

> Does this make sense?

Yes, this is a sensible optimization. But I think it may be better to
make bootloader load kernel D directly into a specified memory location.
For example, we can add a option to "kernel" command of grub. 

And, I think we can do more in bootloader. Such as we can prepare two
kernel command line for one grub menu item, one for normal kernel, the
other for restore kernel. After hibernating successfully, the effective
kernel command line is switched.

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Huang, Ying
On Mon, 2007-08-27 at 10:30 +0530, Vivek Goyal wrote:
 On Mon, Aug 27, 2007 at 09:14:05AM +0800, Huang, Ying wrote:
  Kexec base hibernation has some potential advantages over uswsusp and
  TuxOnIce (suspend2). Some most obvious advantages are:
  
  1. The hibernation image size can exceed half of memory size easily.
  
  2. The hibernation image can be written to and read from almost
 anywhere, such as USB disk, NFS.
  
  3. It is possible to eliminate freezer from kexec based hibernation
 implementation.
  
  4. Based on kexec/kdump implementation, the kernel code needed is
 less.
  
  
  This patch set implements a prototype of kexec based hibernation. The
  kernel functionalities added are as follow:
  
  1. Jumping from kexeced kernel back to original kernel. This is used
 by hibernation to save/load necessary state in original kernel and
 jumping back to original kernel after restore the memory of
 original kernel.
  
  2. Add writing support to /dev/oldmem. This is used by hibernation to
 restore the memory of original kernel.
  
  
  The hibernation process with the patch set is as follow:
  
  1. Boot a kernel A
  
  2. Work under kernel A
  
  3. Kexec another kernel B (crash dump enabled) in kernel A.
  
  4. Save the memory image of kernel A through crash dump (such as cp
 /proc/vmcore ~). Save the jump buffer pfn.
  
  5. Shutdown or reboot
  
  
  The restore process with the patch set is as follow:
  
  1. Boot a kernel C
  
  2. Kexec another kernel D (crash dump enabled) in kernel C. The memory
 area used by kernel D must be a subset of memory area used by
 kernel B.
  
 
 If one compiles the kernel C to boot from reserved memory area (subset
 of memory area used by kernel B), then I can skip the step of kexecing
 from C to D? (COFIG_PHYSICAL_START)

Yes. I think so.

 Alternatively, can we give hint to kernel C to run from a specified address
 at run time with the help of command line parameters. What I mean boot-loader
 can load the kernel at any address, but kernel will move itself to run
 from a different location depending on command line parameter.  For example,
 let say kernel_run_addr = 0x100. This parameter will tell the kernel
 to move itself to 16MB address and run from there. I think it can be made
 to work with little work in existing setup of relocatable kernel.
 
 Kernel run address can be put by some user space script which will save
 the hibernated image of original kernel. So after saving the /proc/vmcore,
 script can modify the boot loader config file to append the right
 command line to the kernel (kernel_run_addr).
 
 After hibernation, user will shutdown/reboot. Next time the kernel boots
 it will load at 16MB addr (because of kernel_run_addr) and then it can
 restore the previously saved image.
 
 We shall have to get rid of (kernel_run_addr) parameter from command
 line while resuming. One can restore the image (krestore) and then edit
 the boot loader config file to get rid of command line param, kernel_run_addr.
 
 In this scheme, with the help of relocatable kernel, we can use a single
 kernel for everything. (A, B, C, D). We will also avoid additional kexec
 from kernel C to kernel D.
 
 I think in the long run we shall have to work out so that a user does
 not have to maintain multiple kernels. 

Only one relocatable kernel image is needed. In fact, I use one
relocatable kernel image in testing during development.

 Does this make sense?

Yes, this is a sensible optimization. But I think it may be better to
make bootloader load kernel D directly into a specified memory location.
For example, we can add a option to kernel command of grub. 

And, I think we can do more in bootloader. Such as we can prepare two
kernel command line for one grub menu item, one for normal kernel, the
other for restore kernel. After hibernating successfully, the effective
kernel command line is switched.

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Vivek Goyal
On Mon, Aug 27, 2007 at 02:18:49PM +0800, Huang, Ying wrote:

[..]
  
  If one compiles the kernel C to boot from reserved memory area (subset
  of memory area used by kernel B), then I can skip the step of kexecing
  from C to D? (COFIG_PHYSICAL_START)
 
 Yes. I think so.
 
  Alternatively, can we give hint to kernel C to run from a specified address
  at run time with the help of command line parameters. What I mean 
  boot-loader
  can load the kernel at any address, but kernel will move itself to run
  from a different location depending on command line parameter.  For example,
  let say kernel_run_addr = 0x100. This parameter will tell the kernel
  to move itself to 16MB address and run from there. I think it can be made
  to work with little work in existing setup of relocatable kernel.
  
  Kernel run address can be put by some user space script which will save
  the hibernated image of original kernel. So after saving the /proc/vmcore,
  script can modify the boot loader config file to append the right
  command line to the kernel (kernel_run_addr).
  
  After hibernation, user will shutdown/reboot. Next time the kernel boots
  it will load at 16MB addr (because of kernel_run_addr) and then it can
  restore the previously saved image.
  
  We shall have to get rid of (kernel_run_addr) parameter from command
  line while resuming. One can restore the image (krestore) and then edit
  the boot loader config file to get rid of command line param, 
  kernel_run_addr.
  
  In this scheme, with the help of relocatable kernel, we can use a single
  kernel for everything. (A, B, C, D). We will also avoid additional kexec
  from kernel C to kernel D.
  
  I think in the long run we shall have to work out so that a user does
  not have to maintain multiple kernels. 
 
 Only one relocatable kernel image is needed. In fact, I use one
 relocatable kernel image in testing during development.
 
  Does this make sense?
 
 Yes, this is a sensible optimization. But I think it may be better to
 make bootloader load kernel D directly into a specified memory location.
 For example, we can add a option to kernel command of grub. 
 

IIUC, you mean a command line option which is parsed by boot-loader and
then boot-loader loads the kernel at user specified address?

I think it might not be a very good idea as hibernation becomes boot-loader
dependent scheme. How many boot-loaders will one modify and hibernation
will not work with older versions of boot-loader. 

I think it is better to make kernel relocate to user specified address and
keep hibernation mechanism independent of specific boot-loader(grup, lilo,...)
and boot-loader version.

Thanks
Vivek
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Pavel Machek
Hi!

  Does this make sense?
 
 Yes, this is a sensible optimization. But I think it may be better to
 make bootloader load kernel D directly into a specified memory location.
 For example, we can add a option to kernel command of grub. 
 
 And, I think we can do more in bootloader. Such as we can prepare
 two

Yes, that would be nice.

It will mean quite a bit of work, but I guess it should be the long
term goal. Loading restore kernel directly from bootloader means:

1) it is fast -- no need to boot another kernel

2) it is classical way of doing things

On the other hand, we loose flexibility that way:

1) it locks you onto one bootloader

2) you no longer have userland there to do uncompression, decryption,
etc..
Pave
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Eric W. Biederman
Pavel Machek [EMAIL PROTECTED] writes:

 Hi!

  Does this make sense?
 
 Yes, this is a sensible optimization. But I think it may be better to
 make bootloader load kernel D directly into a specified memory location.
 For example, we can add a option to kernel command of grub. 
 
 And, I think we can do more in bootloader. Such as we can prepare
 two

 Yes, that would be nice.

 It will mean quite a bit of work, but I guess it should be the long
 term goal. Loading restore kernel directly from bootloader means:

 1) it is fast -- no need to boot another kernel

 2) it is classical way of doing things

 On the other hand, we loose flexibility that way:

 1) it locks you onto one bootloader

 2) you no longer have userland there to do uncompression, decryption,
 etc..

True although for the uncompression and decryption those aren't exactly foreign
requirements for bootloaders.

Eric
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Pavel Machek
Hi!

   Does this make sense?
  
  Yes, this is a sensible optimization. But I think it may be better to
  make bootloader load kernel D directly into a specified memory location.
  For example, we can add a option to kernel command of grub. 
  
  And, I think we can do more in bootloader. Such as we can prepare
  two
 
  Yes, that would be nice.
 
  It will mean quite a bit of work, but I guess it should be the long
  term goal. Loading restore kernel directly from bootloader means:
 
  1) it is fast -- no need to boot another kernel
 
  2) it is classical way of doing things
 
  On the other hand, we loose flexibility that way:
 
  1) it locks you onto one bootloader
 
  2) you no longer have userland there to do uncompression, decryption,
  etc..
 
 True although for the uncompression and decryption those aren't exactly 
 foreign
 requirements for bootloaders.

Well, uncompression yes, but crypto? What is that, some kind of
trusted computing thingie?

We do RSA for uswsusp, that may be a bit of problem for a bootloader,
but I'm glad bootloaders are bloated already :-).

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-27 Thread Huang, Ying
On Mon, 2007-08-27 at 13:15 +, Pavel Machek wrote:
 Hi!
 
Does this make sense?
   
   Yes, this is a sensible optimization. But I think it may be better to
   make bootloader load kernel D directly into a specified memory location.
   For example, we can add a option to kernel command of grub. 
   
   And, I think we can do more in bootloader. Such as we can prepare
   two
  
   Yes, that would be nice.
  
   It will mean quite a bit of work, but I guess it should be the long
   term goal. Loading restore kernel directly from bootloader means:
  
   1) it is fast -- no need to boot another kernel
  
   2) it is classical way of doing things
  
   On the other hand, we loose flexibility that way:
  
   1) it locks you onto one bootloader
  
   2) you no longer have userland there to do uncompression, decryption,
   etc..
  
  True although for the uncompression and decryption those aren't exactly 
  foreign
  requirements for bootloaders.
 
 Well, uncompression yes, but crypto? What is that, some kind of
 trusted computing thingie?
 
 We do RSA for uswsusp, that may be a bit of problem for a bootloader,
 but I'm glad bootloaders are bloated already :-).

As far as I know, the grub 2.0 uses a modular implementation scheme.
That is, every OS loader (Multi-boot, Linux, FreeBSD etc), partition
table, file system is implemented as a module, and these modules can be
statically linked into the final image.

So I think the hibernation image loading can be implemented in grub 2.0
in a manageable way. :)

Best Regards,
Huang Ying
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-26 Thread Vivek Goyal
On Mon, Aug 27, 2007 at 09:14:05AM +0800, Huang, Ying wrote:
> Kexec base hibernation has some potential advantages over uswsusp and
> TuxOnIce (suspend2). Some most obvious advantages are:
> 
> 1. The hibernation image size can exceed half of memory size easily.
> 
> 2. The hibernation image can be written to and read from almost
>anywhere, such as USB disk, NFS.
> 
> 3. It is possible to eliminate freezer from kexec based hibernation
>implementation.
> 
> 4. Based on kexec/kdump implementation, the kernel code needed is
>less.
> 
> 
> This patch set implements a prototype of kexec based hibernation. The
> kernel functionalities added are as follow:
> 
> 1. Jumping from kexeced kernel back to original kernel. This is used
>by hibernation to save/load necessary state in original kernel and
>jumping back to original kernel after restore the memory of
>original kernel.
> 
> 2. Add writing support to /dev/oldmem. This is used by hibernation to
>restore the memory of original kernel.
> 
> 
> The hibernation process with the patch set is as follow:
> 
> 1. Boot a kernel A
> 
> 2. Work under kernel A
> 
> 3. Kexec another kernel B (crash dump enabled) in kernel A.
> 
> 4. Save the memory image of kernel A through crash dump (such as "cp
>/proc/vmcore ~"). Save the "jump buffer pfn".
> 
> 5. Shutdown or reboot
> 
> 
> The restore process with the patch set is as follow:
> 
> 1. Boot a kernel C
> 
> 2. Kexec another kernel D (crash dump enabled) in kernel C. The memory
>area used by kernel D must be a subset of memory area used by
>kernel B.
> 

If one compiles the kernel C to boot from reserved memory area (subset
of memory area used by kernel B), then I can skip the step of kexecing
from C to D? (COFIG_PHYSICAL_START)

Alternatively, can we give hint to kernel C to run from a specified address
at run time with the help of command line parameters. What I mean boot-loader
can load the kernel at any address, but kernel will move itself to run
from a different location depending on command line parameter.  For example,
let say kernel_run_addr = 0x100. This parameter will tell the kernel
to move itself to 16MB address and run from there. I think it can be made
to work with little work in existing setup of relocatable kernel.

Kernel run address can be put by some user space script which will save
the hibernated image of original kernel. So after saving the /proc/vmcore,
script can modify the boot loader config file to append the right
command line to the kernel (kernel_run_addr).

After hibernation, user will shutdown/reboot. Next time the kernel boots
it will load at 16MB addr (because of kernel_run_addr) and then it can
restore the previously saved image.

We shall have to get rid of (kernel_run_addr) parameter from command
line while resuming. One can restore the image (krestore) and then edit
the boot loader config file to get rid of command line param, kernel_run_addr.

In this scheme, with the help of relocatable kernel, we can use a single
kernel for everything. (A, B, C, D). We will also avoid additional kexec
from kernel C to kernel D.

I think in the long run we shall have to work out so that a user does
not have to maintain multiple kernels. 

Does this make sense?

Thanks
Vivek
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 0/2 -mm] kexec based hibernation

2007-08-26 Thread Vivek Goyal
On Mon, Aug 27, 2007 at 09:14:05AM +0800, Huang, Ying wrote:
 Kexec base hibernation has some potential advantages over uswsusp and
 TuxOnIce (suspend2). Some most obvious advantages are:
 
 1. The hibernation image size can exceed half of memory size easily.
 
 2. The hibernation image can be written to and read from almost
anywhere, such as USB disk, NFS.
 
 3. It is possible to eliminate freezer from kexec based hibernation
implementation.
 
 4. Based on kexec/kdump implementation, the kernel code needed is
less.
 
 
 This patch set implements a prototype of kexec based hibernation. The
 kernel functionalities added are as follow:
 
 1. Jumping from kexeced kernel back to original kernel. This is used
by hibernation to save/load necessary state in original kernel and
jumping back to original kernel after restore the memory of
original kernel.
 
 2. Add writing support to /dev/oldmem. This is used by hibernation to
restore the memory of original kernel.
 
 
 The hibernation process with the patch set is as follow:
 
 1. Boot a kernel A
 
 2. Work under kernel A
 
 3. Kexec another kernel B (crash dump enabled) in kernel A.
 
 4. Save the memory image of kernel A through crash dump (such as cp
/proc/vmcore ~). Save the jump buffer pfn.
 
 5. Shutdown or reboot
 
 
 The restore process with the patch set is as follow:
 
 1. Boot a kernel C
 
 2. Kexec another kernel D (crash dump enabled) in kernel C. The memory
area used by kernel D must be a subset of memory area used by
kernel B.
 

If one compiles the kernel C to boot from reserved memory area (subset
of memory area used by kernel B), then I can skip the step of kexecing
from C to D? (COFIG_PHYSICAL_START)

Alternatively, can we give hint to kernel C to run from a specified address
at run time with the help of command line parameters. What I mean boot-loader
can load the kernel at any address, but kernel will move itself to run
from a different location depending on command line parameter.  For example,
let say kernel_run_addr = 0x100. This parameter will tell the kernel
to move itself to 16MB address and run from there. I think it can be made
to work with little work in existing setup of relocatable kernel.

Kernel run address can be put by some user space script which will save
the hibernated image of original kernel. So after saving the /proc/vmcore,
script can modify the boot loader config file to append the right
command line to the kernel (kernel_run_addr).

After hibernation, user will shutdown/reboot. Next time the kernel boots
it will load at 16MB addr (because of kernel_run_addr) and then it can
restore the previously saved image.

We shall have to get rid of (kernel_run_addr) parameter from command
line while resuming. One can restore the image (krestore) and then edit
the boot loader config file to get rid of command line param, kernel_run_addr.

In this scheme, with the help of relocatable kernel, we can use a single
kernel for everything. (A, B, C, D). We will also avoid additional kexec
from kernel C to kernel D.

I think in the long run we shall have to work out so that a user does
not have to maintain multiple kernels. 

Does this make sense?

Thanks
Vivek
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/