Skip to content

RFC: x86: relocatable kernel changes

H. Peter Anvin kexec lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 30 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14x86, boot: align the .bss section in the decompressorarch/x86/boot/compressed/vmlinux.lds.S+1 -07 replies
2/14x86, boot: honor CONFIG_PHYSICAL_START when relocatablearch/x86/boot/compressed/head_32.S arch/x86/boot/compressed/head_64.S+61 -532 replies
3/14x86, config: change defaults PHYSICAL_START and PHYSICAL_ALIGNarch/x86/Kconfig+11 -83 replies
4/14x86, boot: unify use LOAD_PHYSICAL_ADDR and LOAD_PHYSICAL_ALIGNarch/x86/boot/compressed/head_32.S arch/x86/boot/compressed/head_64.S arch/x86/boot/header.S +1 more+23 -170 replies
5/14kbuild: allow compressors (gzip, bzip2, lzma) to take multiple inputsscripts/Makefile.lib scripts/bin_size+14 -55 replies
6/14x86: add a Kconfig symbol for when relocations are neededarch/x86/Kconfig+5 -00 replies
7/14x86, boot: simplify arch/x86/boot/compressed/Makefilearch/x86/boot/compressed/Makefile+6 -331 reply
8/14x86, boot: use BP_scratch in arch/x86/boot/compressed/head_*.Sarch/x86/boot/compressed/head_32.S arch/x86/boot/compressed/head_64.S+2 -20 replies
9/14x86, boot: add new runtime_address and runtime_size bzImage fieldsarch/x86/boot/Makefile arch/x86/boot/compressed/Makefile arch/x86/boot/compressed/head_32.S +7 more+173 -1013 replies
10/14x86, doc: document the runtime_start and runtime_size bzImage fieldsDocumentation/x86/boot.txt+41 -00 replies
11/14x86, boot: use rep movsq to move kernel on 64 bitsarch/x86/boot/compressed/head_64.S+23 -180 replies
12/14x86, boot: zero EFLAGS on 32 bitsarch/x86/boot/compressed/head_32.S+8 -20 replies
13/14x86: make CONFIG_RELOCATABLE the defaultarch/x86/Kconfig+2 -20 replies
14/14x86, defconfig: update defconfigs to relocatablearch/x86/configs/i386_defconfig arch/x86/configs/x86_64_defconfig+226 -700 replies

Reviews trailers per patch

2 of 14 patches have a Reviewed-by or Acked-by.

PatchSam Ravnborg
1/14
2/14
3/14
4/14
5/14A-b A-b
6/14
7/14A-b
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] RFC: x86: relocatable kernel changes

This series is currently in -tip; the goal of it is to make the semantics of the relocatable kernel fully the same as the non-relocatable kernel when loaded by a relocating bootloader. That means CONFIG_PHYSICAL_START is honored to (a) be able to keep ZONE_DMA free, and avoid the once-again-increasingly-common 15-16 MB hole (don't ask me *why* this abortion is cropping up again, but I'm seeing an increasing number of reports to the effect that it *is*) and (b) make vmlinux match the runtime code in the normal case.

To deal with that constraint, CONFIG_PHYSICAL_START is taken as a minimum address for the kernel. Since a relocating bootloader may have real reasons to load the kernel lower than that (for example, because it has detected that it is on a small-memory system), this adds two new fields to the bzImage header:

runtime_start - CONFIG_PHYSICAL_START
runtime_size - The contiguous memory space consumed by the kernel

The latter is the union of contiguous memory consumed by the kernel during decompression and initialization; this is now possible thanks to Jeremy's .brk patchset. This isn't the same thing as the amount of memory the kernel needs, but rather the amount of memory it will assume that it can use before it starts to be able to read the memory map.

The runtime_start field can be *written* by the bootloader if the kernel is relocatable; e.g. by setting it to zero to indicate that the load address should be used no matter what.

The physical address at which the kernel starts is now:

align_up(max(load_address, runtime_start), kernel_alignment)

This seems to be the best possible compromise between the current behaviors for relocatable and non-relocatable kernels.

This patchset also bumps up the default alignment to a PMD boundary (2 MB for x86-64 and PAE; 4 MB for !PAE). I also change the default CONFIG_PHYSICAL_START to 16 MB (4 MB for CONFIG_EMBEDDED).

The patchset also includes some plain optimizations.

 Documentation/x86/boot.txt             |   41 +++++++++
 arch/x86/Kconfig                       |   28 ++++--
 arch/x86/boot/Makefile                 |   24 ++++--
 arch/x86/boot/compressed/Makefile      |   51 +++--------
 arch/x86/boot/compressed/head_32.S     |  131 +++++++++++++---------------
 arch/x86/boot/compressed/head_64.S     |  129 ++++++++++++----------------
 arch/x86/boot/compressed/mkpiggy.c     |   97 +++++++++++++++++++++
 arch/x86/boot/compressed/vmlinux.lds.S |    1 +
 arch/x86/boot/compressed/vmlinux.scr   |   10 --
 arch/x86/boot/header.S                 |   21 ++++-
 arch/x86/configs/i386_defconfig        |  148 ++++++++++++++++++++++++-------
 arch/x86/configs/x86_64_defconfig      |  148 ++++++++++++++++++++++++--------
 arch/x86/include/asm/boot.h            |   13 +++-
 arch/x86/include/asm/bootparam.h       |    2 +
 arch/x86/kernel/asm-offsets_32.c       |    1 +
 arch/x86/kernel/asm-offsets_64.c       |    1 +
 scripts/Makefile.lib                   |   11 ++-
 scripts/bin_size                       |    8 ++-
 18 files changed, 575 insertions(+), 290 deletions(-)

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec