kexec / kdump implementation in Linux Kernel and Xen hypervisor


Published on

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

kexec / kdump implementation in Linux Kernel and Xen hypervisor

  1. 1. kexec/kdump implementation in Linux Kernel and Xen hypervisor usage, history and current developmentsSponsored by: &
  2. 2. Agenda•What is kexec and kdump ?•History of kexec/kdump development in Linux Kernel and Xen.•Current developments.•Future plans.•Resources.•Questions and Answers ?
  3. 3. What is kexec and kdump ?•kexec and kdump are companions.•kdump uses most of the code from kexec.•kexec allows machine restart without jumping into BIOS.•kdump eases kernel debugging when running system was crashed.
  4. 4. What is kexec ?•kexec allows machine restart without jumping into BIOS.•It greatly speeds up system initialization.•kexec does not care about current system state.•It is role of administrator to prepare system for restart.•BIOS does not initialize the devices.•Can lead to unpredictable state when devices were not properlyshutdown.•Load specified kernel and other modules (if user requires it) into memory(kexec -l|--load <kernel-image> …).•Jump into initialization code which finally callsnew kernel (kexec -e|--exec …).
  5. 5. What is kdump ?•kdump eases kernel debugging when running system was crashed.•Requires reserved memory (say 128 MB) that cannot be touched.•Ignores the current state of the machine - just tries to boot.•Boot system with crashkernel option (Linux Kernel orXen hypervisor).•Load specified crash kernel into previously reserved memory bycrashkernel option (kexec -p|--load-panic <kernel-image> …).•… the system will reboot into the dump-capture kernel if a system crash istriggered. Trigger points are located in panic(), die(), die_nmi() and in thesysrq handler (ALT-SysRq-c). … (linux/Documentation/kdump/kdump.txt).
  6. 6. What is kdump ?•New system running under dump-capture kernel expose raw image ofmemory of crashed system through /dev/oldmem device interface.•Through /proc/vmcore ELF format image of memory of crashed system isavailable.•ELF format image is useful for GDB and Crash tool.•… Before analyzing the dump image, you should reboot into a stable kernel. …(linux/Documentation/kdump/kdump.txt).•kexec and kdump are excellent tools, albeit they have some shortcomings.
  7. 7. What is kexec and kdump ?kexec/kdump infrastructure: •kexec-tools - userspace tools. •kexec/kdump implementation in Linux Kernel. •kexec/kdump implementation in Xen.
  8. 8. Details of kexec load phase•kexec -l|--load <kernel-image> …•Compute a hash (SHA 256) of the loaded kernel.•kexec calls sys_kexec_load().•sys_kexec_load() loads kernel into memory and establishesidentity page tables for the kexec kernel.•On Xen hypervisor dom0 kernel callsHYPERVISOR_kexec_op(KEXEC_CMD_kexec_load, …)hypercall which loads kernel into memory on behalf of dom0 kernel.
  9. 9. Details of kexec execution phase•kexec -e|--exec …•kexec calls sys_reboot() with LINUX_REBOOT_CMD_KEXEC cmdargument which later calls kernel_kexec(),•kernel_kexec() calls machine_kexec() which preparearguments for relocate_kernel() and calls it.•On Xen hypervisor dom0 kernel does not call relocate_kernel()directly. First of all it callsHYPERVISOR_kexec_op(KEXEC_CMD_kexec, …) hypercall whichlater calls relocate_kernel().
  10. 10. Details of kexec execution phase•relocate_kernel() switch to identity page tables, relocatekernel and then jump into purgatory code.•purgatory code do some arch specific setup (vga reset, PIC init,backup first 640K of memory on x86 platform if it is panickernel …).•Verify a hash (SHA 256) of the loaded kernel established at loadphase and jump into kexec kernel.•New kernel executes as usual.
  11. 11. History of kexec/kdump development in Linux Kernel and Xen•kexec/kdump were introduced in Linux Kernel Ver. 2.6.13.•Currently (Linux Kernel Ver. 3.0) kexec/kdump support is available oneight platforms (ARM, IA-64, MIPS, PowerPC, S/390, SH, Tile, x86).•kexec/kdump in Xen is available since Ver. 3.0.4.•kexec/kdump under Xen dom0 is not available with paravirt kernel,but it is with old style Xenlinux patches.
  12. 12. Current developments•kexec/kdump implementation in Linux Kernel is quite stable.•kexec/kdump implementation in Xen is quite stable too.•Xenlinux kernels receiving only fixes (if any).•kexec/kdump implementation for pvops Linux Kernel is underdevelopment now.•This work is sponsored by Google under Google Summer ofCode 2011 program.
  13. 13. Current developments•Development is based off 2.6.32 Novell SLES11 Xen kexec/kdumpchanges.•Initial implementation patch (only for dom0) will be posted shortlyon Xen-devel and LKML.•It requires a lot of cleanups.•Currently there are more implementation questions than technicalones.•kexec-tools requires some modification also (will be posted shortlyon, Xen-devel and LKML).
  14. 14. Future plans•kexec/kdump support for PV guest domains.•kexec/kdump support for PVonHVM guest domains (some work isdone by Olaf Hering).•kexec/kdump support for HVM guest domains - it works, however,some cleanups would be required.
  15. 15. Future plansAutomatic Xen/dom0 kernel crash recovery: •Xen or dom0 kernel crashing (guest domains were running). •New incarnation of Xen hypervisor and dom0 kernel is started. •Guest domains are restarted from point at which they were running when Xen/dom0 kernel crash occurred.
  16. 16. Resources• - The Linux Kernel Archives• - kexec-tools src•git:// -kexec-tools development tree•kexec man page•Linux Kernel source: linux/Documentation/kdump/• - Xen Hypervisor• - Xen Source Repositories• - Crash tool
  17. 17. Questions and Answers ?
  18. 18. Thank you for attention