cf4a81
Firmware assisted dump (fadump) HOWTO
cf4a81
cf4a81
Introduction
cf4a81
cf4a81
Firmware assisted dump is a new feature in the 3.4 mainline kernel supported
cf4a81
only on powerpc architecture. The goal of firmware-assisted dump is to enable
cf4a81
the dump of a crashed system, and to do so from a fully-reset system, and to
cf4a81
minimize the total elapsed time until the system is back in production use. A
cf4a81
complete documentation on implementation can be found at
cf4a81
Documentation/powerpc/firmware-assisted-dump.txt in upstream linux kernel tree
cf4a81
from 3.4 version and above.
cf4a81
cf4a81
Please note that the firmware-assisted dump feature is only available on Power6
cf4a81
and above systems with recent firmware versions.
cf4a81
cf4a81
Overview
cf4a81
cf4a81
Fadump
cf4a81
cf4a81
Fadump is a robust kernel crash dumping mechanism to get reliable kernel crash
cf4a81
dump with assistance from firmware. This approach does not use kexec, instead
cf4a81
firmware assists in booting the kdump kernel while preserving memory contents.
cf4a81
Unlike kdump, the system is fully reset, and loaded with a fresh copy of the
cf4a81
kernel. In particular, PCI and I/O devices are reinitialized and are in a
cf4a81
clean, consistent state.  This second kernel, often called a capture kernel,
cf4a81
boots with very little memory and captures the dump image.
cf4a81
cf4a81
The first kernel registers the sections of memory with the Power firmware for
cf4a81
dump preservation during OS initialization. These registered sections of memory
cf4a81
are reserved by the first kernel during early boot. When a system crashes, the
cf4a81
Power firmware fully resets the system, preserves all the system memory
cf4a81
contents, save the low memory (boot memory of size larger of 5% of system
cf4a81
RAM or 256MB) of RAM to the previous registered region. It will also save
cf4a81
system registers, and hardware PTE's.
cf4a81
cf4a81
Fadump is supported only on ppc64 platform. The standard kernel and capture
cf4a81
kernel are one and the same on ppc64.
cf4a81
cf4a81
If you're reading this document, you should already have kexec-tools
cf4a81
installed. If not, you install it via the following command:
cf4a81
cf4a81
    # yum install kexec-tools
cf4a81
cf4a81
Fadump Operational Flow:
cf4a81
cf4a81
Like kdump, fadump also exports the ELF formatted kernel crash dump through
cf4a81
/proc/vmcore. Hence existing kdump infrastructure can be used to capture fadump
cf4a81
vmcore. The idea is to keep the functionality transparent to end user. From
cf4a81
user perspective there is no change in the way kdump init script works.
cf4a81
cf4a81
However, unlike kdump, fadump does not pre-load kdump kernel and initrd into
cf4a81
reserved memory, instead it always uses default OS initrd during second boot
cf4a81
after crash. Hence, for fadump, we rebuild the new kdump initrd and replace it
cf4a81
with default initrd. Before replacing existing default initrd we take a backup
cf4a81
of original default initrd for user's reference. The dracut package has been
cf4a81
enhanced to rebuild the default initrd with vmcore capture steps. The initrd
cf4a81
image is rebuilt as per the configuration in /etc/kdump.conf file.
cf4a81
cf4a81
The control flow of fadump works as follows:
cf4a81
01. System panics.
cf4a81
02. At the crash, kernel informs power firmware that kernel has crashed.
cf4a81
03. Firmware takes the control and reboots the entire system preserving
cf4a81
    only the memory (resets all other devices).
cf4a81
04. The reboot follows the normal booting process (non-kexec).
cf4a81
05. The boot loader loads the default kernel and initrd from /boot
cf4a81
06. The default initrd loads and runs /init
cf4a81
07. dracut-kdump.sh script present in fadump aware default initrd checks if
cf4a81
    '/proc/device-tree/rtas/ibm,kernel-dump'  file exists  before executing
cf4a81
    steps to capture vmcore.
cf4a81
    (This check will help to bypass the vmcore capture steps during normal boot
cf4a81
     process.)
cf4a81
09. Captures dump according to /etc/kdump.conf
cf4a81
10. Is dump capture successful (yes goto 12, no goto 11)
cf4a81
11. Perfom the default action specified in /etc/kdump.conf (Default action
cf4a81
    is reboot, if unspecified)
