Use all available CPUs to collect dump

Resolves: https://issues.redhat.com/browse/RHEL-77215
Upstream: kdump-utils
Conflict: manually apply

This patch integrates the sets of commits in kdump-utils upstream
  d428557 Use all available CPUs to collect dump
and
  837f1c9 kdump.sh: Centralize the -F suboption handling
  23bbb11 kdump.sh: Centralize the num-threads sub-option handling
  9a51c4b kdump.sh: Skip num-threads when -E and -F option is present

The latter three commits aims to fix the bug introduced by the first
one. As a result, CORE_COLLECTOR logic is centralized in
get_kdump_confs().

The CORE_COLLECTOR logic in dump_raw() is kept untouched.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2025-12-19 13:58:48 +08:00
parent 3c583d1e5e
commit f95e250b3d
2 changed files with 21 additions and 15 deletions

View File

@ -17,8 +17,7 @@ KDUMP_PATH="/var/crash"
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
KDUMP_TEST_ID=""
KDUMP_TEST_STATUS=""
CORE_COLLECTOR=""
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
FAILURE_ACTION="systemctl reboot -f"
DATEDIR=$(date +%Y-%m-%d-%T)
@ -104,12 +103,25 @@ get_kdump_confs()
esac
done < "$KDUMP_CONF_PARSED"
if [ -z "$CORE_COLLECTOR" ]; then
CORE_COLLECTOR="$DEFAULT_CORE_COLLECTOR"
if is_ssh_dump_target || is_raw_dump_target; then
CORE_COLLECTOR="$CORE_COLLECTOR -F"
fi
fi
case $CORE_COLLECTOR in
*makedumpfile*)
# Ensure no -F in makedumpfile by default.
CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g")
if is_ssh_dump_target || is_raw_dump_target; then
CORE_COLLECTOR="$CORE_COLLECTOR -F"
fi
THREADS=$(nproc)
if [ "$THREADS" -gt 1 ]; then
case "$CORE_COLLECTOR" in
*-F* | *-E*) ;;
*)
CORE_COLLECTOR="$CORE_COLLECTOR --num-threads=$THREADS"
;;
esac
fi
;;
esac
}
# store the kexec kernel log to a file.
@ -136,13 +148,6 @@ dump_fs()
fi
fi
# Remove -F in makedumpfile case. We don't want a flat format dump here.
case $CORE_COLLECTOR in
*makedumpfile*)
CORE_COLLECTOR=$(echo "$CORE_COLLECTOR" | sed -e "s/-F//g")
;;
esac
if [ -z "$KDUMP_TEST_ID" ]; then
_dump_fs_path=$(echo "$1/$KDUMP_PATH/$HOST_IP-$DATEDIR/" | tr -s /)
else

View File

@ -1236,6 +1236,7 @@ install() {
inst "/usr/bin/printf" "/sbin/printf"
inst "/usr/bin/logger" "/sbin/logger"
inst "/usr/bin/chmod" "/sbin/chmod"
inst "/usr/bin/nproc" "/sbin/nproc"
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"