kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately

On 4k and 64k kernels, the typical consumption values for SMMU are 36MB
and 384MB, respectively. Hence for 64k kernel, the consumption by smmu
should be taken into account carefully.

To do it by adding the extra 384MB value if installing a 64k kernel.
The upper limit value 384MB is calculated according to the formula in
the kernel smmu driver.

As for mlx5 network cards, it is measured by a pratical test, 200M for
64k variant, 150M for 4k variant

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Reviewed-by: Coiby Xu <coxu@redhat.com>
Reviewed-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Pingfan Liu 2023-06-13 17:43:23 +08:00 committed by Coiby Xu
parent 05c4861443
commit 7a2c4cbc3b

View File

@ -829,6 +829,16 @@ get_recommend_size()
echo "0M" echo "0M"
} }
has_mlx5()
{
[[ -d /sys/bus/pci/drivers/mlx5_core ]]
}
has_aarch64_smmu()
{
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
}
# $1 crashkernel="" # $1 crashkernel=""
# $2 delta in unit of MB # $2 delta in unit of MB
_crashkernel_add() _crashkernel_add()
@ -925,8 +935,14 @@ kdump_get_arch_recommend_crashkernel()
# Without smmu, the diff of MemFree between 4K and 64K measured on a high end aarch64 machine is 82M. # Without smmu, the diff of MemFree between 4K and 64K measured on a high end aarch64 machine is 82M.
# Picking up 100M to cover this diff. And finally, we have "1G-4G:356M;4G-64G:420M;64G-:676M" # Picking up 100M to cover this diff. And finally, we have "1G-4G:356M;4G-64G:420M;64G-:676M"
((_delta += 100)) ((_delta += 100))
# On a 64K system, the extra 384MB is calculated by: cmdq_num * 16 bytes + evtq_num * 32B + priq_num * 16B
# While on a 4K system, it is negligible
has_aarch64_smmu && ((_delta += 384))
#64k kernel, mlx5 consumes extra 188M memory, and choose 200M
has_mlx5 && ((_delta += 200))
else else
((_delta += 0)) #4k kernel, mlx5 consumes extra 124M memory, and choose 150M
has_mlx5 && ((_delta += 150))
fi fi
_ck_cmdline=$(_crashkernel_add "$_ck_cmdline" "$_delta") _ck_cmdline=$(_crashkernel_add "$_ck_cmdline" "$_delta")
elif [[ $_arch == "ppc64le" ]]; then elif [[ $_arch == "ppc64le" ]]; then