powerpc: enable the scripts to capture dump on POWERNV platform

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@linux.ibm.com>
Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Hari Bathini 2020-01-29 01:04:48 +05:30 committed by Kairui Song
parent 6a20bd5447
commit e3f2f926dd
3 changed files with 58 additions and 2 deletions

View File

@ -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"
@ -96,6 +97,32 @@ dump_ssh()
return 0
}
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
}
save_vmcore_dmesg_ssh() {
local _dmesg_collector=$1
local _path=$2

View File

@ -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()
{

View File

@ -250,6 +250,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."