[PATCH v2] powerpc: enable the scripts to capture dump on POWERNV
platform
by Hari Bathini
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."
4 years, 1 month
[PATCH v2] Add --force option to step 2 in early-kdump-howto.txt
by s.morishima@fujitsu.com
For step2 in early-kdump-howto.txt, --force option of dracut
is necessary to rebuild system initramfs. Without --force option,
executing step2 fails because system initramfs already exists.
Signed-off-by: Shigeki Morishima <s.morishima(a)jp.fujitsu.com>
---
early-kdump-howto.txt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/early-kdump-howto.txt b/early-kdump-howto.txt
index b8cab6a..f4fae36 100644
--- a/early-kdump-howto.txt
+++ b/early-kdump-howto.txt
@@ -34,14 +34,16 @@ You can rebuild the initramfs with earlykdump support with below steps:
For the failure_action, you can choose anything other than "reboot".
2. rebuild system initramfs with earlykdump support.
- # dracut --add earlykdump
+ # dracut --force --add earlykdump
+
+ NOTE: Recommend to backup the original system initramfs before performing
+ this step to put it back if something happens during boot-up.
3. add rd.earlykdump in grub kernel command line.
Note:
[1]. Early kdump initramfs size will be large because it includes vmlinuz and
-kdump initramfs. And for step 2 if you are sure to overwrite system initramfs
-you can backup the original initramfs and use "--force" option.
+kdump initramfs.
[2]. Early kdump inherits the settings of normal kdump, so any changes that
caused normal kdump rebuilding also require rebuilding the system initramfs
--
1.8.3.1
4 years, 1 month
RE: [PATCH] Add --force option to step 2 in early-kdump-howto.txt
by s.morishima@fujitsu.com
Hello,
Thanks for the comment.
> If we remove this, how about explicitly adding a backup process before
> rebuilding initramfs for safety's sake? I think there will also be times
> when we want to put it back completely.
You're right. I will add the statement as note under step 2.
Best Regards,
Shigeki Morishima
> -----Original Message-----
> From: HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab(a)nec.com>
> Sent: Friday, January 31, 2020 12:37 AM
> To: Morishima, Shigeki/森島 茂貴 <s.morishima(a)fujitsu.com>; 'kexec(a)lists.fedoraproject.org'
> <kexec(a)lists.fedoraproject.org>
> Subject: RE: [PATCH] Add --force option to step 2 in early-kdump-howto.txt
>
> > -----Original Message-----
> > Hello,
> >
> > For step2 in early-kdump-howto.txt, --force option of dracut
> > is necessary to rebuild system initramfs. Without --force option,
> > executing step2 fails because system initramfs already exists.
> >
> > Signed-off-by: Shigeki Morishima <s.morishima(a)jp.fujitsu.com>
> > ---
> > early-kdump-howto.txt | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/early-kdump-howto.txt b/early-kdump-howto.txt
> > index b8cab6a..5f592c1 100644
> > --- a/early-kdump-howto.txt
> > +++ b/early-kdump-howto.txt
> > @@ -34,14 +34,13 @@ You can rebuild the initramfs with earlykdump support with below steps:
> > For the failure_action, you can choose anything other than "reboot".
> >
> > 2. rebuild system initramfs with earlykdump support.
> > - # dracut --add earlykdump
> > + # dracut --force --add earlykdump
> >
> > 3. add rd.earlykdump in grub kernel command line.
> >
> > Note:
>
> > [1]. Early kdump initramfs size will be large because it includes vmlinuz and
> > -kdump initramfs. And for step 2 if you are sure to overwrite system initramfs
> > -you can backup the original initramfs and use "--force" option.
> > +kdump initramfs.
>
> Hi,
>
> If we remove this, how about explicitly adding a backup process before
> rebuilding initramfs for safety's sake? I think there will also be times
> when we want to put it back completely.
> (It may be good to have such a procedure as well.)
>
> Thanks,
> Kazu
>
> >
> > [2]. Early kdump inherits the settings of normal kdump, so any changes that
> > caused normal kdump rebuilding also require rebuilding the system initramfs
> > --
> > 1.8.3.1
> >
> > Best Regards,
> > Shigeki Morishima
> >
> > ----------------------------------------------------------------------
> > 森島 茂貴(Morishima Shigeki)
> > 富士通ミッションクリティカルソフトウェア株式会社(MCS)
> > MC サービスソリューション統括部)ネットワークチーム
> > E-mail: s.morishima(a)fujitsu.com
> > Tel: 055-924-7280 (内線: 7260540352)
> > ----------------------------------------------------------------------
> > _______________________________________________
> > kexec mailing list -- kexec(a)lists.fedoraproject.org
> > To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
> > Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org
4 years, 1 month