cf4a81
12. Reboot
cf4a81
cf4a81
cf4a81
How to configure fadump:
cf4a81
cf4a81
Again, we assume if you're reading this document, you should already have
cf4a81
kexec-tools installed. If not, you install it via the following command:
cf4a81
cf4a81
    # yum install kexec-tools
cf4a81
cf4a81
To be able to do much of anything interesting in the way of debug analysis,
cf4a81
you'll also need to install the kernel-debuginfo package, of the same arch
cf4a81
as your running kernel, and the crash utility:
cf4a81
cf4a81
    # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash
cf4a81
cf4a81
Next up, we need to modify some boot parameters to enable firmware assisted
cf4a81
dump. With the help of grubby, it's very easy to append "fadump=on" to the end
cf4a81
of your kernel boot parameters. Optionally, user can also append
cf4a81
'fadump_reserve_mem=X' kernel cmdline to specify size of the memory to reserve
cf4a81
for boot memory dump preservation.
cf4a81
cf4a81
   # grubby --args="fadump=on" --update-kernel=/boot/vmlinuz-`uname -r`
cf4a81
cf4a81
The term 'boot memory' means size of the low memory chunk that is required for
cf4a81
a kernel to boot successfully when booted with restricted memory.  By default,
cf4a81
the boot memory size will be the larger of 5% of system RAM or 256MB.
cf4a81
Alternatively, user can also specify boot memory size through boot parameter
cf4a81
'fadump_reserve_mem=' which will override the default calculated size. Use this
cf4a81
option if default boot memory size is not sufficient for second kernel to boot
cf4a81
successfully.
cf4a81
cf4a81
After making said changes, reboot your system, so that the specified memory is
cf4a81
reserved and left untouched by the normal system. Take note that the output of
cf4a81
'free -m' will show X MB less memory than without this parameter, which is
cf4a81
expected. If you see OOM (Out Of Memory) error messages while loading capture
cf4a81
kernel, then you should bump up the memory reservation size.
cf4a81
cf4a81
Now that you've got that reserved memory region set up, you want to turn on
cf4a81
the kdump init script:
cf4a81
cf4a81
    # systemctl enable kdump.service
cf4a81
cf4a81
Then, start up kdump as well:
cf4a81
cf4a81
    # systemctl start kdump.service
cf4a81
cf4a81
This should turn on the firmware assisted functionality in kernel by
cf4a81
echo'ing 1 to /sys/kernel/fadump_registered, leaving the system ready
cf4a81
to capture a vmcore upon crashing. To test this out, you can force-crash
cf4a81
your system by echo'ing a c into /proc/sysrq-trigger:
cf4a81
cf4a81
    # echo c > /proc/sysrq-trigger
cf4a81
cf4a81
You should see some panic output, followed by the system reset and booting into
cf4a81
fresh copy of kernel. When default initrd loads and runs /init, vmcore should
cf4a81
be copied out to disk (by default, in /var/crash/<YYYY.MM.DD-HH:MM:SS>/vmcore),
cf4a81
then the system rebooted back into your normal kernel.
cf4a81
cf4a81
Once back to your normal kernel, you can use the previously installed crash
cf4a81
kernel in conjunction with the previously installed kernel-debuginfo to
cf4a81
perform postmortem analysis:
cf4a81
cf4a81
    # crash /usr/lib/debug/lib/modules/2.6.17-1.2621.el5/vmlinux
cf4a81
    /var/crash/2006-08-23-15:34/vmcore
cf4a81
cf4a81
    crash> bt
cf4a81
cf4a81
and so on...
cf4a81
cf4a81
Saving vmcore-dmesg.txt
cf4a81
----------------------
cf4a81
Kernel log bufferes are one of the most important information available
cf4a81
in vmcore. Now before saving vmcore, kernel log bufferes are extracted
cf4a81
from /proc/vmcore and saved into a file vmcore-dmesg.txt. After
cf4a81
vmcore-dmesg.txt, vmcore is saved. Destination disk and directory for
cf4a81
vmcore-dmesg.txt is same as vmcore. Note that kernel log buffers will
cf4a81
not be available if dump target is raw device.
cf4a81
cf4a81
Dump Triggering methods:
cf4a81
cf4a81
This section talks about the various ways, other than a Kernel Panic, in which
cf4a81
fadump can be triggered. The following methods assume that fadump is configured
cf4a81
on your system, with the scripts enabled as described in the section above.
cf4a81
cf4a81
1) AltSysRq C
cf4a81
cf4a81
FAdump can be triggered with the combination of the 'Alt','SysRq' and 'C'
cf4a81
keyboard keys. Please refer to the following link for more details:
cf4a81
cf4a81
https://access.redhat.com/articles/231663
cf4a81
cf4a81
In addition, on PowerPC boxes, fadump can also be triggered via Hardware
cf4a81
Management Console(HMC) using 'Ctrl', 'O' and 'C' keyboard keys.
cf4a81
cf4a81
2) Kernel OOPs
cf4a81
cf4a81
If we want to generate a dump everytime the Kernel OOPses, we can achieve this
cf4a81
by setting the 'Panic On OOPs' option as follows:
cf4a81
cf4a81
    # echo 1 > /proc/sys/kernel/panic_on_oops
