With FADump support added on POWERNV paltform, enable the scripts to
capture /proc/vmcore. Also, if CONFIG_OPAL_CORE is enabled, OPAL core
is preserved and exported on POWERNV platform. So, offload OPAL core,
if it is available.
Signed-off-by: Hari Bathini <hbathini(a)linux.ibm.com>
---
Changes in v2:
* add appropriate return statements in opalcore save functions.
dracut-kdump.sh | 31 +++++++++++++++++++++++++++++--
kdump-lib-initramfs.sh | 26 ++++++++++++++++++++++++++
kdumpctl | 3 +++
3 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 2ae1c7c..6dec0b7 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -1,8 +1,8 @@
#!/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
- exit 0
+if [ -f /etc/fadump.initramfs ] && [ ! -f /proc/device-tree/rtas/ibm,kernel-dump ] && [ ! -f /proc/device-tree/ibm,opal/dump/mpipl-boot ]; then
+ exit 0
fi
exec &> /dev/console
@@ -81,6 +81,7 @@ dump_ssh()
ssh -q $_opt $_host mkdir -p $_dir || return 1
save_vmcore_dmesg_ssh ${DMESG_COLLECTOR} ${_dir} "${_opt}" $_host
+ save_opalcore_ssh ${_dir} "${_opt}" $_host
echo "kdump: saving vmcore"
@@ -114,6 +115,32 @@ save_vmcore_dmesg_ssh() {
fi
}
+save_opalcore_ssh() {
+ local _path=$1
+ local _opts="$2"
+ local _location=$3
+
+ if [ ! -f $OPALCORE ]; then
+ # Check if we are on an old kernel that uses a different path
+ if [ -f /sys/firmware/opal/core ]; then
+ OPALCORE="/sys/firmware/opal/core"
+ else
+ return 0
+ fi
+ fi
+
+ echo "kdump: saving opalcore"
+ scp $_opts $OPALCORE $_location:$_path/opalcore-incomplete
+ if [ $? -ne 0 ]; then
+ echo "kdump: saving opalcore failed"
+ return 1
+ fi
+
+ ssh $_opts $_location mv $_path/opalcore-incomplete $_path/opalcore
+ echo "kdump: saving opalcore complete"
+ return 0
+}
+
get_host_ip()
{
local _host
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 8530556..613f976 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -18,6 +18,7 @@ KDUMP_CONF="/etc/kdump.conf"
KDUMP_PRE=""
KDUMP_POST=""
NEWROOT="/sysroot"
+OPALCORE="/sys/firmware/opal/mpipl/core"
get_kdump_confs()
{
@@ -137,6 +138,7 @@ dump_fs()
mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ save_opalcore_fs "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
echo "kdump: saving vmcore"
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1
@@ -173,6 +175,30 @@ save_vmcore_dmesg_fs() {
fi
}
+save_opalcore_fs() {
+ local _path=$1
+
+ if [ ! -f $OPALCORE ]; then
+ # Check if we are on an old kernel that uses a different path
+ if [ -f /sys/firmware/opal/core ]; then
+ OPALCORE="/sys/firmware/opal/core"
+ else
+ return 0
+ fi
+ fi
+
+ echo "kdump: saving opalcore"
+ cp $OPALCORE ${_path}/opalcore
+ if [ $? -ne 0 ]; then
+ echo "kdump: saving opalcore failed"
+ return 1
+ fi
+
+ sync
+ echo "kdump: saving opalcore complete"
+ return 0
+}
+
dump_to_rootfs()
{
diff --git a/kdumpctl b/kdumpctl
index 2d21a41..b4c6e8e 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -249,6 +249,9 @@ check_config()
echo "Invalid kdump config value for option $config_opt."
return 1;
}
+ if [ -d "/proc/device-tree/ibm,opal/dump" ] && [ "$config_opt" == "raw" ]; then
+ echo "WARNING: Won't capture opalcore when 'raw' dump target is used."
+ fi
;;
net|options|link_delay|disk_timeout|debug_mem_level|blacklist)
echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."