[PATCH] Add some missing variables to default sysconfig and kdumpctl
by Dave Young
When I testing arm kdump, the kdump start failed with several missing variables
Copy them from x86 sysconfig to general sysconfig so at least user can set
the right value in sysconfig
Also It's better to add them to the beggining of kdumpctl and initilize them
as nul, later sourcing sysconfig will overwite them.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdump.sysconfig | 9 +++++++++
kdumpctl | 3 +++
2 files changed, 12 insertions(+)
--- kexec-tools.orig/kdump.sysconfig
+++ kexec-tools/kdump.sysconfig
@@ -24,3 +24,12 @@ KDUMP_COMMANDLINE_APPEND="irqpoll maxcpu
# Example:
# KEXEC_ARGS="--elf32-core-headers"
KEXEC_ARGS=""
+
+#Where to find the boot image
+KDUMP_BOOTDIR="/boot"
+
+#What is the image type used for kdump
+KDUMP_IMG=""
+
+#What is the images extension. Relocatable kernels don't have one
+KDUMP_IMG_EXT=""
--- kexec-tools.orig/kdumpctl
+++ kexec-tools/kdumpctl
@@ -9,6 +9,9 @@ MKDUMPRD="/sbin/mkdumprd -f"
SAVE_PATH=/var/crash
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
DUMP_TARGET=""
+KDUMP_BOOTDIR=""
+KDUMP_IMG=""
+KDUMP_IMG_EXT=""
. /lib/kdump/kdump-lib.sh
9 years
[PATCH v3 0/8] kdump: Modify kdump init script to support firmware-assisted dump
by Hari Bathini
This patch set implements firmware-assisted dump support for kdump
service. Firmware-assisted dump support depends on existing kdump
infrastructure (kdump scripts) present in userland to save dump
to the disk. Though existing kdump script will work seemlessly, it
still needs to modified to make it aware of presense of firmware-
assisted dump feature during service start and stop. These changes
are tested successfully on a power box with fedora19.
Changes in v3:
1. Split few functions for readability.
2. Added a cleanup patch to remove unnecessay "function" keyword.
---
Hari Bathini (8):
kdump: Modify status routine to check for firmware-assisted dump
kdump: Modify kdump script to start the firmware assisted dump.
kdump: Modify kdump script to stop firmware assisted dump
kdump: Take a backup of original default initrd before rebuilding.
kdump: Rebuild default initrd for firmware assisted dump
kdump: Get rid of "function" keyword from all functions
kdump: Check for /proc/vmcore existence before capturing the vmcore.
kdump: Add firmware-assisted dump howto document
dracut-kdump.sh | 3
fadump-howto.txt | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
kdumpctl | 308 +++++++++++++++++++++++++++++++++------
3 files changed, 691 insertions(+), 48 deletions(-)
create mode 100644 fadump-howto.txt
--
- Hari
9 years, 1 month
[PATCH v2] kdumpctl: Pass disable_cpu_apicid to kexec of capture kernel
by Jerry Hoemann
== Version 2 ==
Addresses Vivek's review comments:
1. Don't force numeric in awk script snipet.
2. Command line processing is moved from load_kernel to new function
"prepare_cmdline." This new function is responsible for
setting up the command line passed to KEXEC.
3. New function "append_cmdline" is added to append {argument,value}
pair to command line if argument is not already present.
== Version 1 ==
A recent patch (https://lkml.org/lkml/2014/1/15/42) enables multiple
processors in the crash kernel.
To do this safely the crash kernel needs to know which CPU was the 1st
kernel BSP (bootstrap processor) so that the crash kernel will NOT send
the BSP an INIT. If the crash kernel sends an INIT to the 1st kernel
BSP, some systems may reset or hang.
The EFI spec doesn't require that any particular processor is chosen
as the BSP and the CPU (and its apic id) can change from one boot to
the next. Hence automating the selection of CPU to disable if the
system would panic is desired.
This patch updates the kdumpctl script to get the "initial apicid"
of CPU 0 in the first kernel and will pass this as the
"disable_cpu_apicid=" arguement to kexec if it wasn't explicitly
set in /etc/sysconfig/kdump KDUMP_COMMANDLINE_APPEND.
CPU 0 is chosen as it is the processor thats execute the OS
initialization
code and hence was the BSP as per x86 SDM (Vol 3a Section 8.4.)
See associated Red Hat Bugzilla(s) for additional background material:
https://bugzilla.redhat.com/show_bug.cgi?id=1059031
https://bugzilla.redhat.com/show_bug.cgi?id=980621
---
kdumpctl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 54 insertions(+), 7 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 46ae633..0a0bab1 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -41,6 +41,59 @@ function remove_cmdline_param()
echo $cmdline
}
+#
+# This function returns the "initial apicid" of the
+# boot cpu (cpu 0) if present.
+#
+function get_bootcpu_initial_apicid()
+{
+ awk ' \
+ BEGIN { CPU = "-1"; } \
+ $1=="processor" && $2==":" { CPU = $NF; } \
+ CPU=="0" && /initial apicid/ { print $NF; } \
+ ' \
+ /proc/cpuinfo
+}
+
+#
+# This function appends argument "$2=$3" to string ($1) if not already present.
+#
+function append_cmdline()
+{
+ local cmdline=$1
+ local newstr=${cmdline/$2/""}
+
+ # unchanged str implies argument wasn't there
+ if [ "$cmdline" == "$newstr" ]; then
+ cmdline="${cmdline} ${2}=${3}"
+ fi
+
+ echo $cmdline
+}
+
+# This function performs a series of edits on the command line
+function prepare_cmdline()
+{
+ local cmdline;
+ if [ -z "$KDUMP_COMMANDLINE" ]; then
+ cmdline=`cat /proc/cmdline`
+ else
+ cmdline=${KDUMP_COMMANDLINE}
+ fi
+ cmdline=`remove_cmdline_param "$cmdline" crashkernel hugepages hugepagesz`
+
+
+ cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
+
+ local id=`get_bootcpu_initial_apicid`
+ if [ ! -z ${id} ] ; then
+ cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}`
+ fi
+
+ echo $cmdline
+}
+
+
function save_core()
{
coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
@@ -244,13 +297,7 @@ function load_kdump()
fi
fi
- if [ -z "$KDUMP_COMMANDLINE" ]
- then
- KDUMP_COMMANDLINE=`cat /proc/cmdline`
- fi
- KDUMP_COMMANDLINE=`remove_cmdline_param "$KDUMP_COMMANDLINE" crashkernel hugepages hugepagesz`
-
- KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}"
+ KDUMP_COMMANDLINE=`prepare_cmdline`
$KEXEC $KEXEC_ARGS $standard_kexec_args \
--command-line="$KDUMP_COMMANDLINE" \
--
1.8.5.3
9 years, 2 months
[Patch v2] kdump fails loading if target is root fs by default while disk is mounted on save path
by Baoquan He
kdump now dumps vmcore to root partition by default in SAVE_PATCH
directory, e.g /var/crash defaultly. This is problematic when another
disk is mounted on /var or /var/crash, because the saved vmcore will
he hidden after dump in 1st kernel. This also has the potential of
blindly filling the root file system without a clue as to why.
Now fix this by failing the loading of kdump kernel if dump target
is root fs by default while different disk is mounted on save path.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
mkdumprd | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/mkdumprd b/mkdumprd
index bc002bc..d30b34c 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -453,6 +453,34 @@ check_resettable()
return 1
}
+check_block_dump_target()
+{
+ local _target
+ local _mntpoint
+
+ if is_ssh_dump_target || is_nfs_dump_target; then
+ return
+ fi
+
+ _target=$(egrep "^ext[234]|^xfs|^btrfs|^minix|^raw" /etc/kdump.conf 2>/dev/null |awk '{print $2}')
+ [ -n "$_target" ] && return
+
+ #get rootfs device name
+ _target=$(findmnt -k -f -n -o SOURCE /)
+ if [ -b "$_target" ]; then
+ mkdir -p $SAVE_PATH
+ _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
+ if [ "$_mntpoint" != "/" ]; then
+ perror "Currently SAVE_PATH is $SAVE_PATH, $_target is mounted on $_mntpoint. While dump target is root filesystem by default."
+ perror_exit "Then vmcore will be hidden in 1st kernel after dump. Please check /etc/kdump.conf clearly to remove confusion!"
+ fi
+ fi
+
+}
+
+check_block_dump_target
+
if ! check_resettable; then
exit 1
fi
--
1.8.3.1
9 years, 3 months
[PATCH] s390x: do not install /etc/adjtime
by WANG Chao
On s390x, RTC or hardware clock doesn't exist. So we don't need
/etc/adjtime to adjust time to UTC or localtime.
AFAIK, s390 uses a more precise time source which is storing time in
UTC. But we still need /etc/localtime to determine the system-wide time
zone.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4e7d5dc..37a5fa5 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -460,6 +460,16 @@ kdump_install_random_seed() {
bs=$poolsize count=1 2> /dev/null
}
+# /etc/adjtime is used to determine RTC time format (UTC or localtime)
+# /etc/localtime is used to set system timezone
+kdump_install_time() {
+ # RTC doesn't exist on s390
+ if [ `uname -m` != "s390x" ]; then
+ dracut_install -o /etc/adjtime
+ fi
+ dracut_install -o /etc/localtime
+}
+
install() {
kdump_install_conf
>"$initdir/lib/dracut/no-emergency-shell"
@@ -467,7 +477,7 @@ install() {
if is_ssh_dump_target; then
kdump_install_random_seed
fi
- dracut_install -o /etc/adjtime /etc/localtime
+ kdump_install_time
inst "$moddir/monitor_dd_progress" "/kdumpscripts/monitor_dd_progress"
chmod +x ${initdir}/kdumpscripts/monitor_dd_progress
inst "/bin/dd" "/bin/dd"
--
1.8.5.3
9 years, 3 months
[PATCH] adjust the installkernel function to make it return correct value
by Baoquan He
The old implementation in installkernel() will not return success when
added wdt module is not iTCO_wdt. The returned value is related to the
comparison. This is not correct and will cause kdump load failed.
Now move the exact wdt module inserting to the right place, this can
be fixed.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 4e7d5dc..bdadf7c 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -489,7 +489,7 @@ install() {
installkernel() {
wdt=$(lsmod|cut -f1 -d' '|grep "wdt$")
if [ -n "$wdt" ]; then
- instmods $wdt
[ "$wdt" = "iTCO_wdt" ] && instmods lpc_ich
+ instmods $wdt
fi
}
--
1.8.3.1
9 years, 3 months
[PATCH] kdump fails loading if default action is dump_to_rootfs when disk is mounted on save path
by Baoquan He
kdump now defaults to only dump vmcore to the root partition in the
/var/crash directory. This is problematic when /var is a separate
file system because this makes saved vmcore hidden since one can
not unmount /var even in single user mode. This also has the potential
of blindly filling the root file system without out a clue as to why.
Now fix this by failing the loading of kdump kernel if default action
is dump_to_rootfs while different disk is mounted on save path.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kexec-kdump-howto.txt | 3 +++
mkdumprd | 20 ++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 7ffeab9..a43c225 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -430,6 +430,9 @@ There are other default actions available though.
- poweroff
Poweroff system after failure.
+Note that if default action is set to dump_to_rootfs, kdump will fail
+loading of kdump kernel when a different disk is mounted on 'save path'.
+
Compression and filtering
The 'core_collector' parameter in kdump.conf allows you to specify a custom
diff --git a/mkdumprd b/mkdumprd
index bc002bc..a86f8bb 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -370,6 +370,24 @@ get_default_action_target()
return
}
+check_default_action_target()
+{
+ local _target
+ local _mntpoint
+ local _action=$(grep "^default" /etc/kdump.conf 2>/dev/null | awk '{print $2}')
+ if [ -n "$_action" ] && [ "$_action" = "dump_to_rootfs" ]; then
+ #get rootfs device name
+ mkdir -p $SAVE_PATH
+ _mntpoint=`df $SAVE_PATH | tail -1 | awk '{print $NF}'`
+ _target=`df $SAVE_PATH | tail -1 | awk '{print $1}'`
+ if [ "$_mntpoint" != "/" ]; then
+ perror_exit "$_target is mounted on $_mntpoint"
+ fi
+ fi
+ return
+}
+
+
get_override_resettable()
{
local override_resettable
@@ -453,6 +471,8 @@ check_resettable()
return 1
}
+check_default_action_target
+
if ! check_resettable; then
exit 1
fi
--
1.8.3.1
9 years, 3 months
[PATCH v2 0/7] kdump: Modify kdump init script to support firmware-assisted dump
by Hari Bathini
This patch set implements firmware-assisted dump support for kdump
service. Firmware-assisted dump support depends on existing kdump
infrastructure (kdump scripts) present in userland to save dump
to the disk. Though existing kdump script will work seemlessly, it
still needs to modified to make it aware of presense of firmware-
assisted dump feature during service start and stop. These changes
are tested successfully on a power box with fedora19.
Changes in v2:
1. Added dump_mode variable to store dump type to use during checks.
2. Split start, stop and rebuild routines for kdump and fadump.
3. Rebased to kexec-tools version 2.0.4-24.
4. Added fadump howto document.
---
Hari Bathini (7):
kdump: Modify status routine to check for firmware-assisted dump
kdump: Modify kdump script to start the firmware assisted dump.
kdump: Modify kdump script to stop firmware assisted dump
kdump: Take a backup of original default initrd before rebuilding.
kdump: Rebuild default initrd for firmware assisted dump
kdump: Check for /proc/vmcore existence before capturing the vmcore.
kdump: Add firmware-assisted dump howto document
dracut-kdump.sh | 3
fadump-howto.txt | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
kdumpctl | 263 +++++++++++++++++++++++++++++----
3 files changed, 660 insertions(+), 34 deletions(-)
create mode 100644 fadump-howto.txt
--
- Hari
9 years, 3 months
[PATCH v2] Relax restriction of dumping on encrypted target
by Arthur Zou
Resolve: bz1053045
Description:
Currently kdumpctl will fail to create kdump initramfs and start
kdump service while dump target is encrypted. This restriction is
too strict.
Resolution:
Just warn user that encrypted device is in dump path and second
kernel will wait on console for password to be entered.
Signed-off-by: arthur <zzou(a)redhat.com>
---
mkdumprd | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/mkdumprd b/mkdumprd
index bc002bc..6797791 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -467,7 +467,7 @@ is_crypt()
eval "$line"
[[ "$ID_FS_TYPE" = "crypto_LUKS" ]] && {
dev=$(udevadm info --query=all --path=/sys/dev/block/$majmin | awk -F= '/DEVNAME/{print $2}')
- perror "Device $dev is encrypted, can not be used in kdump."
+ echo "Device $dev is encrypted."
return 0
}
return 1
@@ -482,18 +482,11 @@ check_crypt()
[ $_ret -eq 0 ] && return
- if [ $_ret -eq 1 ]; then
- _target=$(get_block_dump_target)
- perror "Can not save vmcore to target device $_target."
- elif [ $_ret -eq 2 ]; then
- perror "Default action is dump_to_rootfs but can not save vmcore to root device."
- fi
-
return 1
}
if ! check_crypt; then
- exit 1
+ echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot."
fi
# firstly get right SSH_KEY_LOCATION
--
1.8.4.2
9 years, 3 months
[PATCH] kdumpctl: Pass disable_cpu_apicid to kexec of capture kernel
by Jerry Hoemann
A recent patch (https://lkml.org/lkml/2014/1/15/42) enables multiple
processors in the crash kernel.
To do this safely the crash kernel needs to know which CPU was the 1st
kernel BSP (bootstrap processor) so that the crash kernel will NOT send
the BSP an INIT. If the crash kernel sends an INIT to the 1st kernel
BSP, some systems may reset or hang.
The EFI spec doesn't require that any particular processor is chosen
as the BSP and the CPU (and its apic id) can change from one boot to
the next. Hence automating the selection of CPU to disable if the
system would panic is desired.
This patch updates the kdumpctl script to get the "initial apicid"
of CPU 0 in the first kernel and will pass this as the
"disable_cpu_apicid=" arguement to kexec if it wasn't explicitly
set in /etc/sysconfig/kdump KDUMP_COMMANDLINE_APPEND.
CPU 0 is chosen as it is the processor thats execute the OS initialization
code and hence was the BSP as per x86 SDM (Vol 3a Section 8.4.)
See associated Red Hat Bugzilla(s) for additional background material:
https://bugzilla.redhat.com/show_bug.cgi?id=1059031
https://bugzilla.redhat.com/show_bug.cgi?id=980621
---
kdumpctl | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 46ae633..0f6cd20 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -208,6 +208,26 @@ function need_64bit_headers()
print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'`
}
+# This function supplies argument disable_cpu_apicid if
+# not explicitly specified in KDUMP_COMMANDLINE_APPEND.
+# It will be the "initial apicid" of CPU 0 if it exists.
+
+function disable_apicid()
+{
+ local cmdline=${KDUMP_COMMANDLINE_APPEND/"disable_cpu_apicid"/":"}
+
+ if [ "$cmdline" != "$KDUMP_COMMANDLINE_APPEND" ] ; then
+ return 0
+ fi
+
+ awk ' \
+ BEGIN { CPU = -1; } \
+ $1=="processor" && $2==":" { CPU = 0+$NF; } \
+ CPU==0 && /initial apicid/ {print "disable_cpu_apicid="$NF;} \
+ ' \
+ /proc/cpuinfo
+}
+
# Load the kdump kerel specified in /etc/sysconfig/kdump
# If none is specified, try to load a kdump kernel with the same version
# as the currently running kernel.
@@ -251,6 +271,7 @@ function load_kdump()
KDUMP_COMMANDLINE=`remove_cmdline_param "$KDUMP_COMMANDLINE" crashkernel hugepages hugepagesz`
KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}"
+ KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} `disable_apicid`"
$KEXEC $KEXEC_ARGS $standard_kexec_args \
--command-line="$KDUMP_COMMANDLINE" \
--
1.8.5.3
9 years, 3 months