[PATCH v3 00/13] crashkernel=auto: support fadump and remove crashkernel.default
by Coiby Xu
v3:
- fixes suggested by Philipp
- fix incorrect usage of kdump_get_arch_recommend_crashkernel
- s/get_default_crashkernel/get-default-crashkernel
- no longer depends on grubby --update-kernel=ALL to update all
kernels' command line parameter and using a single loop to simplify
the code
- indentation issue fix
- commit message improvement
- update crashkernel-howto.txt as suggested by Dave
- CoreOS suppport
- makes "kdumpctl reset-crashkernel" work for CoreOS
- kdumpctl can't be run in RPM scriplet, disable it for
CoreOS
- set up kernel crashkernel for osbuild
v2:
- no longer address the swiotlb memory requirement when SME is enabled
- automatically reset crashkernel to default value only when the value
is set by kexec-tools before. So the crashkernel option to added to
kdump.conf is replaced auto_reset_crashkernel option instead
- multiple fixes suggested by Philipp including regex improvement, typo
fixes, grubby kernel path check and commit message improvements
- address the case where a kernel path is not
/boot/vmlinuz-{KERNEL_RELEASE}
- "kdumpctl fadump" dropped. Support fadump via
"kdumpctl reset-crashkernel [--fadump=[on|off|nocma]]" instead
The crashkernel=auto implementation in kernel space has been rejected
upstream [1]. The current user space implementation [2] [3] ships a
crashkernel.default but hasn't supported fadump. Meanwhile the
crashkernel.default implementation seems to be overly complex,
- the default kernel crashkernel value rarely changes. This is no
need to ship the same crashkernel.default default for every kernel
package of a architecture;
- when deciding the value of crashkernel for a new kernel, the
crashkernel.default of installed kernels and running kernel
is took into consideration (for the details, check
92-crashnernel.install).
According to Kairui [4], crashkernel.default per kernel package is to
accommodate kernel difference, for example, different kernels could be
built with different configurations thus different crashkernel values
are needed. But these should be minor cases and may not be sufficent to
justify the complexity of 92-crashkernel.install. Currently, we don't
know how a kernel debug/feature config would affect the crashkernel
value. Even if a kernel config may require much larger crashkernel, we
can address it in kexec-tools later.
There are are known cases that could lead to a larger crashkernel
including enabling SME, LUKS encryption and etc. But this patch set
would put them aside since they may be took care of in the kernel
space instead.
So this patch set would simply add support for fadump and move the
default kernel crashkernel from kernel package to kexec-tools,
- provide "kdumpctl get-default-crashkernel" for kdump-anaconda-addon
to get the default kernel crashkernel values for a specific
architecture (fadump is supported as well)
- re-write "kdumpctl reset-crashkernel" to support fadump
- introduce auto_reset_crashkernel which determines whether to reset
kernel crashkernel to new default value or not when kexec-tools updates
the default crashkernel value
Because the kernel hook /usr/lib/kernel/install.d/20-grub.install would
make the installed kernel inherit the kernel cmdline of current running
kernel i.e. /proc/cmdline, we only need to reset crashkernel when
kexec-tools increases the default crashkernel values.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-fo...
[2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171
[3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
[4] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
Coiby Xu (13):
update default crashkernel value
factor out kdump_get_arch_recommend_crashkernel
provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and
RPM scriptlet
add a helper function to read kernel cmdline parameter from grubby
--info
add helper functions to get dump mode
add helper functions to get kernel path by kernel release and the path
of current running kernel
fix incorrect usage of rpm-ostree to update kernel command line
parameters
rewrite reset_crashkernel to support fadump and to used by RPM
scriptlet
introduce the auto_reset_crashkernel option to kdump.conf
try to reset kernel crashkernel when kexec-tools updates the default
crashkernel value
reset kernel crashkernel for the special case where the kernel is
updated right after kexec-tools
set up kernel crashkernel for osbuild in kernel hook
update crashkernel-howto
92-crashkernel.install | 135 +----------------
crashkernel-howto.txt | 123 +++-------------
kdump-lib.sh | 60 ++++----
kdump.conf | 7 +
kdump.conf.5 | 6 +
kdumpctl | 320 ++++++++++++++++++++++++++++++++++++++---
kdumpctl.8 | 16 ++-
kexec-tools.spec | 15 ++
8 files changed, 393 insertions(+), 289 deletions(-)
--
2.31.1
1 year, 3 months
[PATCHv2] ppc64/ppc64le: drop cpu online rule in 40-redhat.rules in kdump initramfs
by Pingfan Liu
Onlining secondary cpus breaks kdump completely on KVM on Power hosts
Though we use maxcpus=1 by default but 40-redhat.rules will bring up all
possible cpus by default.
Thus before we get the kernel fix and the systemd rule fix let's remove
the cpu rule in 40-redhat.rules for ppc64/ppc64le kdump initramfs.
This is back ported from RHEL, and original credit goes to Dave Young
<dyoung(a)redhat.com>
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-module-setup.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1ea0d95..c319fc2 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1010,11 +1010,29 @@ kdump_install_systemd_conf() {
echo "ForwardToConsole=yes" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
}
+remove_cpu_online_rule() {
+ local file=${initdir}/usr/lib/udev/rules.d/40-redhat.rules
+
+ sed -i '/SUBSYSTEM=="cpu"/d' "$file"
+}
+
install() {
+ local arch
+
kdump_module_init
kdump_install_conf
remove_sysctl_conf
+ # Onlining secondary cpus breaks kdump completely on KVM on Power hosts
+ # Though we use maxcpus=1 by default but 40-redhat.rules will bring up all
+ # possible cpus by default. (rhbz1270174 rhbz1266322)
+ # Thus before we get the kernel fix and the systemd rule fix let's remove
+ # the cpu online rule in kdump initramfs.
+ arch=$(uname -m)
+ if [[ "$arch" = "ppc64le" ]] || [[ "$arch" = "ppc64" ]]; then
+ remove_cpu_online_rule
+ fi
+
if is_ssh_dump_target; then
kdump_install_random_seed
fi
--
2.31.1
1 year, 3 months
[PATCH] Set zstd as the default compression method for kdump initrd
by Tao Liu
zstd has better compression ratio and time consumption balance than
zlib/lzo/snappy. When no customized compression method is specified in
kdump.conf, we will use zstd as the default compression method for
initrd.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 7 +++++++
mkdumprd | 4 ++++
mkfadumprd | 4 ++++
3 files changed, 15 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e435498..82c2616 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -443,6 +443,13 @@ is_wdt_active()
return 1
}
+have_compression_in_dracut_args()
+{
+ grep -q "^dracut_args .*\-\-
+ \(gzip\|bzip2\|lzma\|xz\|lzo\|lz4\|zstd\|compress\|no-compress\)
+ \([[:space:]]\|$\)" /etc/kdump.conf
+}
+
# If "dracut_args" contains "--mount" information, use it
# directly without any check(users are expected to ensure
# its correctness).
diff --git a/mkdumprd b/mkdumprd
index d87d588..9c26ecc 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -431,6 +431,10 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
+if ! have_compression_in_dracut_args; then
+ add_dracut_arg "--compress" "zstd"
+fi
+
if [[ -n $extra_modules ]]; then
add_dracut_arg "--add-drivers" "$extra_modules"
fi
diff --git a/mkfadumprd b/mkfadumprd
index b890f83..16fdacc 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -62,6 +62,10 @@ if is_squash_available; then
_dracut_isolate_args+=(--add squash)
fi
+if ! have_compression_in_dracut_args; then
+ _dracut_isolate_args+=(--compress zstd)
+fi
+
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"
fi
--
2.33.1
1 year, 3 months
[PATCH] ppc64/ppc64le: drop cpu online rule in 40-redhat.rules in kdump initramfs
by Pingfan Liu
Onlining secondary cpus breaks kdump completely on KVM on Power hosts
Though we use maxcpus=1 by default but 40-redhat.rules will bring up all
possible cpus by default.
Thus before we get the kernel fix and the systemd rule fix let's remove
the cpu rule in 40-redhat.rules for ppc64/ppc64le kdump initramfs.
This is back ported from RHEL, and original credit goes to Dave Young
<dyoung(a)redhat.com>
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
dracut-module-setup.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 1ea0d95..2c7b728 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1010,11 +1010,29 @@ kdump_install_systemd_conf() {
echo "ForwardToConsole=yes" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
}
+remove_cpu_online_rule() {
+ local file=${initdir}/usr/lib/udev/rules.d/40-redhat.rules
+
+ sed -i '/SUBSYSTEM=="cpu"/d' $file
+}
+
install() {
+ local arch
+
kdump_module_init
kdump_install_conf
remove_sysctl_conf
+ # Onlining secondary cpus breaks kdump completely on KVM on Power hosts
+ # Though we use maxcpus=1 by default but 40-redhat.rules will bring up all
+ # possible cpus by default. (rhbz1270174 rhbz1266322)
+ # Thus before we get the kernel fix and the systemd rule fix let's remove
+ # the cpu online rule in kdump initramfs.
+ arch=$(uname -m)
+ if [[ "$arch" = "ppc64le" ]] || [[ "$arch" = "ppc64" ]]; then
+ remove_cpu_online_rule
+ fi
+
if is_ssh_dump_target; then
kdump_install_random_seed
fi
--
2.31.1
1 year, 3 months
[PATCH] kdump-lib.sh: Escape '|' for "failure_action|default" in is_dump_to_rootfs
by Tao Liu
The '|' in "failure_action|default" should be escaped when passed
to kdump_get_conf_val function. Otherwise the regex in kdump_get_conf_val
will consider "failure_action|default" as a whole string instead of
OR operation for 2 strings.
Fixes: (commit ab1ef78aa25b7ae2e34e16a74712079653981e6b)
kdump-lib.sh: use kdump_get_conf_val to read config values
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index d7d28ee..e435498 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -108,7 +108,7 @@ get_block_dump_target()
is_dump_to_rootfs()
{
- [[ $(kdump_get_conf_val "failure_action|default") == dump_to_rootfs ]]
+ [[ $(kdump_get_conf_val "failure_action\|default") == dump_to_rootfs ]]
}
get_failure_action_target()
--
2.33.1
1 year, 3 months
[PATCH v2 00/10] crashkernel=auto: support fadump and remove crashkernel.default
by Coiby Xu
v2:
- no longer address the swiotlb memory requirement when SME is enabled
- automatically reset crashkernel to default value only when the value
is set by kexec-tools before. So the crashkernel option to added to
kdump.conf is replaced auto_reset_crashkernel option instead
- multiple fixes suggested by Philipp including regex improvement, typo
fixes, grubby kernel path check and commit message improvements
- address the case where a kernel path is not
/boot/vmlinuz-{KERNEL_RELEASE}
- "kdumpctl fadump" dropped. Support fadump via
"kdumpctl reset-crashkernel [--fadump=[on|off|nocma]]" instead
The crashkernel=auto implementation in kernel space has been rejected
upstream [1]. The current user space implementation [2] [3] ships a
crashkernel.default but hasn't supported fadump. Meanwhile the
crashkernel.default implementation seems to be overly complex,
- the default kernel crashkernel value rarely changes. This is no
need to ship the same crashkernel.default default for every kernel
package of a architecture;
- when deciding the value of crashkernel for a new kernel, the
crashkernel.default of installed kernels and running kernel
is took into consideration (for the details, check
92-crashnernel.install).
According to Kairui [4], crashkernel.default per kernel package is to
accommodate kernel difference, for example, different kernels could be
built with different configurations thus different crashkernel values
are needed. But these should be minor cases and may not be sufficent to
justify the complexity of 92-crashkernel.install. Currently, we don't
know how a kernel debug/feature config would affect the crashkernel
value. Even if a kernel config may require much larger crashkernel, we
can address it in kexec-tools later.
There are are known cases that could lead to a larger crashkernel
including enabling SME, LUKS encryption and etc. But this patch set
would put them aside since they may be took care of in the kernel
space instead.
So this patch set would simply add support for fadump and move the
default kernel crashkernel from kernel package to kexec-tools,
- provide "kdumpctl get-default-crashkernel" for kdump-anaconda-addon
to get the default kernel crashkernel values for a specific
architecture (fadump is supported as well)
- re-write "kdumpctl reset-crashkernel" to support fadump
- introduce auto_reset_crashkernel which determines whether to reset
kernel crashkernel to new default value or not when kexec-tools updates
the default crashkernel value
Because the kernel hook /usr/lib/kernel/install.d/20-grub.install would
make the installed kernel inherit the kernel cmdline of current running
kernel i.e. /proc/cmdline, we only need to reset crashkernel when
kexec-tools increases the default crashkernel values.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-fo...
[2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171
[3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
[4] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
Coiby Xu (10):
update default crashkernel value
factor out kdump_get_arch_recommend_crashkernel
provide kdumpctl get-default-crashkernel for kdump_anaconda_addon and
RPM scriptlet
add a helper function to read kernel cmdline parameter from grubby
--info
add helper functions to get dump mode
add helper functions to get kernel path by kernel release and the path
of current running kernel
rewrite reset_crashkernel to support fadump and to used by RPM
scriptlet
introduce the auto_reset_crashkernel option to kdump.conf
try to reset kernel crashkernel when kexec-tools updates the default
crashkernel value
reset kernel crashkernel for the special case where the kernel is
updated right after kexec-tools
92-crashkernel.install | 135 +---------------------
kdump-lib.sh | 60 ++++++----
kdump.conf | 7 ++
kdump.conf.5 | 6 +
kdumpctl | 256 +++++++++++++++++++++++++++++++++++++----
kexec-tools.spec | 15 +++
6 files changed, 301 insertions(+), 178 deletions(-)
--
2.31.1
1 year, 3 months
[PATCH] kdump/ppc64: suppress the error message "Could not find a registered notification tool" from servicelog_notify
by Coiby Xu
When kexec-tools is newly installed, kdump migration action isn't
registered and the following error could occur,
INF dnf.rpm: Could not find a registered notification tool with the specified command ('/usr/lib/kdump/kdump-migrate-action.sh').
"servicelog_notify --list" could list registered notification tools for
a command but it outputs the above error as well. So simply redirect the
error to /dev/null when running "servicelog_notify --remove".
Fixes: commit 146f66262222e96bca47b691ed243fa5097aa55c
("kdump/ppc64: migration action registration clean up")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kexec-tools.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index dcab391..ab7f41f 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -265,7 +265,7 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
touch /etc/kdump.conf
%ifarch ppc64 ppc64le
-servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
+servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null
servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin
%endif
--
2.31.1
1 year, 3 months