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

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: None

commit 7a2c4cbc3b10971c2a465ba2e465761e73390b74
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jun 13 17:43:23 2023 +0800

    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>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2023-06-13 17:43:23 +08:00
parent cde55285bd
commit df074ee3de
1 changed files with 17 additions and 1 deletions

View File

@ -947,6 +947,16 @@ get_recommend_size()
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=""
# $2 delta in unit of MB
_crashkernel_add()
@ -1043,8 +1053,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.
# Picking up 100M to cover this diff. And finally, we have "1G-4G:356M;4G-64G:420M;64G-:676M"
((_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
((_delta += 0))
#4k kernel, mlx5 consumes extra 124M memory, and choose 150M
has_mlx5 && ((_delta += 150))
fi
_ck_cmdline=$(_crashkernel_add "$_ck_cmdline" "$_delta")
elif [[ $_arch == "ppc64le" ]]; then