cf4a81
cf4a81
3) PowerPC specific methods:
cf4a81
cf4a81
On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if
cf4a81
XMON is configured). To configure XMON one needs to compile the kernel with
cf4a81
the CONFIG_XMON and CONFIG_XMON_DEFAULT options, or by compiling with
cf4a81
CONFIG_XMON and booting the kernel with xmon=on option.
cf4a81
cf4a81
Following are the ways to remotely issue a soft reset on PowerPC boxes, which
cf4a81
would drop you to XMON. Pressing a 'X' (capital alphabet X) followed by an
cf4a81
'Enter' here will trigger the dump.
cf4a81
cf4a81
3.1) HMC
cf4a81
cf4a81
Hardware Management Console(HMC) available on Power4 and Power5 machines allow
cf4a81
partitions to be reset remotely. This is specially useful in hang situations
cf4a81
where the system is not accepting any keyboard inputs.
cf4a81
cf4a81
Once you have HMC configured, the following steps will enable you to trigger
cf4a81
fadump via a soft reset:
cf4a81
cf4a81
On Power4
cf4a81
  Using GUI
cf4a81
cf4a81
    * In the right pane, right click on the partition you wish to dump.
cf4a81
    * Select "Operating System->Reset".
cf4a81
    * Select "Soft Reset".
cf4a81
    * Select "Yes".
cf4a81
cf4a81
  Using HMC Commandline
cf4a81
cf4a81
    # reset_partition -m <machine> -p <partition> -t soft
cf4a81
cf4a81
On Power5
cf4a81
  Using GUI
cf4a81
cf4a81
    * In the right pane, right click on the partition you wish to dump.
cf4a81
    * Select "Restart Partition".
cf4a81
    * Select "Dump".
cf4a81
    * Select "OK".
cf4a81
cf4a81
  Using HMC Commandline
cf4a81
cf4a81
    # chsysstate -m <managed system name> -n <lpar name> -o dumprestart -r lpar
cf4a81
cf4a81
3.2) Blade Management Console for Blade Center
cf4a81
cf4a81
To initiate a dump operation, go to Power/Restart option under "Blade Tasks" in
cf4a81
the Blade Management Console. Select the corresponding blade for which you want
cf4a81
to initate the dump and then click "Restart blade with NMI". This issues a
cf4a81
system reset and invokes xmon debugger.
cf4a81
cf4a81
cf4a81
Advanced Setups & Default action:
cf4a81
cf4a81
Kdump and fadump exhibit similar behavior in terms of setup & default action.
cf4a81
For fadump advanced setup related information see section "Advanced Setups" in
cf4a81
"kexec-kdump-howto.txt" document. Refer to "Default action" section in "kexec-
cf4a81
kdump-howto.txt" document for fadump default action related information.
cf4a81
cf4a81
Compression and filtering
cf4a81
cf4a81
Refer "Compression and filtering" section in "kexec-kdump-howto.txt" document.
cf4a81
Compression and filtering are same for kdump & fadump.
cf4a81
cf4a81
cf4a81
Notes on rootfs mount:
cf4a81
Dracut is designed to mount rootfs by default. If rootfs mounting fails it
cf4a81
will refuse to go on. So fadump leaves rootfs mounting to dracut currently.
cf4a81
We make the assumtion that proper root= cmdline is being passed to dracut
cf4a81
initramfs for the time being. If you need modify "KDUMP_COMMANDLINE=" in
cf4a81
/etc/sysconfig/kdump, you will need to make sure that appropriate root=
cf4a81
options are copied from /proc/cmdline. In general it is best to append
cf4a81
command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing
cf4a81
the original command line completely.