All of lore.kernel.org
 help / color / mirror / Atom feed
* Kexec: where does the kernel image get relocated?
@ 2012-06-07 22:47 Ben Shelton
  2012-06-13  2:21 ` Cong Wang
  2012-06-13 16:54 ` Eric W. Biederman
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Shelton @ 2012-06-07 22:47 UTC (permalink / raw)
  To: kexec; +Cc: Antonio Barbalace

Hi all,

I'm working on a distributed-computing project where we'd like to boot multiple instances of the Linux kernel on the same machine.  We'd like to leverage kexec to decompress each guest kernel and copy it to an area within the physical address space.

From following through the code and using GDB/QEMU, it seems like the steps to reboot with kexec look like this:

- Decompress the kernel somewhere (not necessarily contiguous)
- In relocate_kernel_64.S, copy the kernel to a contiguous space and jump/return to purgatory
- In purgatory, reinitialize the hardware if necessary, then jump to the start of the kernel

My issue is that I can't seem to find where the address to which the kernel is copied in step 2 is defined.  Can anyone give me a brief description of how this works?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kexec: where does the kernel image get relocated?
  2012-06-07 22:47 Kexec: where does the kernel image get relocated? Ben Shelton
@ 2012-06-13  2:21 ` Cong Wang
  2012-06-13 16:54 ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2012-06-13  2:21 UTC (permalink / raw)
  To: kexec

On Thu, 07 Jun 2012 at 22:47 GMT, Ben Shelton <beshelto@vt.edu> wrote:
> Hi all,
>
> I'm working on a distributed-computing project where we'd like to boot multiple instances of the Linux kernel on the same machine.  We'd like to leverage kexec to decompress each guest kernel and copy it to an area within the physical address space.
>
> From following through the code and using GDB/QEMU, it seems like the steps to reboot with kexec look like this:
>
> - Decompress the kernel somewhere (not necessarily contiguous)
> - In relocate_kernel_64.S, copy the kernel to a contiguous space and jump/return to purgatory
> - In purgatory, reinitialize the hardware if necessary, then jump to the start of the kernel
>
> My issue is that I can't seem to find where the address to which the kernel is copied in step 2 is defined.  Can anyone give me a brief description of how this works?
>

The kernel relocates itself, you can check the code under
#ifdef CONFIG_RELOCATABLE in arch/x86/boot/compressed/head_64.S and
arch/x86/boot/compressed/misc.c.

Thanks.


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Kexec: where does the kernel image get relocated?
  2012-06-07 22:47 Kexec: where does the kernel image get relocated? Ben Shelton
  2012-06-13  2:21 ` Cong Wang
@ 2012-06-13 16:54 ` Eric W. Biederman
  1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2012-06-13 16:54 UTC (permalink / raw)
  To: Ben Shelton; +Cc: Antonio Barbalace, kexec, Cong Wang

Ben Shelton <beshelto@vt.edu> writes:

> Hi all,
>
> I'm working on a distributed-computing project where we'd like to boot multiple instances of the Linux kernel on the same machine.  We'd like to leverage kexec to decompress each guest kernel and copy it to an area within the physical address space.
>
> From following through the code and using GDB/QEMU, it seems like the steps to reboot with kexec look like this:
>
> - Decompress the kernel somewhere (not necessarily contiguous)
> - In relocate_kernel_64.S, copy the kernel to a contiguous space and jump/return to purgatory
> - In purgatory, reinitialize the hardware if necessary, then jump to the start of the kernel
>
> My issue is that I can't seem to find where the address to which the
> kernel is copied in step 2 is defined.  Can anyone give me a brief
> description of how this works?

The addresses are specified in the kexec_load system call.

If the kernel doesn't like those addresses it might move itself as Cong
Wang mentioned.

/sbin/kexec looks at the headers of the kernel image and either use
where the kernel is required to be loaded by the boot protocol or if the
image is relocatable an available extent of memory that is supported by
the boot protocol is picked.

Eric

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-13 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 22:47 Kexec: where does the kernel image get relocated? Ben Shelton
2012-06-13  2:21 ` Cong Wang
2012-06-13 16:54 ` Eric W. Biederman

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.