[kexec-tools] kdump: Check whether or not to invoke capturing vmcore

WANG Chao wangchao at fedoraproject.org
Mon Jul 28 05:06:19 UTC 2014


commit 78589a32079efb504fb702af6317463654b43498
Author: Hari Bathini <hbathini at linux.vnet.ibm.com>
Date:   Fri Jul 25 00:09:22 2014 +0530

    kdump: Check whether or not to invoke capturing vmcore
    
    The script dracut-kdump.sh is  responsible for capturing vmcore during
    second kernel boot.  Currently this  script  gets installed into kdump
    initrd as part of kdumpbase dracut module.
    
    With fadump support, 'dracut-kdump.sh' script also gets installed into
    default initrd to capture  vmcore generated by firmware assisted dump.
    Thus in fadump case, the  same initrd is  going to be used for  normal
    boot as well as boot after system crash. Hence a  check is required to
    see if it is a normal boot or boot after crash.
    
    A new node "ibm,kernel-dump" is added, to the device tree, by firmware
    to notify kernel if it is booting after crash.  The below patch adds a
    check for this node  before executing  steps to  capture vmcore.  This
    check will help bypassing  the vmcore capture steps during normal boot
    process.
    
    Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
    Signed-off-by: Hari Bathini <hbathini at linux.vnet.ibm.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 dracut-kdump.sh |    5 +++++
 kdumpctl        |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index cb13d92..9958317 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -1,5 +1,10 @@
 #!/bin/sh
 
+# continue here only if we have to save dump.
+if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ]; then
+	return
+fi
+
 exec &> /dev/console
 . /lib/dracut-lib.sh
 . /lib/kdump-lib.sh
diff --git a/kdumpctl b/kdumpctl
index ff09b9a..98de747 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -151,8 +151,12 @@ rebuild_fadump_initrd()
 	# backup fadump initrd for reference before replacing it
 	backup_initrd
 
+	# this file tells the initrd is fadump enabled
+	touch /tmp/fadump.initramfs
 	target_initrd_tmp="$TARGET_INITRD.tmp"
-	$MKDUMPRD $target_initrd_tmp --rebuild $TARGET_INITRD --kver $kdump_kver
+	$MKDUMPRD $target_initrd_tmp --rebuild $TARGET_INITRD --kver $kdump_kver \
+		-i /tmp/fadump.initramfs /etc/fadump.initramfs
+	rm -f /tmp/fadump.initramfs
 	if [ $? != 0 ]; then
 		echo "mkdumprd: failed to rebuild initrd with fadump support" >&2
 		return 1


More information about the scm-commits mailing list