getting memory footprint of new kernel

Olaf Hering olaf at aepfle.de
Fri Jan 18 11:38:10 EST 2013


I'm working on kexec support for a ballooned Xen PVonHVM guest.

One of the issues is that the new kernel must run in populated memory,
otherwise it will access ballooned pages and crash.

The kexec syscall passes several physical memory ranges in
kexec_segment->{mem,memsz}. Thats enough info to populate the purgatory
code and early startup code of the new kernel. 

But it lacks the memory range of the new kernel. From my understanding
the entry point is know by kexec(1), it is
kexec/arch/i386/kexec-bzImage.c:do_bzImage_load():kernel32_load_addr
The memory size howver is not known, and I dont see a way to retreive
this information from a bzImage. I think it should be all in the ELF
data of the compressed vmlinux.bin, but this compressed content is not
accessible. 

So what would be a good way to know or estimate the memory size of the
new kernel, and pass the start and size to the balloon driver so that it
can populate the range? I see there are already a few kexec related
sysfs files in kernel/ksysfs.c. What about something like
kexec_newkernel_phys and kexec_newkernel_memsz?

Olaf



More information about the kexec mailing list