On Wed, 24 May 2023 11:58:30 +0800
Pingfan Liu <piliu(a)redhat.com> wrote:
On Mon, May 22, 2023 at 10:59 PM Philipp Rudo
<prudo(a)redhat.com> wrote:
[[...]]
> Furthermore, I was sloppy when providing the example. While the line
> above is valid bash code it won't work as intended. In particular when
> you are using += in bash it evaluates both sides as strings, _not_ as
> mathematical expressions. For example
>
> $ a=1
> $ a+=1
> $ echo $a
>
> will give '11', _not_ '2'. The correct syntax for what you want is
>
Oops, the C grammar is so deeply rooted in my mind that I am not aware
of it either, although I read such a topic just a few days ago.
Don't worry. Bash is really weird when it comes to arithmetic
expressions...
> $ (( _delta += 100 ))
>
> (Note: the spaces after/before (( / )) are required. The other ones are
> optional.)
Sorry but I can not find any format restrictions around ((...)), and I
have done some test.
True, to be honest I cannot remember why I added this. My tests without
spaces work as well...
/me scratching my head
Sorry for the noise
Philipp
>
> > + else
> > + _delta+=0
> > + fi
> > + _ck_cmdline=$(_crashkernel_add "$_ck_cmdline"
"$_delta")
> > elif [[ $_arch == "ppc64le" ]]; then
> > 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"
> > diff --git a/kdumpctl b/kdumpctl
> > index 2bec428..cbdc45a 100755
> > --- a/kdumpctl
> > +++ b/kdumpctl
> > @@ -1623,6 +1623,7 @@ reset_crashkernel_for_installed_kernel()
> > {
> > local _installed_kernel _running_kernel _crashkernel
_crashkernel_running
> > local _dump_mode_running _fadump_val_running
> > + local _arch
> >
> > # During package install, only try to reset crashkernel for osbuild
> > # thus to avoid calling grubby when installing os via anaconda
> > @@ -1651,6 +1652,29 @@ reset_crashkernel_for_installed_kernel()
> > _dump_mode_running=$(get_dump_mode_by_kernel
"$_running_kernel")
> > _fadump_val_running=$(get_grub_kernel_boot_parameter "$_kernel"
fadump)
> >
> > + _arch=$(uname -m)
> > + # On aarch64, there are 4K and 64K kernel, which demands different
crashkernel value
> > + if [[ $_arch == "aarch64" ]]; then
> > + local _installed_64K _running_64K
> > +
> > + _installed_64K=0
> > + #echo "$_installed_kernel" | grep 64k
> > + if echo "$_installed_kernel" | grep 64k; then
> > + _installed_64K=1
> > + fi
> > + if echo "$_running_kernel" | grep 64k; then
> > + _running_64K=1
> > + fi
> > +
> > + # Otherwise, fall through to common case
> > + if [[ $_installed_64K != "$_running_64K" ]]; then
> > + # if the difference is 4K VS 64K
> > +
_crashkernel_running=$(kdump_get_arch_recommend_crashkernel "kdump"
"$_installed_kernel")
> > + _update_kernel_cmdline "$_installed_kernel"
"$_crashkernel_running" "$_dump_mode_running"
"$_fadump_val_running"
> > + return
> > + fi
> > + fi
> > +
> > if [[ $_crashkernel != "$_crashkernel_running" ]]; then
> > if _update_kernel_cmdline "$_installed_kernel"
"$_crashkernel_running" "$_dump_mode_running"
"$_fadump_val_running"; then
> > echo "kexec-tools has reset $_installed_kernel to
use the new default crashkernel value $_crashkernel_running"
>
> Coiby sent the patch "Simplify the management of the kernel parameter
> crashkernel" to the mailing list where he removes this part of
> reset_crashkernel_for_installed_kernel. I believe you can drop
> the changes to kdumpctl.
>
It is a great relief. I will rebase onto it.
Again, appreciate for your help.
Regards,
Pingfan