powerpc: consider CPU count while calculating crashkernel value
Resolves: https://issues.redhat.com/browse/RHEL-77215 Upstream: kdump-utils Conflict: manually apply commit 0d389855086ca3f1de8421c540ade79d403e1abd Author: Sourabh Jain <sourabhjain@linux.ibm.com> Date: Sat Aug 23 22:29:10 2025 +0530 powerpc: consider CPU count while calculating crashkernel value The next patch in the series adds more CPUs to the capture kernel, which increases the memory requirement for the capture kernel. Experiments show that powerpc needs 1 MB of additional memory for every CPU added. Therefore, while calculating the crashkernel size, make sure to include an additional 1 MB for every CPU configured in the capture kernel. The changes are implemented in such a way that if the user changes the nr_cpus value in the kdump configuration, the script will adapt accordingly. Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> Since the find_nr_cpus() function can not get the bash variable $FADUMP_COMMANDLINE_APPEND and $KDUMP_COMMANDLINE_APPEND in RHEL-9, extract them from /etc/sysconfig/kdump directly Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
f95e250b3d
commit
1b53bbd448
41
kdump-lib.sh
41
kdump-lib.sh
@ -1135,6 +1135,39 @@ _crashkernel_add()
|
||||
echo "${ret%,}"
|
||||
}
|
||||
|
||||
# Parses the kdump or fadump command line to extract a valid
|
||||
# positive nr_cpus=<N> value, defaulting to 1 if none is found.
|
||||
find_nr_cpus()
|
||||
{
|
||||
local _cmdline_append
|
||||
local _nr_cpus=1
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
_cmdline_append=$(grep '^\s*FADUMP_COMMANDLINE_APPEND\s*=' /etc/sysconfig/kdump | \
|
||||
sed 's/^\s*FADUMP_COMMANDLINE_APPEND\s*=\s*"\(.*\)".*$/\1/')
|
||||
|
||||
else
|
||||
_cmdline_append=$(grep '^\s*KDUMP_COMMANDLINE_APPEND\s*=' /etc/sysconfig/kdump | \
|
||||
sed 's/^\s*KDUMP_COMMANDLINE_APPEND\s*=\s*"\(.*\)".*$/\1/')
|
||||
fi
|
||||
|
||||
for arg in $_cmdline_append; do
|
||||
case $arg in
|
||||
nr_cpus=[0-9]*)
|
||||
# Only accept if it's strictly digits after '='
|
||||
value=${arg#nr_cpus=}
|
||||
if [[ $value =~ ^[1-9][0-9]*$ ]]; then
|
||||
_nr_cpus=$value
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
ddebug "Configured nr_cpus=$_nr_cpus"
|
||||
echo "$_nr_cpus"
|
||||
}
|
||||
|
||||
# get default crashkernel
|
||||
# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable
|
||||
# $2 kernel-release, if not specified, got by _get_kdump_kernel_version
|
||||
@ -1184,6 +1217,14 @@ kdump_get_arch_recommend_crashkernel()
|
||||
has_mlx5 && ((_delta += 150))
|
||||
fi
|
||||
elif [[ $_arch == "ppc64le" ]]; then
|
||||
local _per_cpu_area
|
||||
local _nr_cpus
|
||||
|
||||
# 1MB per CPU
|
||||
_per_cpu_area=1
|
||||
_nr_cpus=$(find_nr_cpus)
|
||||
|
||||
_delta=$((_delta + _per_cpu_area * _nr_cpus))
|
||||
if [[ $_dump_mode == "fadump" ]]; then
|
||||
_ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user