On Tue, May 9, 2023 at 12:19 AM Philipp Rudo <prudo(a)redhat.com> wrote:
Hi Pingfan,
On Wed, 19 Apr 2023 20:13:57 +0800
Pingfan Liu <piliu(a)redhat.com> wrote:
> On aarch64, both the 4k and 64k kdump kernels suffer from significant
> memory consumption caused by the mlx5 driver. It is unlikely that a
> solution will be found in the near future. To address this problem, a
> potential approach is to allocate additional memory specifically for the
> mlx5 driver, regardless of whether the kdump target is accessed through
> a network card or not.
>
> Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
> ---
> To: kexec(a)lists.fedoraproject.org
> Cc: Coiby Xu <coxu(a)redhat.com>
> kdump-lib.sh | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index a665808..46ab49d 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -879,6 +879,22 @@ get_recommend_size()
> echo "0M"
> }
>
> +kdump_get_aarch64_mlx5_consumption()
> +{
> + local _delta=0
> + local _variant="$1"
> + #4k kernel, mlx5 consumes extra 124M memory
> + #64k kernel, mlx5 consumes extra 188M memory
> + if lsmod | grep "mlx5_core" 1> /dev/null 2>&1; then
is there a safer way to determine if a Mellanox card is used?
What if the driver is built-in?
Yes. The file under sys is more reliable: [ -d sys/bus/pci/drivers/mlx5_core ]
Thanks for your suggestion.
Pingfan
Thanks
Philipp
> + if [[ "$_variant" == "4k" ]]; then
> + _delta=150
> + elif [[ "$_variant" == "64k" ]]; then
> + _delta=200
> + fi
> + fi
> + echo $_delta
> +}
> +
> # On a 64K system, the value 384MB is calculated by: cmdq_num * 16 bytes + evtq_num
* 32B + priq_num * 16B
> kdump_get_aarch64_64k_smmu_consumption()
> {
> @@ -900,6 +916,7 @@ kdump_get_aarch64_64k_crashkernel()
> local _64k_delta="100"
>
> _64k_delta=$((_64k_delta + $(kdump_get_aarch64_64k_smmu_consumption)))
> + _64k_delta=$((_64k_delta + $(kdump_get_aarch64_mlx5_consumption
"64k")))
> IFS=',' read -ra ADDR <<< "$_ck_cmdline"
> for i in "${ADDR[@]}"; do
> key=$(echo "$i" | cut -d':' -f 1)
> @@ -916,8 +933,20 @@ kdump_get_aarch64_4k_crashkernel()
> {
> # For 4KB page size, the formula is based on x86 plus extra = 64M
> local _ck_cmdline="1G-4G:256M,4G-64G:320M,64G-:576M"
> + local _new_str=""
> + local _delta="0"
>
> - echo $"_ck_cmdline"
> + _delta=$((_delta + $(kdump_get_aarch64_mlx5_consumption)))
> + IFS=',' read -ra ADDR <<< "$_ck_cmdline"
> + for i in "${ADDR[@]}"; do
> + key=$(echo "$i" | cut -d':' -f 1)
> + value=$(echo "$i" | cut -d':' -f 2)
> + value=$(echo "$value" | tr -d 'M')
> + value=$((value + _64k_delta))
> + _new_str+="${key}:${value}M,"
> + done
> + _new_str=${_new_str::-1}
> + echo "$_new_str"
> }
>
> # get default crashkernel