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