[PATCH] mkdumprd: allow spaces after 'path' config phrase when network dump
by Kazuhito Hagio
Without this patch, when there are two or more spaces after 'path'
configuration phrase with ssh or nfs setting, SAVE_PATH is set to
'/var/crash' in mkdumprd, and in most cases kdump service fails to
start.
ssh kdump(a)192.168.122.1
path /kdump
^^
This behavior would be too sensitive and different from the other
configurations. With this patch, mkdumprd allows such spaces.
Signed-off-by: Kazuhito Hagio <k-hagio(a)ab.jp.nec.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index a6f7fe8..aa0abfd 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -13,7 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
-SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
+SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
--
2.18.0
1 year, 4 months
[RFC PATCH v4] kdumpctl: don't always rebuild when extra_modules is set
by Kairui Song
We don't necessarily have to always rebuild the initramfs when
extra_modules is set, instead just detect if any module is updated
and only rebuild initramfs if found any updated kernel module.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 3f80ba4..f2e2b76 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -486,6 +486,34 @@ check_wdt_modified()
return 1
}
+# Check if any extra kernel is changed
+check_kmodules_modified()
+{
+ local _extra_modules="$(grep ^extra_modules $KDUMP_CONFIG_FILE | sed 's/^extra_modules\s*//')"
+ local _modified_modules
+
+ # Check for any updated module
+ for _module in $_extra_modules; do
+ _module_file="$(modinfo -k "$kdump_kver" -n "$_module" 2>/dev/null)"
+ if [[ -n "$_module_file" ]]; then
+ _time_stamp="$(stat -c "%Y" "$_module_file")"
+ if [ "$_time_stamp" -gt "$image_time" ]; then
+ _modified_modules+="$_module "
+ fi
+ fi
+ done
+
+ if [[ -n "$_modified_modules" ]]; then
+ echo "Detected change(s) of following kernel modules:"
+ for _module in $_modified_modules; do
+ echo "$_module"
+ done
+ return 1
+ fi
+
+ return 0
+}
+
# returns 0 if system is not modified
# returns 1 if system is modified
# returns 2 if system modification is invalid
@@ -513,12 +541,16 @@ check_system_modified()
return 1
fi
+ check_kmodules_modified
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
return 0
}
check_rebuild()
{
- local extra_modules
local capture_capable_initrd="1"
local _force_rebuild force_rebuild="0"
local _force_no_rebuild force_no_rebuild="0"
@@ -558,10 +590,6 @@ check_rebuild()
return 0
fi
- #will rebuild every time if extra_modules are specified
- extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
- [ -n "$extra_modules" ] && force_rebuild="1"
-
#check to see if dependent files has been modified
#since last build of the image file
if [ -f $TARGET_INITRD ]; then
--
2.20.1
4 years, 5 months
[PATCHv5] kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
On powerpc, after hot add cpu and trigger crash on the hot-added cpu, the
kdump kernel hangs after "I'm in purgatory".
The current udev rules expects the dtb to be rebuit on cpu add/remove event.
But since powerpc does not follow the standard cpu hot add framework, it
only ejects online/offline event to user space when cpu is hot
added/removed, instead of add/remove event. Pingfan tried fixing that but
it didn't please the maintainer as it breaks some old userspace tools.
Due to the failure of dtb's rebuilding, KDump kernel fails to get the
'boot_cpuid' and eventually fails to boot [see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file] if system crashes on hot-added CPU.
Work around it by changing udev rules on powerpc to onlne/offline.
As for offline message, it is even useless on powerpc, and can be dropped.
See the explain: On powerpc, /sys/devices/system/cpu/cpuX nodes are present
for all "possible", irrespective of whether a CPU is hot-added/removed.
crash_notes are already built for all /sys/devices/system/cpu/cpuX nodes and
these nodes are present for all "possible" CPUs
(online/offline/could-be-hot-removed/could-be-hot-added)
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
98-kexec.rules.ppc64 | 15 +++++++++++++++
kexec-tools.spec | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 98-kexec.rules.ppc64
diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
new file mode 100644
index 0000000..1a91220
--- /dev/null
+++ b/98-kexec.rules.ppc64
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling kdump-udev-throttle will end up
+# doing nothing, but systemd-run will always generate extra logs for
+# each call, so trigger the kdump-udev-throttler only if kdump
+# service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1e6686..3ebf9da 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -18,7 +18,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec.rules.ppc64
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -169,10 +170,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
+install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
+%endif
+%ifarch ppc64 ppc64le
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.20.1
4 years, 5 months
[PATCHv4] kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
On powerpc, after hot add cpu and trigger crash on the hot-added cpu, the
kdump kernel hangs after "I'm in purgatory".
The current udev rules expects the dtb to be rebuit on cpu add/remove event.
But since powerpc does not follow the standard cpu hot add framework, it
only ejects online/offline event to user space when cpu is hot
added/removed, instead of add/remove event. Pingfan tried fixing that but
it didn't please the maintainer as it breaks some old userspace tools.
Due to the failure of dtb's rebuilding, KDump kernel fails to get the
'boot_cpuid' and eventually fails to boot [see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file] if system crashes on hot-added CPU.
Work around it by changing udev rules on powerpc to onlne/offline.
As for offline message, it is even useless on powerpc, and can be dropped.
See the explain: On powerpc, /sys/devices/system/cpu/cpuX nodes are present
for all "possible", irrespective of whether a CPU is hot-added/removed.
crash_notes are already built for all /sys/devices/system/cpu/cpuX nodes and
these nodes are present for all "possible" CPUs
(online/offline/could-be-hot-removed/could-be-hot-added)
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
v3 -> v4: fix the mistakenly installed version on non ppc platform. And rename the
file name as 98-kexec.rules.ppc64, installed name as 98-kexec.rules.
Tested on x86 and ppcle
98-kexec.rules.ppc64 | 15 +++++++++++++++
kexec-tools.spec | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 98-kexec.rules.ppc64
diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
new file mode 100644
index 0000000..9d783a0
--- /dev/null
+++ b/98-kexec.rules.ppc64
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling "kdumpctl reload" will end up
+# doing nothing, but it and systemd-run will always generate
+# extra logs for each call, so trigger the "kdumpctl reload"
+# only if kdump service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet /usr/bin/kdumpctl reload'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1e6686..3ebf9da 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -18,7 +18,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec.rules.ppc64
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -169,10 +170,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
+install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
+%endif
+%ifarch ppc64 ppc64le
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.20.1
4 years, 5 months
[PATCH] Revert "kdumpctl: Rebuild initramfs if loaded kernel modules changed"
by Kairui Song
This reverts commit 6b479b657266f130e6dc343817986e88883cabaf.
Check initramfs rebuild by looking at if there is any change of load
kernel modules list is not very stable after all. Previously we are
counting on udev to settle before kdump is started to ensure all modules
is ready, but actually any service may cause a kernel module load, even
after udev is settled.
The previous commit is trying to workaround an issue that VM created
with disk snapshot may fail in the kdump initramfs. The better fix is to
not include the kdump initramfs in the disk snapshot at all, as the
kdump initramfs is not generated for a generic use. And With new added
"kdumpctl reload" command, admins could rebuild the image easily, and
should rebuild the initramfs on hardware change manually.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index ac7b86f..3f80ba4 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -486,31 +486,6 @@ check_wdt_modified()
return 1
}
-check_kmodules_modified()
-{
- # always sort again to avoid LANG/LC inconsistent problem
- local _old_modules="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/loaded-kernel-modules.txt | sort)"
- local _new_modules="$(get_loaded_kernel_modules | sort)"
-
- [[ -z $_old_modules ]] && echo "Warning: Previous loaded kernel module list is absent or empty"
-
- local _added_modules=$(comm -13 <(echo "$_old_modules") <(echo "$_new_modules"))
- local _dropped_modules=$(comm -23 <(echo "$_old_modules") <(echo "$_new_modules"))
-
- if [ "$_old_modules" != "$_new_modules" ]; then
- echo "Detected change(s) of loaded kernel modules list:"
- [[ -n $_added_modules ]] && for _module in $_added_modules; do
- echo " +$_module"
- done
- [[ -n $_dropped_modules ]] && for _module in $_dropped_modules; do
- echo " -$_module"
- done
- return 1
- fi
-
- return 0
-}
-
# returns 0 if system is not modified
# returns 1 if system is modified
# returns 2 if system modification is invalid
@@ -538,11 +513,6 @@ check_system_modified()
return 1
fi
- check_kmodules_modified
- if [ $? -ne 0 ]; then
- return 1
- fi
-
return 0
}
--
2.20.1
4 years, 5 months
[PATCHv3] kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
On powerpc, after hot add cpu and trigger crash on the hot-added cpu, the
kdump kernel hangs after "I'm in purgatory".
The current udev rules expects the dtb to be rebuit on cpu add/remove event.
But since powerpc does not follow the standard cpu hot add framework, it
only ejects online/offline event to user space when cpu is hot
added/removed, instead of add/remove event. Pingfan tried fixing that but
it didn't please the maintainer as it breaks some old userspace tools.
Due to the failure of dtb's rebuilding, KDump kernel fails to get the
'boot_cpuid' and eventually fails to boot [see early_init_dt_scan_cpus() in
arch/powerpc/kernel/prom.c file] if system crashes on hot-added CPU.
Work around it by changing udev rules on powerpc to onlne/offline.
As for offline message, it is even useless on powerpc, and can be dropped.
See the explain: On powerpc, /sys/devices/system/cpu/cpuX nodes are present
for all "possible", irrespective of whether a CPU is hot-added/removed.
crash_notes are already built for all /sys/devices/system/cpu/cpuX nodes and
these nodes are present for all "possible" CPUs
(online/offline/could-be-hot-removed/could-be-hot-added)
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
98-kexec-ppc.rules | 15 +++++++++++++++
kexec-tools.spec | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 98-kexec-ppc.rules
diff --git a/98-kexec-ppc.rules b/98-kexec-ppc.rules
new file mode 100644
index 0000000..9d783a0
--- /dev/null
+++ b/98-kexec-ppc.rules
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling "kdumpctl reload" will end up
+# doing nothing, but it and systemd-run will always generate
+# extra logs for each call, so trigger the "kdumpctl reload"
+# only if kdump service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet /usr/bin/kdumpctl reload'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1e6686..2bc983c 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -18,7 +18,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec-ppc.rules
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -169,10 +170,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifarch ppc64 ppc64le
+install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec-ppc.rules
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.20.1
4 years, 5 months
[PATCHv2] kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
On powerpc, after hot add cpu and trigger crash on the hot-added cpu, the kdump
kernel hangs after "I'm in purgatory".
The current udev rules expects the dtb to be rebuit on cpu add/remove event. But since
powerpc does not follow the standard cpu hot add framework, it only ejects online/offline
event to user space when cpu is hot added/removed, instead of add/remove event.
Pingfan tried fixing that but it didn't please the maintainer as it breaks some
old userspace tools.
Due to the failure of dtb's rebuilding, KDump kernel fails to get the 'boot_cpuid' and
eventually fails to boot [see early_init_dt_scan_cpus() in arch/powerpc/kernel/prom.c file]
if system crashes on hot-added CPU.
Work around it by changing udev rules on powerpc to onlne/offline.
As for offline message, it is even useless on powerpc, and can be dropped. See the explain:
On powerpc, /sys/devices/system/cpu/cpuX nodes are present for all "possible", irrespective
of whether a CPU is hot-added/removed.
crash_notes are already built for all /sys/devices/system/cpu/cpuX nodes and these nodes
are present for all "possible" CPUs (online/offline/could-be-hot-removed/could-be-hot-added)
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
98-kexec-ppc.rules | 15 +++++++++++++++
kexec-tools.spec | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 98-kexec-ppc.rules
diff --git a/98-kexec-ppc.rules b/98-kexec-ppc.rules
new file mode 100644
index 0000000..9d783a0
--- /dev/null
+++ b/98-kexec-ppc.rules
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling "kdumpctl reload" will end up
+# doing nothing, but it and systemd-run will always generate
+# extra logs for each call, so trigger the "kdumpctl reload"
+# only if kdump service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet /usr/bin/kdumpctl reload'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1e6686..2bc983c 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -18,7 +18,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec-ppc.rules
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -169,10 +170,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifarch ppc64 ppc64le
+install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec-ppc.rules
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.20.1
4 years, 5 months
[PATCH] kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
On powerpc, /sys/devices/system/cpu/cpuX nodes are present for all "possible"
CPUs which is what the problem was to start with. As these nodes always exist
irrespective of whether a CPU is hot-added/removed, there is no udev
ADD/REMOVE event when a CPU is hot-added or hot-removed on powerpc64.
Pingfan tried fixing that but it didn't please the maintainer as it breaks some
old userspace tools.
The alternative solution for powerpc was to use CPU online/offline events instead. As
crash_notes are already built for all /sys/devices/system/cpu/cpuX nodes and these nodes
are present for all "possible" CPUs (online/offline/could-be-hot-removed/could-be-hot-added)
on powerpc64, a reload is not necessary for CPU hot-remove. But a reload is still needed
for CPU hot-add because KDump kernel fails to get the 'boot_cpuid' and eventually fails
to boot [see early_init_dt_scan_cpus() in arch/powerpc/kernel/prom.c file] if system crashes
on hot-added CPU..
Workaround it by using a ppc dedicated udev rules, which uses cpu online/offline message.
Further more, as for offline message, it is even useless on powerpc, and can be dropped.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
98-kexec-ppc.rules | 15 +++++++++++++++
kexec-tools.spec | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 98-kexec-ppc.rules
diff --git a/98-kexec-ppc.rules b/98-kexec-ppc.rules
new file mode 100644
index 0000000..9d783a0
--- /dev/null
+++ b/98-kexec-ppc.rules
@@ -0,0 +1,15 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling "kdumpctl reload" will end up
+# doing nothing, but it and systemd-run will always generate
+# extra logs for each call, so trigger the "kdumpctl reload"
+# only if kdump service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet /usr/bin/kdumpctl reload'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1e6686..2bc983c 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -18,7 +18,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.5/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec-ppc.rules
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -169,10 +170,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE28} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifarch ppc64 ppc64le
+install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec-ppc.rules
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.19.1
4 years, 5 months
[PATCH] rhel-only/kexec.rules: create dedicated udev rules for ppc64
by Pingfan Liu
Resolves: bz1633881
https://bugzilla.redhat.com/show_bug.cgi?id=1633881
ppc64 kernel does not follow the standard cpu hotplug convention.
Only online/offline, not add/remove message is observed during hotplug.
Under the current kexec-tools.rules, dtb will not be rebuilt to include
a new plugged in cpu's hardware id. And later, if crashing on the new
cpu, the capture kernel can not boot up on the crashed cpu due to lack of
cpu hardware id in dtb.
Workaround it by using a ppc dedicated udev rules, which uses cpu
online/offline message.
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
98-kexec-ppc.rules | 16 ++++++++++++++++
kexec-tools.spec | 12 +++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
create mode 100644 98-kexec-ppc.rules
diff --git a/98-kexec-ppc.rules b/98-kexec-ppc.rules
new file mode 100644
index 0000000..0555cae
--- /dev/null
+++ b/98-kexec-ppc.rules
@@ -0,0 +1,16 @@
+SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="cpu", ACTION=="offline", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload"
+SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload"
+
+GOTO="kdump_reload_end"
+
+LABEL="kdump_reload"
+
+# If kdump is not loaded, calling "kdumpctl reload" will end up
+# doing nothing, but it and systemd-run will always generate
+# extra logs for each call, so trigger the "kdumpctl reload"
+# only if kdump service is active to avoid unnecessary logs
+RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet /usr/bin/kdumpctl reload'"
+
+LABEL="kdump_reload_end"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 969785e..aab6b1e 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -16,7 +16,8 @@ Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.4/...
Source10: kexec-kdump-howto.txt
Source12: mkdumprd.8
-Source14: 98-kexec.rules
+Source13: 98-kexec.rules
+Source14: 98-kexec-ppc.rules
Source15: kdump.conf.5
Source16: kdump.service
Source18: kdump.sysconfig.s390x
@@ -210,10 +211,15 @@ install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
install -m 755 %{SOURCE20} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib.sh
install -m 755 %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/kdump/kdump-lib-initramfs.sh
%ifnarch s390x
+install -m 755 %{SOURCE29} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+%endif
+%ifnarch s390x ppc64 ppc64le
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
-install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
-install -m 755 %{SOURCE29} $RPM_BUILD_ROOT%{_udevrulesdir}/../kdump-udev-throttler
+install -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec.rules
+%endif
+%ifarch ppc64 ppc64le
+install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_udevrulesdir}/98-kexec-ppc.rules
%endif
install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5
install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service
--
2.19.1
4 years, 5 months
[PATCH v2] kexec-kdump-howto: Add note on setting correct value of kptr_restrict
by Baoquan He
kdumpctl fails to load a crash kernel if KASLR is enabled.
The incorrect configuration of the kptr_restrict parameter causes that
the kdumpctl fails to load a crash kernel. The problem occurs when the
Kernel Address Space Layout Randomization (KASLR) mechanism is enabled.
The value of kptr_restrict decides how to expose the content of /proc
files. Inappropriate setting will cause that the /proc/kallsyms file is
being printed as all zeros. This configuration will break the kdump
loading process since it needs access to the conntent of /proc/kallsyms
if KASLR is enabled.
Set kptr_restrict to 1 to avoid the problem described above.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kexec-kdump-howto.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 011a19f2ec27..12a9450cf83e 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -91,6 +91,12 @@ This line tells kexec to reserve 64M of ram if the system contains between
512M and 2G of physical memory. If the system contains 2G or more of physical
memory, 128M should be reserved.
+Besides, since kdump needs to access /proc/kallsyms during a kernel
+loading if KASLR is enabled, check /proc/sys/kernel/kptr_restrict to
+make sure that the content of /proc/kallsyms is exposed correctly.
+We recommend to set the value of kptr_restrict to '1'. Otherwise
+capture kernel loading could fail.
+
After making said changes, reboot your system, so that the X MB of memory is
left untouched by the normal system, reserved for the capture kernel. Take note
that the output of 'free -m' will show X MB less memory than without this
--
2.17.2
4 years, 5 months