[PATCH] Set zstd as recommented for kexec-tools
by Tao Liu
This patch will make zstd as recommended instead of required for
kexec-tools. If zstd command/package is unavaliable, it can failback to invoke
gzip when making kdump initramfs.
Fixes: 0311f6e ("Set zstd as the default compression method for kdump initrd")
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 5 +++++
kexec-tools.spec | 2 +-
mkdumprd | 4 +++-
mkfadumprd | 11 +++++++----
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 6415dda..2ea51be 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -31,6 +31,11 @@ is_squash_available()
done
}
+is_zstd_command_available()
+{
+ [[ -x "$(command -v zstd)" ]]
+}
+
perror_exit()
{
derror "$@"
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 90f9355..367929a 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -71,7 +71,7 @@ Requires: dracut >= 050
Requires: dracut-network >= 050
Requires: dracut-squash >= 050
Requires: ethtool
-Requires: zstd
+Recommends: zstd
Recommends: grubby
BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
diff --git a/mkdumprd b/mkdumprd
index 9c26ecc..70aeb4c 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -432,7 +432,9 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
- add_dracut_arg "--compress" "zstd"
+ if is_squash_available || is_zstd_command_available; then
+ add_dracut_arg "--compress" "zstd"
+ fi
fi
if [[ -n $extra_modules ]]; then
diff --git a/mkfadumprd b/mkfadumprd
index 16fdacc..251d4c4 100644
--- a/mkfadumprd
+++ b/mkfadumprd
@@ -60,10 +60,13 @@ _dracut_isolate_args=(
if is_squash_available; then
_dracut_isolate_args+=(--add squash)
-fi
-
-if ! have_compression_in_dracut_args; then
- _dracut_isolate_args+=(--compress zstd)
+ if ! have_compression_in_dracut_args; then
+ _dracut_isolate_args+=(--compress zstd)
+ fi
+else
+ if ! have_compression_in_dracut_args && is_zstd_command_available; then
+ _dracut_isolate_args+=(--compress zstd)
+ fi
fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
--
2.33.1
2 years, 3 months
[PATCH v5 00/13] crashkernel=auto: support fadump and remove crashkernel.default
by Coiby Xu
v5:
- fix several typos found by Pingfan
- add Reviewed-by tags from Pingfan
- fix two bugs of updating /etc/default/grub
- the kernel parameter was hardcoded to crashkernel
- didn't take care of the case where a kernel parameter doesn't exist
in GRUB_CMDLINE_LINUX
v4:
- fixes suggested by Philipp
- fix the bug of always turning fadump off in "kdumpctl reset-crashkernel"
- no duplicate "echo -n"
- "&>/dev/null" replaced by "grep -q"
- wording improvements
- no longer check if the kernel path returned from "grubby --info"
physically exists so setting up crashkernel would work for osbuild
- fix the bug that couldn't switch between --fadump=on and
--fadump=nocma using "kdumpctl reset-crashkernel"
- add comments for "kdumpctl reset-crashkernel" to improve code
readability
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 | 125 +++-----------
kdump-lib.sh | 60 ++++---
kdump.conf | 7 +
kdump.conf.5 | 6 +
kdumpctl | 358 ++++++++++++++++++++++++++++++++++++++---
kdumpctl.8 | 19 ++-
kexec-tools.spec | 22 +++
8 files changed, 442 insertions(+), 290 deletions(-)
--
2.31.1
2 years, 3 months
[PATCH] fix "kdump: Invalid kdump config option auto_reset_crashkernel" error
by Coiby Xu
kdumpctl only accepts a specified set of options. Add
auto_reset_crashkernel to this set.
Fixes: 73ced7f ("introduce the auto_reset_crashkernel option to kdump.conf")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 331af2f..8107487 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -209,7 +209,7 @@ check_config()
ext[234] | minix | btrfs | xfs | nfs | ssh)
config_opt=_target
;;
- sshkey | path | core_collector | kdump_post | kdump_pre | extra_bins | extra_modules | failure_action | default | final_action | force_rebuild | force_no_rebuild | fence_kdump_args | fence_kdump_nodes) ;;
+ sshkey | path | core_collector | kdump_post | kdump_pre | extra_bins | extra_modules | failure_action | default | final_action | force_rebuild | force_no_rebuild | fence_kdump_args | fence_kdump_nodes | auto_reset_crashkernel) ;;
net | options | link_delay | disk_timeout | debug_mem_level | blacklist)
derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
--
2.31.1
2 years, 3 months
[PATCH] use grep -s to suppress error messages about nonexistent or unreadable files
by Coiby Xu
When a file doesn't exist or isn't readable, grep complains as follows,
grep: /proc/cmdline: No such file or directory
grep: /etc/kernel/cmdline: No such file or directory
/proc/cmdline doesn't exist when installing package for an OS image and
/etc/kernel/cmdline may not exist if osbuild doesn't want set custom
kernel cmdline.
Use "-s" to suppress the error messages.
Fixes: 0adb0f4 ("try to reset kernel crashkernel when kexec-tools updates the default crashkernel value")
Fixes: ddd428a ("set up kernel crashkernel for osbuild in kernel hook")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 2 +-
kexec-tools.spec | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index a17bb34..331af2f 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1590,7 +1590,7 @@ reset_crashkernel_for_installed_kernel()
exit 1
fi
- if _is_osbuild && ! grep -q crashkernel= /etc/kernel/cmdline; then
+ if _is_osbuild && ! grep -qs crashkernel= /etc/kernel/cmdline; then
reset_crashkernel "--kernel=$_installed_kernel"
return
fi
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 381a13d..dffcce0 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -261,7 +261,7 @@ mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{d
%pre
# save the old default crashkernel values to /tmp/ when upgrading the package
-if ! grep -q "ostree" /proc/cmdline && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then
+if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then
kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null
%ifarch ppc64 ppc64le
kdumpctl get-default-crashkernel fadump > /tmp/old_default_crashkernel_fadump 2>/dev/null
@@ -303,7 +303,7 @@ fi
# try to reset kernel crashkernel value to new default value when upgrading
# the package
-if ! grep -q "ostree" /proc/cmdline && [ $1 == 2 ]; then
+if ! grep -qs "ostree" /proc/cmdline && [ $1 == 2 ]; then
kdumpctl reset-crashkernel-after-update
rm /tmp/old_default_crashkernel 2>/dev/null
%ifarch ppc64 ppc64le
--
2.31.1
2 years, 3 months
[PATCH v2] kdump-lib.sh: Escape '|' for 'failure_action|default' in is_dump_to_rootfs
by Tao Liu
The '|' in 'failure_action|default' should be replaced with '\|' when
passed to kdump_get_conf_val function. Because '|' needs to be escaped
to mean OR operation in sed regex, otherwise it will consider
'failure_action|default' as a whole string.
Fixes: ab1ef78 ("kdump-lib.sh: use kdump_get_conf_val to read config values")
v1 -> v2:
Rephased the commit message.
Replaced " with '.
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..e5d5a49 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
2 years, 3 months
[PATCH v6] Set zstd as the default compression method for kdump initrd
by Tao Liu
zstd has better compression ratio and time consumption balance.
When no customized compression method specified in kdump.conf,
we will use zstd as the default compression method.
**The test method:
I installed kexec-tools with and without the patch, executing the following
command for 4 times, and calculate the averange time:
$ rm -f /boot/initramfs-*kdump.img && time kdumpctl rebuild && \
ls -ail /boot/initramfs-*kdump.img
**The test result:
Bare metal x86_64 machine:
dracut with squash module
zlib lzo xz lz4 zstd
real 10.6282 11.0398 11.395 8.6424 10.1676
user 9.8932 11.9072 14.2304 2.8286 8.6468
sys 3.523 3.4626 3.6028 3.5 3.4942
size of
kdump.img 30575616 31419392 27102208 36666368 29236224
dracut without squash module
zlib lzo xz lz4 zstd
real 9.509 19.4876 11.6724 9.0338 10.267
user 10.6028 14.516 17.8662 4.0476 9.0936
sys 2.942 2.9184 3.0662 2.9232 3.0662
size of
kdump.img 19247949 19958120 14505056 21112544 17007764
PowerVM hosted ppc64le VM:
dracut with squash module | dracut without sqaush module
zlib zstd | zlib zstd
real 10.6742 10.7572 | 9.7676 10.5722
user 18.754 19.8338 | 20.7932 13.179
sys 1.8358 1.864 | 1.637 1.663
|
size of |
kdump.img 36917248 35467264 | 21441323 19007108
**discussion
zstd has a better compression ratio and time consumption balance.
v1 -> v2:
Use kdump_get_conf_val() to get dracut_args values of kdump.conf
v2 -> v3:
Attached testing benchmark
v3 -> v4:
Re-measured and re-attached the testing benchmark of x86_64 and ppc64le.
Changed regex '.*[[:space:]]' to '(^|[[:space:]])'
v4 -> v5:
Attacked lzo/xz/lz4 testing benchmark.
v5 -> v6:
Add zstd as required in kexec-tools.spec
Hello Coiby, you may use "RELEASE=34 make test-run", for
CONFIG_RD_ZSTD is enabled since fc-cloud-34
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 6 ++++++
kexec-tools.spec | 1 +
mkdumprd | 4 ++++
mkfadumprd | 4 ++++
4 files changed, 15 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 2e2775c..77db71a 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -443,6 +443,12 @@ is_wdt_active()
return 1
}
+have_compression_in_dracut_args()
+{
+ [[ "$(kdump_get_conf_val dracut_args)" =~ \
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
+}
+
# If "dracut_args" contains "--mount" information, use it
# directly without any check(users are expected to ensure
# its correctness).
diff --git a/kexec-tools.spec b/kexec-tools.spec
index ab7f41f..0c6b60f 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -70,6 +70,7 @@ Requires: dracut >= 050
Requires: dracut-network >= 050
Requires: dracut-squash >= 050
Requires: ethtool
+Requires: zstd
Recommends: grubby
BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
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
2 years, 3 months
[PATCH v5] Set zstd as the default compression method for kdump initrd
by Tao Liu
zstd has better compression ratio and time consumption balance.
When no customized compression method specified in kdump.conf,
we will use zstd as the default compression method.
**The test method:
I installed kexec-tools with and without the patch, executing the following
command for 4 times, and calculate the averange time:
$ rm -f /boot/initramfs-*kdump.img && time kdumpctl rebuild && \
ls -ail /boot/initramfs-*kdump.img
**The test result:
Bare metal x86_64 machine:
dracut with squash module
zlib lzo xz lz4 zstd
real 10.6282 11.0398 11.395 8.6424 10.1676
user 9.8932 11.9072 14.2304 2.8286 8.6468
sys 3.523 3.4626 3.6028 3.5 3.4942
size of
kdump.img 30575616 31419392 27102208 36666368 29236224
dracut without squash module
zlib lzo xz lz4 zstd
real 9.509 19.4876 11.6724 9.0338 10.267
user 10.6028 14.516 17.8662 4.0476 9.0936
sys 2.942 2.9184 3.0662 2.9232 3.0662
size of
kdump.img 19247949 19958120 14505056 21112544 17007764
PowerVM hosted ppc64le VM:
dracut with squash module | dracut without sqaush module
zlib zstd | zlib zstd
real 10.6742 10.7572 | 9.7676 10.5722
user 18.754 19.8338 | 20.7932 13.179
sys 1.8358 1.864 | 1.637 1.663
|
size of |
kdump.img 36917248 35467264 | 21441323 19007108
**discussion
zstd has a better compression ratio and time consumption balance.
v1 -> v2:
Use kdump_get_conf_val() to get dracut_args values of kdump.conf
v2 -> v3:
Attached testing benchmark
v3 -> v4:
Re-measured and re-attached the testing benchmark of x86_64 and ppc64le.
Changed regex '.*[[:space:]]' to '(^|[[:space:]])'
v4 -> v5:
Attached lzo/xz/lz4 testing benchmark.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 6 ++++++
mkdumprd | 4 ++++
mkfadumprd | 4 ++++
3 files changed, 14 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e435498..6d668a5 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -443,6 +443,12 @@ is_wdt_active()
return 1
}
+have_compression_in_dracut_args()
+{
+ [[ "$(kdump_get_conf_val dracut_args)" =~ \
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
+}
+
# 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
2 years, 3 months
[PATCH v4 00/13] crashkernel=auto: support fadump and remove crashkernel.default
by Coiby Xu
v4:
- fixes suggested by Philipp
- fix the bug of always turning fadump off in "kdumpctl reset-crashkernel"
- no duplicate "echo -n"
- "&>/dev/null" replaced by "grep -q"
- wording improvements
- no longer check if the kernel path returned from "grubby --info"
physically exists so setting up crashkernel would work for osbuild
- fix the bug that couldn't switch between --fadump=on and
--fadump=nocma using "kdumpctl reset-crashkernel"
- add comments for "kdumpctl reset-crashkernel" to improve code
readability
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 | 345 ++++++++++++++++++++++++++++++++++++++---
kdumpctl.8 | 19 ++-
kexec-tools.spec | 15 ++
8 files changed, 421 insertions(+), 289 deletions(-)
--
2.31.1
2 years, 3 months
[PATCH v4] 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 specified in
kdump.conf, we will use zstd as the default compression method.
**The test method:
I installed kexec-tools with and without the patch, executing the following
command for 4 times, and calculate the averange time:
$ rm -f /boot/initramfs-*kdump.img && time kdumpctl rebuild && \
ls -ail /boot/initramfs-*kdump.img
**The test result:
Bare metal x86_64 machine:
dracut with squash module | dracut without sqaush module
zlib zstd | zlib zstd
real 10.6282 10.1676 | 9.509 10.267
user 9.8932 8.6468 | 10.6028 9.0936
sys 3.523 3.4942 | 2.942 3.0662
|
size of |
kdump.img 30575616 29236224 | 19247949 17007764
PowerVM hosted ppc64le VM:
dracut with squash module | dracut without sqaush module
zlib zstd | zlib zstd
real 10.6742 10.7572 | 9.7676 10.5722
user 18.754 19.8338 | 20.7932 13.179
sys 1.8358 1.864 | 1.637 1.663
|
size of |
kdump.img 36917248 35467264 | 21441323 19007108
**discussion
As for the file size of kdump.img, zstd makes a smaller size, which is
benificial for kdump kernel limited memory.
As for the time consumption for compression when making kdump.img, zstd
doesn't show a clear advance than zlib.
v1 -> v2:
Use kdump_get_conf_val() to get dracut_args values of kdump.conf
v2 -> v3:
Attached testing benchmark
v3 -> v4:
Re-measured and re-attached the testing benchmark of x86_64 and ppc64le.
Changed regex '.*[[:space:]]' to '(^|[[:space:]])'
As for the time consumption differences between v3 and v4, I think it is
due to v3 was measured on a ppc64le VM. There were I/O performance
downgration when other VMs were accessing I/O device at the same time,
which I didn't get repetted in v4.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib.sh | 6 ++++++
mkdumprd | 4 ++++
mkfadumprd | 4 ++++
3 files changed, 14 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e435498..6d668a5 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -443,6 +443,12 @@ is_wdt_active()
return 1
}
+have_compression_in_dracut_args()
+{
+ [[ "$(kdump_get_conf_val dracut_args)" =~ \
+ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]]
+}
+
# 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
2 years, 3 months