[PATCH] kdump-lib: fix the matching pattern for debug-kernel
by Pingfan Liu
On aarch64, a 64k kernel's name looks like:
vmlinuz-5.14.0-300.el9.aarch64+64k and the corresponding debug kernel's
name looks like: vmlinuz-5.14.0-300.el9.aarch64+64k-debug, which ends
with the suffix -debug instead of +debug.
Fix the matching pattern by [+|-]debug
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 75b31b2..20d2d0c 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -523,12 +523,13 @@ _get_kdump_kernel_version()
fi
_version=$(uname -r)
- if [[ ! "$_version" =~ \+debug$ ]]; then
+ if [[ ! "$_version" =~ [+|-]debug$ ]]; then
echo "$_version"
return
fi
_version_nondebug=${_version%+debug}
+ _version_nondebug=${_version_nondebug%-debug}
if [[ -f "$(prepare_kdump_kernel "$_version_nondebug")" ]]; then
dinfo "Use of debug kernel detected. Trying to use $_version_nondebug"
echo "$_version_nondebug"
--
2.31.1
4 months, 1 week
[PATCH] mkdumprd: add --aggressive-strip as default dracut args
by Kairui Song
From: Kairui Song <kasong(a)tencent.com>
The new aggressive strip option was added in dracut 058, which tell
dracut to build the initramfs stripping more sections of the ELF
binaries (basically strip .symtab, .strtab).
These section are only useful for debugging runtime failures, but in
kdump kernel, neccessary tools for debug any runtime failure are
absent, there is no point keeping these sections.
Stripping these section can help save some memory with almost no side
effect. So let enable --aggressive-strip by default.
Comparison of unpacked initramfs before / after enabling aggressive strip:
du -hs image image.aggressive-strip
31M image
29M image.aggressive-strip
Signed-off-by: Kairui Song <kasong(a)tencent.com>
---
kexec-tools.spec | 6 +++---
mkdumprd | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index d2a8aca..d55b163 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -61,9 +61,9 @@ Requires(post): servicelog
Recommends: keyutils
%endif
Requires(pre): coreutils sed zlib
-Requires: dracut >= 050
-Requires: dracut-network >= 050
-Requires: dracut-squash >= 050
+Requires: dracut >= 058
+Requires: dracut-network >= 058
+Requires: dracut-squash >= 058
Requires: ethtool
Requires: util-linux
Recommends: grubby
diff --git a/mkdumprd b/mkdumprd
index a3e5938..63a37a7 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -27,7 +27,7 @@ SAVE_PATH=$(get_save_path)
OVERRIDE_RESETTABLE=0
extra_modules=""
-dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' -o "plymouth resume ifcfg earlykdump")
+dracut_args=(--add kdumpbase --quiet --hostonly --hostonly-cmdline --hostonly-i18n --hostonly-mode strict --hostonly-nics '' --aggressive-strip -o "plymouth resume ifcfg earlykdump")
MKDUMPRD_TMPDIR="$(mktemp -d -t mkdumprd.XXXXXX)"
[ -d "$MKDUMPRD_TMPDIR" ] || perror_exit "dracut: mktemp -p -d -t dracut.XXXXXX failed."
--
2.39.1
4 months, 2 weeks
[PATCH 0/3] add crashkernel=auto support for aarch64-64k
by Pingfan Liu
The aarch64-64k has significantly higher memory consumption than 4k and
requires an independent formula to calculate the reserved memory size.
Since the two main obstacles have been addressed:
1. The leaping upgrade issue has been resolved by forcing auto_reset_crashkernel=yes.
2. The estimation of LUKS2-encrypted memory consumption will be resolved by using “kdumpctl estimate --reboot”.
This series focuses on estimating crashkernel memory on a 64k kernel.
The "crashkernel="formula is no longer static; instead, it is determined
by the runtime hardware environment.
To: kexec(a)lists.fedoraproject.org
Cc: Coiby Xu <coxu(a)redhat.com>
Pingfan Liu (3):
kdump-lib: add support for 64K aarch64
kdump-lib: evaluate the memory consumption by smmu separately
kdump-lib: evaluate the memory consumption by mlx5 separately
kdump-lib.sh | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++--
kdumpctl | 22 +++++++++++++
2 files changed, 109 insertions(+), 2 deletions(-)
--
2.31.1
4 months, 3 weeks
[PATCH v3] Output memstrack report after do_kdump_post()
by Tao Liu
We will output memstrack analysis report in kexec-tools side during kdump.
Becasue kdump will use 'reboot -f' to reboot 2nd kernel by default,
which leaves no stable hook target to terminate memstrack and output its
analysis report in dracut side. However it is easy to implement in
kexec-tools side.
In this patch, we will place the memstrack report after do_kdump_post(),
so the whole kdump process can be recorded by memstrack and analyzed.
Note this will make memstrack share memory with kdump in 2nd kernel, so
a larger possibility of memory shortage is expected. A bigger
crashkernel value will help if it is truly a problem.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
v1 -> v2: move memstrack report from do_kdump_pre to do_kdump_post.
v2 -> v3: remove pkill/pgrep way of kill memstrack, only keep systemctl
stop way of kill memstrack. Since systemctl is always available
in kdump case.
---
dracut-kdump.sh | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 4eec70b..9971e2c 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -574,6 +574,21 @@ fence_kdump_notify()
fi
}
+handle_memstrack_report()
+{
+ MEMSTRACK_LOG="/.memstrack"
+
+ if [ "$DEBUG_MEM_LEVEL" -lt 4 ]; then
+ return
+ fi
+
+ systemctl stop memstrack.service
+
+ if [ -e "$MEMSTRACK_LOG" ]; then
+ IFS= dinfo < "$MEMSTRACK_LOG"
+ fi
+}
+
if [ "$1" = "--error-handler" ]; then
get_kdump_confs
do_failure_action
@@ -615,6 +630,8 @@ fi
save_log
+handle_memstrack_report
+
if [ $DUMP_RETVAL -ne 0 ]; then
exit 1
fi
--
2.33.1
4 months, 3 weeks
[PATCH v2] Output memstrack report after do_kdump_post()
by Tao Liu
We will output memstrack analysis report in kexec-tools side during kdump.
Becasue kdump will use 'reboot -f' to reboot 2nd kernel by default,
which leaves no stable hook target to terminate memstrack and output its
analysis report in dracut side. However it is easy to implement in
kexec-tools side.
In this patch, we will place the memstrack report after do_kdump_post(),
so the whole kdump process can be recorded by memstrack and analyzed.
Note this will make memstrack share memory with kdump in 2nd kernel, so
a larger possibility of memory shortage is expected. A bigger
crashkernel value will help if it is truly a problem.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
v1 -> v2: move memstrack report from do_kdump_pre to do_kdump_post.
---
dracut-kdump.sh | 22 ++++++++++++++++++++++
dracut-module-setup.sh | 2 ++
2 files changed, 24 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 4eec70b..8f4bc11 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -574,6 +574,26 @@ fence_kdump_notify()
fi
}
+handle_memstrack_report()
+{
+ MEMSTRACK_LOG="/.memstrack"
+
+ if [ "$DEBUG_MEM_LEVEL" -lt 4 ]; then
+ return
+ fi
+
+ if pgrep -c '[m]emstrack' > /dev/null; then
+ pkill --signal INT '[m]emstrack'
+ while pgrep -c '[m]emstrack' > /dev/null; do
+ sleep 1
+ done
+ fi
+
+ if [ -e "$MEMSTRACK_LOG" ]; then
+ IFS= dinfo < "$MEMSTRACK_LOG"
+ fi
+}
+
if [ "$1" = "--error-handler" ]; then
get_kdump_confs
do_failure_action
@@ -615,6 +635,8 @@ fi
save_log
+handle_memstrack_report
+
if [ $DUMP_RETVAL -ne 0 ]; then
exit 1
fi
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index a8ac16c..37845e3 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1033,6 +1033,8 @@ install() {
inst "/usr/bin/printf" "/sbin/printf"
inst "/usr/bin/logger" "/sbin/logger"
inst "/usr/bin/chmod" "/sbin/chmod"
+ inst "/usr/bin/pkill" "/usr/bin/pkill"
+ inst "/usr/bin/pgrep" "/usr/bin/pgrep"
inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
inst "$moddir/kdump.sh" "/usr/bin/kdump.sh"
--
2.33.1
5 months, 2 weeks
[RFC PATCH 0/3] kdumpctl: Add basic UKI support
by Philipp Rudo
Hi everybody,
This short series adds basic support for UKIs as they are currently implemented
in RHEL. There are currently two issues remaining.
1) When testing on Azure the crash kernel hangs when reading from /proc/vmcore.
2) There is an open MR [1] for kernel-ark to rename the installed UKI to match
the naming suggested by the BLS.
Both issues shouldn't impact the implementation for kdumpctl (other than
changing the file name). Nevertheless sending the series as an RFC for now.
Thanks
Philipp
[1] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2391
Philipp Rudo (3):
kdumpctl: Move get_kernel_size to kdumpctl
kdumpctl: Move temp file in get_kernel_size to global temp dir
kdumpctl: Add basic UKI support
kdump-lib.sh | 93 +++++++++++----------------------------------------
kdump.service | 1 +
kdumpctl | 90 ++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 110 insertions(+), 74 deletions(-)
--
2.39.2
5 months, 2 weeks
[PATCH] Output memstrack report before do_kdump_pre()
by Tao Liu
We will output memstrack analysis report in kexec-tools side during kdump.
Becasue kdump will use 'reboot -f' to reboot 2nd kernel by default,
which leaves no stable hook target to terminate memstrack and output its
analysis report in dracut side. However it is easy to implement in
kexec-tools side.
In this patch, we will place the memstrack report before do_kdump_pre()
for now, that is right before kdump starts, so kdump will not share memory
with memstrack. However if later we want memstrack to record memory status
during kdump as well, we can easily place it after do_kdump_post().
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
dracut-kdump.sh | 22 ++++++++++++++++++++++
dracut-module-setup.sh | 2 ++
2 files changed, 24 insertions(+)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 4eec70b..8096da4 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -574,6 +574,26 @@ fence_kdump_notify()
fi
}
+handle_memstrack_report()
+{
+ MEMSTRACK_LOG="/.memstrack"
+
+ if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
+ return
+ fi
+
+ if pgrep -c '[m]emstrack' > /dev/null; then
+ pkill --signal INT '[m]emstrack'
+ while pgrep -c '[m]emstrack' > /dev/null; do
+ sleep 1
+ done
+ fi
+
+ if [ -e "$MEMSTRACK_LOG" ]; then
+ IFS= dinfo < "$MEMSTRACK_LOG"
+ fi
+}
+
if [ "$1" = "--error-handler" ]; then
get_kdump_confs
do_failure_action
@@ -599,6 +619,8 @@ if [ -z "$DUMP_INSTRUCTION" ]; then
DUMP_INSTRUCTION="dump_fs $NEWROOT"
fi
+handle_memstrack_report
+
if ! do_kdump_pre; then
derror "kdump_pre script exited with non-zero status!"
do_final_action
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index a8ac16c..37845e3 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -1033,6 +1033,8 @@ install() {
inst "/usr/bin/printf" "/sbin/printf"
inst "/usr/bin/logger" "/sbin/logger"
inst "/usr/bin/chmod" "/sbin/chmod"
+ inst "/usr/bin/pkill" "/usr/bin/pkill"
+ inst "/usr/bin/pgrep" "/usr/bin/pgrep"
inst "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump-lib-initramfs.sh"
inst "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
inst "$moddir/kdump.sh" "/usr/bin/kdump.sh"
--
2.33.1
5 months, 2 weeks
[PATCH v2 0/8] Small cleanup and a two fixes
by Philipp Rudo
Hi everybody,
While looking at the code I noticed that it contains some dead functions. This
series removes them. Furthermore it fixes two small bugs.
Thanks
Philipp
v1 -> v2:
* Use correct function name kdump_get_maj_min -> get_maj_min (thanks Lichen)
* Fix typo in spec file util-linx -> util-linux
* Rebase to latest rawhide
Philipp Rudo (8):
kdump-lib-initramfs: harden is_mounted
kdump-lib-initramfs: remove is_fs_dump_target
dracut-module-setup: remove dead source_ifcfg_file
kdump-lib: remove get_nmcli_field_by_conpath
kdump-lib: remove get_nmcli_connection_apath_by_ifname
kdump-lib: remove kdump_get_maj_min
kdump-lib: move is_dracut_mod_omitted to kdumpctl
kdumpctl: fix is_dracut_mod_omitted
dracut-module-setup.sh | 13 ---
kdump-lib-initramfs.sh | 7 +-
kdump-lib.sh | 159 +---------------------------------
kdumpctl | 51 +++++++++++
kexec-tools.spec | 1 +
spec/kdumpctl_general_spec.sh | 48 ++++++++++
6 files changed, 104 insertions(+), 175 deletions(-)
--
2.39.2
5 months, 2 weeks
[PATCH v2 1/2] Tell nmcli to not escape colon when getting the path of connection profile
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151504
When a NetworManager connection profile contains a colon in the name,
"nmcli --get-values UUID,FILENAME" by default would escape the colon
because a colon is also used for separating the values. In this case,
99kdumpbase fails to get the correct connection profile path,
kdumpctl[5439]: cp: cannot stat '/run/NetworkManager/system-connections/static-52\\\:54\\\:01.nmconnection': No such file or directory
kdumpctl[5440]: sed: can't read /tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01: No such file or directory
kdumpctl[5449]: dracut-install: ERROR: installing '/tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01' to '/etc/NetworkManager/system-connections/ifcfg-static-52-54-01'
As a result, dumping vmcore to a remote nfs would fail.
In our case of getting connection profile path, there is no need to escape the
colon so pass "-escape no" to nmcli,
[root@localhost ~]# nmcli --get-values UUID,FILENAME c show
659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa\:bb.nmconnection
[root@localhost ~]# nmcli -escape no --get-values UUID,FILENAME c show
659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa:bb.nmconnection
Suggested-by: Beniamino Galvani <bgalvani(a)redhat.com>
Reported-by: Martin Pitt <mpitt(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
Reviewed-by: Philipp Rudo <prudo(a)redhat.com>
---
dracut-module-setup.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ab398414..c8015cb5 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -318,7 +318,9 @@ clone_and_modify_nmconnection() {
# connection profile based on MAC address
_match_nmconnection_by_mac "$_uuid" "$_dev"
- _cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
+ # If a value contain ":", nmcli by default escape it with "\:" because it
+ # also uses ":" as the delimiter to separate values. In our case, escaping is not needed.
+ _cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
# change uuid back to old value in case it's refered by other connection
--
2.39.2
5 months, 2 weeks
[PATCH 1/2] Tell nmcli to not escape colon when getting the path of connection profile
by Coiby Xu
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151504
When a NetworManager connection profile contains a colon in the name,
"nmcli --get-values UUID,FILENAME" by default would escape the colon
because a colon is also used for separating the values. In this case,
99kdumpbase fails to get the correct connection profile path,
kdumpctl[5439]: cp: cannot stat '/run/NetworkManager/system-connections/static-52\\\:54\\\:01.nmconnection': No such file or directory
kdumpctl[5440]: sed: can't read /tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01: No such file or directory
kdumpctl[5449]: dracut-install: ERROR: installing '/tmp/1977-DRACUT_KDUMP_NM/ifcfg-static-52-54-01' to '/etc/NetworkManager/system-connections/ifcfg-static-52-54-01'
As a result, dumping vmcore to a remote nfs would fail.
In our case of getting connection profile path, there is no need to escape the
colon so pass "-escape no" to nmcli,
[root@localhost ~]# nmcli --get-values UUID,FILENAME c show
659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa\:bb.nmconnection
[root@localhost ~]# nmcli -escape no --get-values UUID,FILENAME c show
659e09c1-a6bd-3549-9be4-a07a1a9a8ffd:/etc/NetworkManager/system-connections/aa:bb.nmconnection
Suggested-by: Beniamino Galvani <bgalvani(a)redhat.com>
Reported-by: Martin Pitt <mpitt(a)redhat.com>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
dracut-module-setup.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ab398414..c8015cb5 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -318,7 +318,9 @@ clone_and_modify_nmconnection() {
# connection profile based on MAC address
_match_nmconnection_by_mac "$_uuid" "$_dev"
- _cloned_nmconnection_file_path=$(nmcli --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
+ # If a value contain ":", nmcli by default escape it with "\:" because it
+ # also uses ":" as the delimiter to separate values. In our case, escaping is not needed.
+ _cloned_nmconnection_file_path=$(nmcli --escape no --get-values UUID,FILENAME connection show | sed -n "s/^${_uuid}://p")
_tmp_nmconnection_file_path=$_DRACUT_KDUMP_NM_TMP_DIR/$(basename "$_nmconnection_file_path")
cp "$_cloned_nmconnection_file_path" "$_tmp_nmconnection_file_path"
# change uuid back to old value in case it's refered by other connection
--
2.39.2
5 months, 3 weeks