On Fri, May 26, 2023 at 11:53 PM Philipp Rudo <prudo(a)redhat.com> wrote:
Hi Pingfan,
Only a small nit.
On Wed, 24 May 2023 23:40:42 +0800
Pingfan Liu <piliu(a)redhat.com> wrote:
> 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(a)redhat.com>
> ---
> kdump-lib.sh | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/kdump-lib.sh b/kdump-lib.sh
> index a496b75..82b392b 100755
> --- a/kdump-lib.sh
> +++ b/kdump-lib.sh
> @@ -786,6 +786,22 @@ get_recommend_size()
> echo "0M"
> }
>
> +has_mlx5()
> +{
> + if [ -d /sys/bus/pci/drivers/mlx5_core ]; then
We have gone to use the more powerful but bash-only [[...]] in
kdump-lib.sh. Please use it as well.
> + return 0
> + fi
> + return 1
> +}
> +
> +has_aarch64_smmu()
> +{
> + if ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1; then
> + return 0
> + fi
> + return 1
> +}
> +
Furthermore functions in bash automatically return with the return
value of the last command. Meaning that you don't need the 'if' and two
'returns' but can simply use
has_mlx5()
{
[[ -d /sys/bus/pci/drivers/mlx5_core ]]
}
has_aarch64_smmu()
{
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
}
All of these make code look neat and I like them.
Thanks,
Pingfan
Thanks
Philipp
> # $1 crashkernel=""
> # $2 delta in unit of MB
> _crashkernel_add()
> @@ -882,8 +898,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