The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
It has been decided to increase default crashkernel value to reduce the possibility of OOM.
Fixes: commit 7b7ddaba88af9bcbbcc3d219e1c7f00b3a61152d ("kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default") Signed-off-by: Coiby Xu coxu@redhat.com --- kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 2e2775c..b8f6c96 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -841,7 +841,7 @@ kdump_get_arch_recommend_size() else arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]') if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then - ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M" + ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M" elif [[ $arch == "AARCH64" ]]; then ck_cmdline="2G-:448M" elif [[ $arch == "PPC64LE" ]]; then
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdump-lib.sh | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b8f6c96..94cc8ff 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,40 +822,52 @@ get_recommend_size() IFS="$OLDIFS" }
+# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{ + local _arch _ck_cmdline _dump_mode + + if [[ -z "$1" ]]; then + if is_fadump_capable; then + _dump_mode=fadump + else + _dump_mode=kdump + fi + else + _dump_mode=$1 + fi + + _arch=$(lscpu | sed -n "0,/Architecture:/s/Architecture:\s*(.*)/\U\1/p") + + if [[ $_arch == "X86_64" ]] || [[ $_arch == "S390X" ]]; then + _ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M" + elif [[ $_arch == "AARCH64" ]]; then + _ck_cmdline="2G-:448M" + 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" + else + _ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G" + fi + fi + + _ck_cmdline=${_ck_cmdline//-:/-102400T:} + echo -n "$_ck_cmdline" +} + # return recommended size based on current system RAM size # $1: kernel version, if not set, will defaults to $(uname -r) kdump_get_arch_recommend_size() { - local kernel=$1 arch + local _ck_cmdline
if ! [[ -r "/proc/iomem" ]]; then echo "Error, can not access /proc/iomem." return 1 fi - - [[ -z $kernel ]] && kernel=$(uname -r) - ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null) - - if [[ -n $ck_cmdline ]]; then - ck_cmdline=${ck_cmdline#crashkernel=} - else - arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]') - if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then - ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M" - elif [[ $arch == "AARCH64" ]]; then - ck_cmdline="2G-:448M" - elif [[ $arch == "PPC64LE" ]]; then - if is_fadump_capable; 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" - else - ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G" - fi - fi - fi - - ck_cmdline=${ck_cmdline//-:/-102400T:} sys_mem=$(get_system_size) - + _ck_cmdline=$(kdump_get_arch_recommend_crashkernel is_fadump_capable) get_recommend_size "$sys_mem" "$ck_cmdline" }
On Fri, Nov 19, 2021 at 11:22:59AM +0800, Coiby Xu wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
I am ignorant with the add-on process, and try to assure something. -1. Before the installation of kexec-tools.rpm, add-on allows users to pick kexec-tools and choose kdump/fadump -2. After the installation, there is post-script, which will call kdump_get_arch_recommend_crashkernel().
Right?
Thanks,
Pingfan
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b8f6c96..94cc8ff 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,40 +822,52 @@ get_recommend_size() IFS="$OLDIFS" }
+# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{
- local _arch _ck_cmdline _dump_mode
- if [[ -z "$1" ]]; then
if is_fadump_capable; then
_dump_mode=fadump
else
_dump_mode=kdump
fi
- else
_dump_mode=$1
- fi
- _arch=$(lscpu | sed -n "0,/Architecture:/s/Architecture:\s*(.*)/\U\1/p")
- if [[ $_arch == "X86_64" ]] || [[ $_arch == "S390X" ]]; then
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
- elif [[ $_arch == "AARCH64" ]]; then
_ck_cmdline="2G-:448M"
- 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"
else
_ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
- fi
- _ck_cmdline=${_ck_cmdline//-:/-102400T:}
- echo -n "$_ck_cmdline"
+}
# return recommended size based on current system RAM size # $1: kernel version, if not set, will defaults to $(uname -r) kdump_get_arch_recommend_size() {
- local kernel=$1 arch
local _ck_cmdline
if ! [[ -r "/proc/iomem" ]]; then echo "Error, can not access /proc/iomem." return 1 fi
- [[ -z $kernel ]] && kernel=$(uname -r)
- ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
- if [[ -n $ck_cmdline ]]; then
ck_cmdline=${ck_cmdline#crashkernel=}
- else
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]')
if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then
ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
elif [[ $arch == "AARCH64" ]]; then
ck_cmdline="2G-:448M"
elif [[ $arch == "PPC64LE" ]]; then
if is_fadump_capable; 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"
else
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
fi
- fi
- ck_cmdline=${ck_cmdline//-:/-102400T:} sys_mem=$(get_system_size)
- _ck_cmdline=$(kdump_get_arch_recommend_crashkernel is_fadump_capable) get_recommend_size "$sys_mem" "$ck_cmdline"
}
-- 2.31.1
On Fri, Nov 19, 2021 at 01:31:19PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:22:59AM +0800, Coiby Xu wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
I am ignorant with the add-on process, and try to assure something. -1. Before the installation of kexec-tools.rpm, add-on allows users to pick kexec-tools and choose kdump/fadump
kdumpctl exist in the running installing system. So we have kdumpctl even before installing kexec-tools to the target system. Btw, kdump-anaconda-addon marks kexec-tools as a requirement and don't provide a choice for user to choose kexec-tools.
-2. After the installation, there is post-script, which will call kdump_get_arch_recommend_crashkernel().
Currently, the value of crashkernel has already been saved in the kdump window before the installation. After the installing, kdump-anacond-addon would configure bootloader with the saved crashkernel.
Right?
Thanks for raising up these questions. I'll update the commit message to share how kdump-anaconda-addon would set crashkernel.
Thanks,
Pingfan
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b8f6c96..94cc8ff 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,40 +822,52 @@ get_recommend_size() IFS="$OLDIFS" }
+# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{
- local _arch _ck_cmdline _dump_mode
- if [[ -z "$1" ]]; then
if is_fadump_capable; then
_dump_mode=fadump
else
_dump_mode=kdump
fi
- else
_dump_mode=$1
- fi
- _arch=$(lscpu | sed -n "0,/Architecture:/s/Architecture:\s*(.*)/\U\1/p")
- if [[ $_arch == "X86_64" ]] || [[ $_arch == "S390X" ]]; then
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
- elif [[ $_arch == "AARCH64" ]]; then
_ck_cmdline="2G-:448M"
- 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"
else
_ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
- fi
- _ck_cmdline=${_ck_cmdline//-:/-102400T:}
- echo -n "$_ck_cmdline"
+}
# return recommended size based on current system RAM size # $1: kernel version, if not set, will defaults to $(uname -r) kdump_get_arch_recommend_size() {
- local kernel=$1 arch
local _ck_cmdline
if ! [[ -r "/proc/iomem" ]]; then echo "Error, can not access /proc/iomem." return 1 fi
- [[ -z $kernel ]] && kernel=$(uname -r)
- ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
- if [[ -n $ck_cmdline ]]; then
ck_cmdline=${ck_cmdline#crashkernel=}
- else
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]')
if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then
ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
elif [[ $arch == "AARCH64" ]]; then
ck_cmdline="2G-:448M"
elif [[ $arch == "PPC64LE" ]]; then
if is_fadump_capable; 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"
else
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
fi
- fi
- ck_cmdline=${ck_cmdline//-:/-102400T:} sys_mem=$(get_system_size)
- _ck_cmdline=$(kdump_get_arch_recommend_crashkernel is_fadump_capable) get_recommend_size "$sys_mem" "$ck_cmdline"
}
-- 2.31.1
On Fri, Nov 19, 2021 at 02:01:07PM +0800, Coiby Xu wrote:
On Fri, Nov 19, 2021 at 01:31:19PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:22:59AM +0800, Coiby Xu wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
I am ignorant with the add-on process, and try to assure something. -1. Before the installation of kexec-tools.rpm, add-on allows users to pick kexec-tools and choose kdump/fadump
kdumpctl exist in the running installing system. So we have kdumpctl even before installing kexec-tools to the target system. Btw, kdump-anaconda-addon marks kexec-tools as a requirement and don't provide a choice for user to choose kexec-tools.
-2. After the installation, there is post-script, which will call kdump_get_arch_recommend_crashkernel().
Currently, the value of crashkernel has already been saved in the kdump window before the installation. After the installing, kdump-anacond-addon would configure bootloader with the saved crashkernel.
Sorry I was wrong about the above statement. You are right that the default crashkernel is obtained after installation is finished.
On Fri, Nov 19, 2021 at 2:03 PM Coiby Xu coxu@redhat.com wrote:
On Fri, Nov 19, 2021 at 01:31:19PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:22:59AM +0800, Coiby Xu wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
I am ignorant with the add-on process, and try to assure something. -1. Before the installation of kexec-tools.rpm, add-on allows users to pick kexec-tools and choose kdump/fadump
kdumpctl exist in the running installing system. So we have kdumpctl even before installing kexec-tools to the target system. Btw, kdump-anaconda-addon marks kexec-tools as a requirement and don't provide a choice for user to choose kexec-tools.
Thanks, this resolves my concern.
Hi Coiby,
On Fri, 19 Nov 2021 11:22:59 +0800 Coiby Xu coxu@redhat.com wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b8f6c96..94cc8ff 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,40 +822,52 @@ get_recommend_size() IFS="$OLDIFS" }
+# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{
- local _arch _ck_cmdline _dump_mode
- if [[ -z "$1" ]]; then
if is_fadump_capable; then
_dump_mode=fadump
else
_dump_mode=kdump
fi
- else
_dump_mode=$1
- fi
- _arch=$(lscpu | sed -n "0,/Architecture:/s/Architecture:\s*(.*)/\U\1/p")
this looks much better than before, but using
uname -m | tr '[:lower:]' '[:upper:]'
would be even simpler. Especially it omits the need to parse the lscpu output.
- if [[ $_arch == "X86_64" ]] || [[ $_arch == "S390X" ]]; then
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
- elif [[ $_arch == "AARCH64" ]]; then
_ck_cmdline="2G-:448M"
- 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"
else
_ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
- fi
- _ck_cmdline=${_ck_cmdline//-:/-102400T:}
- echo -n "$_ck_cmdline"
+}
# return recommended size based on current system RAM size # $1: kernel version, if not set, will defaults to $(uname -r) kdump_get_arch_recommend_size() {
- local kernel=$1 arch
local _ck_cmdline
if ! [[ -r "/proc/iomem" ]]; then echo "Error, can not access /proc/iomem." return 1 fi
- [[ -z $kernel ]] && kernel=$(uname -r)
- ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
you are silently dropping the support of crashkenrel.default in this patch. I think it's ok to remove the support, as that's the overall goal of the series but it should be mentioned in the commit message.
Thanks Philipp
- if [[ -n $ck_cmdline ]]; then
ck_cmdline=${ck_cmdline#crashkernel=}
- else
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]')
if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then
ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
elif [[ $arch == "AARCH64" ]]; then
ck_cmdline="2G-:448M"
elif [[ $arch == "PPC64LE" ]]; then
if is_fadump_capable; 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"
else
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
fi
- fi
- ck_cmdline=${ck_cmdline//-:/-102400T:} sys_mem=$(get_system_size)
- _ck_cmdline=$(kdump_get_arch_recommend_crashkernel is_fadump_capable) get_recommend_size "$sys_mem" "$ck_cmdline"
}
Hi Philipp,
On Tue, Nov 30, 2021 at 06:37:41PM +0100, Philipp Rudo wrote:
Hi Coiby,
On Fri, 19 Nov 2021 11:22:59 +0800 Coiby Xu coxu@redhat.com wrote:
Factor out kdump_get_arch_recommend_crashkernel to prepare for kdump-anaonda-plugin to retrieve the default crashkernel value.
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index b8f6c96..94cc8ff 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,40 +822,52 @@ get_recommend_size() IFS="$OLDIFS" }
+# get default crashkernel +# $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable +kdump_get_arch_recommend_crashkernel() +{
- local _arch _ck_cmdline _dump_mode
- if [[ -z "$1" ]]; then
if is_fadump_capable; then
_dump_mode=fadump
else
_dump_mode=kdump
fi
- else
_dump_mode=$1
- fi
- _arch=$(lscpu | sed -n "0,/Architecture:/s/Architecture:\s*(.*)/\U\1/p")
this looks much better than before, but using
The credit should go to Kairui:)
uname -m | tr '[:lower:]' '[:upper:]'
would be even simpler. Especially it omits the need to parse the lscpu output.
Thanks for providing a simpler solution!
- if [[ $_arch == "X86_64" ]] || [[ $_arch == "S390X" ]]; then
_ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
- elif [[ $_arch == "AARCH64" ]]; then
_ck_cmdline="2G-:448M"
- 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"
else
_ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
- fi
- _ck_cmdline=${_ck_cmdline//-:/-102400T:}
- echo -n "$_ck_cmdline"
+}
# return recommended size based on current system RAM size # $1: kernel version, if not set, will defaults to $(uname -r) kdump_get_arch_recommend_size() {
- local kernel=$1 arch
local _ck_cmdline
if ! [[ -r "/proc/iomem" ]]; then echo "Error, can not access /proc/iomem." return 1 fi
- [[ -z $kernel ]] && kernel=$(uname -r)
- ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
you are silently dropping the support of crashkenrel.default in this patch. I think it's ok to remove the support, as that's the overall goal of the series but it should be mentioned in the commit message.
I'll add a note for this. Thanks!
Thanks Philipp
- if [[ -n $ck_cmdline ]]; then
ck_cmdline=${ck_cmdline#crashkernel=}
- else
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]')
if [[ $arch == "X86_64" ]] || [[ $arch == "S390X" ]]; then
ck_cmdline="1G-4G:192M,4G-64G:256M,64G-:512M"
elif [[ $arch == "AARCH64" ]]; then
ck_cmdline="2G-:448M"
elif [[ $arch == "PPC64LE" ]]; then
if is_fadump_capable; 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"
else
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
fi
fi
- fi
- ck_cmdline=${ck_cmdline//-:/-102400T:} sys_mem=$(get_system_size)
- _ck_cmdline=$(kdump_get_arch_recommend_crashkernel is_fadump_capable) get_recommend_size "$sys_mem" "$ck_cmdline"
}
Provide "kdumpctl get_default_crashkernel" for kdump_anaconda_addon so crashkernel.default isn't needed.
When fadump is on, kdump_anaconda_addon would need to specify the dump mode, i.e. "kdumpctl get_default_crashkernel fadump".
Signed-off-by: Coiby Xu coxu@redhat.com --- kdumpctl | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 59ec068..1938968 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1299,6 +1299,13 @@ do_estimate() fi }
+get_default_crashkernel() +{ + local _dump_mode=$1 + + echo -n "$(kdump_get_arch_recommend_crashkernel "$_dump_mode")" +} + reset_crashkernel() { local kernel=$1 entry crashkernel_default @@ -1392,6 +1399,9 @@ main() estimate) do_estimate ;; + get-default-crashkernel) + get_default_crashkernel "$2" + ;; reset-crashkernel) reset_crashkernel "$2" ;;
Currently, kexec-tools compares the value of kernel cmdline parameter crashkernel with default value string "1G-4G:192M,4G-64G:256M,64G-:512M" to tell if the user wants kexec-tools to automatically manage the value of crashkernel. Since extra memory needs to be allocated for cases like swiotlb memory requirement, this comparison would become invalid. kexec-tools needs the user to explicitly tell kexec-tools if crashkernel should be managed automatically. Thus introduce crashkernel in kdump.conf.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdump.conf | 6 ++++++ kdump.conf.5 | 7 +++++++ 2 files changed, 13 insertions(+)
diff --git a/kdump.conf b/kdump.conf index dea2e94..139ed81 100644 --- a/kdump.conf +++ b/kdump.conf @@ -11,6 +11,11 @@ # # Supported options: # +# crashkernel <auto|ANY_FORMAT_SUPPORTED_BY_KERNEL_CRASHKERNEL_CMDLINE> +# - when crashkernel=auto, kexec-tools will set up the kernel +# crashkernel cmdline automatically. Note this is a best-effort +# etimation. +# # raw <partition> # - Will dd /proc/vmcore into <partition>. # Use persistent device names for partition devices, @@ -170,6 +175,7 @@ #ssh user@my.server.com #ssh user@2001:db8::1:2:3:4 #sshkey /root/.ssh/kdump_id_rsa +crashkernel auto path /var/crash core_collector makedumpfile -l --message-level 7 -d 31 #core_collector scp diff --git a/kdump.conf.5 b/kdump.conf.5 index 6e6cafa..98c16f8 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -26,6 +26,13 @@ understand how this configuration file affects the behavior of kdump.
.SH OPTIONS
+.B crashkernel <auto|ANY_FORMAT_SUPPORTED_BY_KERNEL_CRASHKERNEL_CMDLINE> +.RS +when crashkernel=auto, kexec-tools will set up the kernel crashkernel cmdline +automatically when installing a kernel. Note the value is based on prior +experence and doesn't gurantee the resered memory is sufficient for kdump. +If OOM occurs, please set it to a different value. + .B raw <partition> .RS Will dd /proc/vmcore into <partition>. Use persistent device names for
Hi Coiby,
depending on the discussion to keep the option at all there are some typos.
On Fri, 19 Nov 2021 11:23:01 +0800 Coiby Xu coxu@redhat.com wrote:
Currently, kexec-tools compares the value of kernel cmdline parameter crashkernel with default value string "1G-4G:192M,4G-64G:256M,64G-:512M" to tell if the user wants kexec-tools to automatically manage the value of crashkernel. Since extra memory needs to be allocated for cases like swiotlb memory requirement, this comparison would become invalid. kexec-tools needs the user to explicitly tell kexec-tools if crashkernel should be managed automatically. Thus introduce crashkernel in kdump.conf.
Signed-off-by: Coiby Xu coxu@redhat.com
kdump.conf | 6 ++++++ kdump.conf.5 | 7 +++++++ 2 files changed, 13 insertions(+)
diff --git a/kdump.conf b/kdump.conf index dea2e94..139ed81 100644 --- a/kdump.conf +++ b/kdump.conf @@ -11,6 +11,11 @@ # # Supported options: # +# crashkernel <auto|ANY_FORMAT_SUPPORTED_BY_KERNEL_CRASHKERNEL_CMDLINE> +# - when crashkernel=auto, kexec-tools will set up the kernel +# crashkernel cmdline automatically. Note this is a best-effort
s/cmdline/command line/
for explanations I would use the written out name not the abbreviation.
+# etimation. +# # raw <partition> # - Will dd /proc/vmcore into <partition>. # Use persistent device names for partition devices, @@ -170,6 +175,7 @@ #ssh user@my.server.com #ssh user@2001:db8::1:2:3:4 #sshkey /root/.ssh/kdump_id_rsa +crashkernel auto path /var/crash core_collector makedumpfile -l --message-level 7 -d 31 #core_collector scp diff --git a/kdump.conf.5 b/kdump.conf.5 index 6e6cafa..98c16f8 100644 --- a/kdump.conf.5 +++ b/kdump.conf.5 @@ -26,6 +26,13 @@ understand how this configuration file affects the behavior of kdump.
.SH OPTIONS
+.B crashkernel <auto|ANY_FORMAT_SUPPORTED_BY_KERNEL_CRASHKERNEL_CMDLINE> +.RS +when crashkernel=auto, kexec-tools will set up the kernel crashkernel cmdline
s/cmdline/command line/
+automatically when installing a kernel. Note the value is based on prior +experence and doesn't gurantee the resered memory is sufficient for kdump.
s/experence/experience/ s/gurantee/guarantee/ s/resered/reserved/
s/for kdump/for your setup/ ? to highlight that it depends on the individual setups.
+If OOM occurs, please set it to a different value.
I find that sentence a little bit confusing. But don't have a better suggestion at the moment. Let's wait what the discussion about the option brings and come back in case we keep it.
Thanks Philipp
.B raw <partition> .RS Will dd /proc/vmcore into <partition>. Use persistent device names for
When the user runs "kdumpctl reset-crashkernel CRASHKERNEL", CRASHKERNEL will be written to /etc/kdump.conf.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdump-lib-initramfs.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index c1fd75f..cfef3ce 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -24,6 +24,15 @@ kdump_get_conf_val() sed -n -e "/^\s*($1)\s+/{s/^\s*($1)\s+//;s/#.*//;s/\s*$//;h};${x;p}" $KDUMP_CONFIG_FILE }
+# write config value to kdump.conf +# $1: config name, sed regexp compatible +# $2: config value +kdump_write_conf_val() +{ + [ -f "$KDUMP_CONFIG_FILE" ] && + sed -i -e "s/(^\s*$1)(\s+).*/\1\2$2/g" $KDUMP_CONFIG_FILE +} + is_mounted() { findmnt -k -n "$1" > /dev/null 2>&1
Hi Coiby,
besides the discussion about keeping the crashkernel option.
In my opinion a .conf should be read-only for the tool it is configuring unless there is a dedicated mechanism to manage the config (like 'git config'). But the way I understand you are planning to update silently kdump.conf every time a user runs kdumpctl reset-crashkernel. That's not the behavior I would expect of the script. Ultimately I think I would drop this patch.
Thanks Philipp
On Fri, 19 Nov 2021 11:23:02 +0800 Coiby Xu coxu@redhat.com wrote:
When the user runs "kdumpctl reset-crashkernel CRASHKERNEL", CRASHKERNEL will be written to /etc/kdump.conf.
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib-initramfs.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index c1fd75f..cfef3ce 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -24,6 +24,15 @@ kdump_get_conf_val() sed -n -e "/^\s*($1)\s+/{s/^\s*($1)\s+//;s/#.*//;s/\s*$//;h};${x;p}" $KDUMP_CONFIG_FILE }
+# write config value to kdump.conf +# $1: config name, sed regexp compatible +# $2: config value +kdump_write_conf_val() +{
- [ -f "$KDUMP_CONFIG_FILE" ] &&
sed -i -e "s/\(^\s*$1\)\(\s\+\).*/\1\2$2/g" $KDUMP_CONFIG_FILE
+}
is_mounted() { findmnt -k -n "$1" > /dev/null 2>&1
This helper function will be used to retrieve the value of kernel cmdline parameters including crashkernel, fadump, swiotlb and etc.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdumpctl | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1938968..6f1afad 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1304,6 +1304,15 @@ get_default_crashkernel() local _dump_mode=$1
echo -n "$(kdump_get_arch_recommend_crashkernel "$_dump_mode")" + } + +# Read kernel cmdline parameter for a specific kernel +# $1: kernel path, DEFAULT or kernel path +# $2: kernel cmldine parameter +get_grub_kernel_boot_parameter() { + local _kernel_path=$1 _para=$2 + + grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p" }
reset_crashkernel()
Hi Coiby,
On Fri, 19 Nov 2021 11:23:03 +0800 Coiby Xu coxu@redhat.com wrote:
This helper function will be used to retrieve the value of kernel cmdline parameters including crashkernel, fadump, swiotlb and etc.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1938968..6f1afad 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1304,6 +1304,15 @@ get_default_crashkernel() local _dump_mode=$1
echo -n "$(kdump_get_arch_recommend_crashkernel "$_dump_mode")"
- }
wrong indentation
+# Read kernel cmdline parameter for a specific kernel +# $1: kernel path, DEFAULT or kernel path +# $2: kernel cmldine parameter +get_grub_kernel_boot_parameter() {
- local _kernel_path=$1 _para=$2
- grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p"
1. what happens with $_kernel_path=ALL ? in that case this function will return multiple lines. 2. you can merge the two calls to sed and drop the second pipe 3. the second regex is frail to partial matches, e.g. crashkernel=256M and foo-crashkernel=256M will return the same value which might not be what you want.
The way I see it the sed call should look like this
sed -En -e "/^args=.*$/{s/^.*(\s|")${_para}=(\S*).*"$/\2/p;q}"
this will give you the first appearance of of $_para from the grubby output, which AFAIK is from the last kernel installed.
Thanks Philipp
}
reset_crashkernel()
On Wed, Dec 01, 2021 at 02:15:26PM +0100, Philipp Rudo wrote:
Hi Coiby,
On Fri, 19 Nov 2021 11:23:03 +0800 Coiby Xu coxu@redhat.com wrote:
This helper function will be used to retrieve the value of kernel cmdline parameters including crashkernel, fadump, swiotlb and etc.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 1938968..6f1afad 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1304,6 +1304,15 @@ get_default_crashkernel() local _dump_mode=$1
echo -n "$(kdump_get_arch_recommend_crashkernel "$_dump_mode")"
- }
wrong indentation
Corrected in v2, thanks!
+# Read kernel cmdline parameter for a specific kernel +# $1: kernel path, DEFAULT or kernel path +# $2: kernel cmldine parameter +get_grub_kernel_boot_parameter() {
- local _kernel_path=$1 _para=$2
- grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p"
- what happens with $_kernel_path=ALL ? in that case this function
will return multiple lines. 2. you can merge the two calls to sed and drop the second pipe 3. the second regex is frail to partial matches, e.g. crashkernel=256M and foo-crashkernel=256M will return the same value which might not be what you want.
The way I see it the sed call should look like this
sed -En -e "/^args=.*$/{s/^.*(\s|")${_para}=(\S*).*"$/\2/p;q}"
this will give you the first appearance of of $_para from the grubby output, which AFAIK is from the last kernel installed.
Applied to v2, thanks!
Thanks Philipp
}
reset_crashkernel()
kumpctl reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]]
With no CRASHKERNEL specified, kexec-tools would use the value from kdump.conf. With valid CRASHKERNEL specified, kexec-tools would also write the value to kdump.conf.
With no KERNELPATH specified, crashkernel would be set for current running kernel, i.e. `uname -r`. If KERNELRELEASE=ALL, the same crashkernel values would be set for all kernels.
This interface will also be called by kernel installation hook 92-crashkernel.install to set crashkernel for a newly installed kernel.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdumpctl | 122 ++++++++++++++++++++++++++++++++++++++++++++--------- kdumpctl.8 | 12 +++--- 2 files changed, 107 insertions(+), 27 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 6f1afad..345e112 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1315,41 +1315,123 @@ get_grub_kernel_boot_parameter() { grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p" }
-reset_crashkernel() +_update_crashkernel() { - local kernel=$1 entry crashkernel_default + local _entry="$1" _crashkernel="$2" local grub_etc_default="/etc/default/grub"
- [[ -z $kernel ]] && kernel=$(uname -r) - crashkernel_default=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null) - - if [[ -z $crashkernel_default ]]; then - derror "$kernel doesn't have a crashkernel.default" - exit 1 - fi - if is_atomic; then if rpm-ostree kargs | grep -q "crashkernel="; then - rpm-ostree --replace="crashkernel=$crashkernel_default" + rpm-ostree --replace="crashkernel=$_crashkernel" else - rpm-ostree --append="crashkernel=$crashkernel_default" + rpm-ostree --append="crashkernel=$_crashkernel" fi else - entry=$(grubby --info ALL | grep "^kernel=.*$kernel") - entry=${entry#kernel=} - entry=${entry#"} - entry=${entry%"} - if [[ -f $grub_etc_default ]]; then - sed -i -e "s/^(GRUB_CMDLINE_LINUX=.*)crashkernel=[^\ "]*([\ "].*)$/\1$crashkernel_default\2/" "$grub_etc_default" + sed -i -e "s/^(GRUB_CMDLINE_LINUX=.*)crashkernel=[^\ "]*([\ "].*)$/\1$_crashkernel\2/" "$grub_etc_default" fi
[[ -f /etc/zipl.conf ]] && zipl_arg="--zipl" - grubby --args "$crashkernel_default" --update-kernel "$entry" $zipl_arg + grubby --args "crashkernel=$_crashkernel" --update-kernel "$_entry" $zipl_arg [[ $zipl_arg ]] && zipl > /dev/null fi }
+_find_grubby_kernel_path() +{ + local _kernel="$1" _kernel_path + if [[ $_kernel == ALL || $_kernel == DEFAULT ]]; then + _kernel_path=$_kernel + else + _kernel_path=$(grubby --info ALL | grep "^kernel=.*$_kernel") + _kernel_path=${_kernel_path#kernel=} + _kernel_path=${_kernel_path#"} + _kernel_path=${_kernel_path%"} + [[ -z "$_kernel_path" ]] && derror "kernel $_kernel doesn't eixt" && return 1 + fi + echo -n "$_kernel_path" +} + +# Besides valid kernel path, grubby also accept DEFAULT and ALL +_valid_grubby_kernel_path() +{ + [[ -e $1 ]] || [[ $1 == ALL ]] || [[ $1 == DEFAULT ]] +} + + +get_dump_mode_of_kernel() +{ + local _kernel_path=$1 _fadump_val + _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel_path" fadump) + if [[ -z $_fadump_val ]] || [[ $_fadump_val == off ]]; then + echo -n fadump + elif [[ $_fadump_val == on ]] || [[ $_fadump_val == nocma ]]; then + echo -n kdump + else + derror "invalid fadump=$_fadump_val" + exit + fi +} + +# determine which parameter is kernel_path and crashkernel +# return kernel_path;crashkernel +_determine_kernel_path_and_crashkernel() +{ + local _grub_kernel_path _crashkernel + if [[ -n "$1" ]] && [[ -n "$2" ]]; then + _grub_kernel_path=$(_find_grubby_kernel_path "$1") || return 1 + if _valid_grubby_kernel_path "$1"; then + _grub_kernel_path=$1 + else + derror "kernel $1 doesn't exist" + exit 1 + fi + _crashkernel="$2" + elif [[ -n "$1" ]]; then + if _valid_grubby_kernel_path "$1"; then + _grub_kernel_path=$1 + else + _crashkernel="$1" + fi + fi + + [[ -z "$_grub_kernel_path" ]] && _grub_kernel_path=$(_find_grubby_kernel_path "$(uname -r)") + + echo -n "${_grub_kernel_path};${_crashkernel}" +} + +reset_crashkernel() +{ + local _crashkernel _kernel_crashkernel _grub_kernel_path _tmp_str _dump_mode + + if _tmp_str=$(_determine_kernel_path_and_crashkernel "$1" "$2"); then + _grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str") + _crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str") + else + exit 1 + fi + + if [[ -z "$_crashkernel" ]]; then + _crashkernel=$(kdump_get_conf_val crashkernel) + else + kdump_write_conf_val crashkernel "$_crashkernel" + fi + + if [[ $_grub_kernel_path == ALL ]]; then + _dump_mode="$DEFAULT_DUMP_MODE" + else + _dump_mode=$(get_dump_mode_of_kernel "$_grub_kernel_path") + fi + + if [[ $_crashkernel == "auto" ]] ; then + _kernel_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode") + else + _kernel_crashkernel="$_crashkernel" + fi + + _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" +} + if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1412,7 +1494,7 @@ main() get_default_crashkernel "$2" ;; reset-crashkernel) - reset_crashkernel "$2" + reset_crashkernel "$2" "$3" ;; *) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" diff --git a/kdumpctl.8 b/kdumpctl.8 index 74be062..19734aa 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -50,13 +50,11 @@ Estimate a suitable crashkernel value for current machine. This is a best-effort estimate. It will print a recommanded crashkernel value based on current kdump setup, and list some details of memory usage. .TP -.I reset-crashkernel [KERNEL] -Reset crashkernel value to default value. kdumpctl will try to read -from /usr/lib/modules/<KERNEL>/crashkernel.default and reset specified -kernel's crashkernel cmdline value. If no kernel is -specified, will reset current running kernel's crashkernel value. -If /usr/lib/modules/<KERNEL>/crashkernel.default doesn't exist, will -simply exit return 1. +.I reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]] +Reset crashkernel value to CRASHKERNEL or the value specified in +/etc/kdump.conf. If no kernel is specified, will reset current running +kernel's crashkernel value. If CRASHKERNEL is given, the value would be also +writeen to /etc/kdump.conf.
.SH "SEE ALSO"
Hi Coiby,
On Fri, 19 Nov 2021 11:23:04 +0800 Coiby Xu coxu@redhat.com wrote:
kumpctl reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]]
With no CRASHKERNEL specified, kexec-tools would use the value from kdump.conf. With valid CRASHKERNEL specified, kexec-tools would also write the value to kdump.conf.
With no KERNELPATH specified, crashkernel would be set for current running kernel, i.e. `uname -r`. If KERNELRELEASE=ALL, the same
s/KERNELRELEASE/KERNELPATH/ ?
crashkernel values would be set for all kernels.
This interface will also be called by kernel installation hook 92-crashkernel.install to set crashkernel for a newly installed kernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 122 ++++++++++++++++++++++++++++++++++++++++++++--------- kdumpctl.8 | 12 +++--- 2 files changed, 107 insertions(+), 27 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 6f1afad..345e112 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1315,41 +1315,123 @@ get_grub_kernel_boot_parameter() { grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p" }
-reset_crashkernel() +_update_crashkernel() {
- local kernel=$1 entry crashkernel_default
- local _entry="$1" _crashkernel="$2" local grub_etc_default="/etc/default/grub"
- [[ -z $kernel ]] && kernel=$(uname -r)
- crashkernel_default=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
This silently removes the support for crashkernel.default again. Please mention it in the commit message.
- if [[ -z $crashkernel_default ]]; then
derror "$kernel doesn't have a crashkernel.default"
exit 1
- fi
- if is_atomic; then if rpm-ostree kargs | grep -q "crashkernel="; then
rpm-ostree --replace="crashkernel=$crashkernel_default"
elserpm-ostree --replace="crashkernel=$_crashkernel"
rpm-ostree --append="crashkernel=$crashkernel_default"
fi elserpm-ostree --append="crashkernel=$_crashkernel"
entry=$(grubby --info ALL | grep "^kernel=.*$kernel")
entry=${entry#kernel=}
entry=${entry#\"}
entry=${entry%\"}
- if [[ -f $grub_etc_default ]]; then
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$crashkernel_default\2/" "$grub_etc_default"
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$_crashkernel\2/" "$grub_etc_default"
Like in patch 5 this regex is frail to partial matches, i.e. it also matches foo-crashkernel=.
fi [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl"
grubby --args "$crashkernel_default" --update-kernel "$entry" $zipl_arg
[[ $zipl_arg ]] && zipl > /dev/null figrubby --args "crashkernel=$_crashkernel" --update-kernel "$_entry" $zipl_arg
}
+_find_grubby_kernel_path() +{
- local _kernel="$1" _kernel_path
- if [[ $_kernel == ALL || $_kernel == DEFAULT ]]; then
_kernel_path=$_kernel
- else
_kernel_path=$(grubby --info ALL | grep "^kernel=.*$_kernel")
_kernel_path=${_kernel_path#kernel=}
_kernel_path=${_kernel_path#\"}
_kernel_path=${_kernel_path%\"}
[[ -z "$_kernel_path" ]] && derror "kernel $_kernel doesn't eixt" && return 1
typo s/eixt/exist/
in general can you explain, which values $_kernel (which IIUC is identical to the CRASHKERNEL parameter passed by the user) can have? The way I understand grubby allows either ALL, DEFAULT, vmlinuz-<version> or the path to the vmlinuz file. The last case (path to vmlinuz file) isn't handled correctly here. In particular the path could also be relative, e.g. ../../boot/vmlinuz-<version>, which would break the grep. I guess the easiest solution is to add
[[ -e $_kernel ]] && _kernel=$(realpath $_kernel)
at the beginning of the else block. This would also allow symbolic links to the vmlinuz file, something grubby doesn't support. But I don't think that is a problem.
- fi
- echo -n "$_kernel_path"
+}
+# Besides valid kernel path, grubby also accept DEFAULT and ALL +_valid_grubby_kernel_path() +{
- [[ -e $1 ]] || [[ $1 == ALL ]] || [[ $1 == DEFAULT ]]
-e only checks if the file exists but not if it is a valid kernel grubby can work with. Why not just call grubby and see if it can work with the provided kernel, i.e.
grubby --info="$1" > /dev/null 2>&1
+}
+get_dump_mode_of_kernel() +{
- local _kernel_path=$1 _fadump_val
- _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel_path" fadump)
- if [[ -z $_fadump_val ]] || [[ $_fadump_val == off ]]; then
echo -n fadump
- elif [[ $_fadump_val == on ]] || [[ $_fadump_val == nocma ]]; then
echo -n kdump
When $_fadump_val is "on" the dump mode is kdump and when it's "off" it's "fadump"? Is that correct? From the naming I would expect the opposite. If it is correct could you please add a comment with an explanation. I find that very confusing.
- else
derror "invalid fadump=$_fadump_val"
exit
- fi
+}
+# determine which parameter is kernel_path and crashkernel +# return kernel_path;crashkernel +_determine_kernel_path_and_crashkernel() +{
- local _grub_kernel_path _crashkernel
- if [[ -n "$1" ]] && [[ -n "$2" ]]; then
_grub_kernel_path=$(_find_grubby_kernel_path "$1") || return 1
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
derror "kernel $1 doesn't exist"
exit 1
fi
_crashkernel="$2"
- elif [[ -n "$1" ]]; then
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
_crashkernel="$1"
fi
- fi
- [[ -z "$_grub_kernel_path" ]] && _grub_kernel_path=$(_find_grubby_kernel_path "$(uname -r)")
- echo -n "${_grub_kernel_path};${_crashkernel}"
Introducing this special notation isn't really nice. You could simplify it by simply
echo $_grub_kernel_path $_crashkernel
and then ...
+}
+reset_crashkernel() +{
- local _crashkernel _kernel_crashkernel _grub_kernel_path _tmp_str _dump_mode
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$1" "$2"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
... change this to
read _grub_kernel_path _crashkernel < <(_determine_kernel_path_and_crashkernel "$1" "$2")
This also removes the superfluous error check above. The way I see it _determine_kernel_path_and_crashkernel will either exit directly or at least return ";". So $tmp_str will always evaluate as true and the the else block will never be reached.
- if [[ -z "$_crashkernel" ]]; then
_crashkernel=$(kdump_get_conf_val crashkernel)
The -z _grub_kernel_path is handled in _determine_kernel_path_and_crashkernel. Wouldn't it make sense to handle both -z cases in the same function?
- else
kdump_write_conf_val crashkernel "$_crashkernel"
- fi
As said in an earlier mail I wouldn't silently update kdump.conf with the new value. Imagine the case
1) a user runs the standard kernel, has kdump setup and everything works fine 2) the user installs kernel-debug and wants to increase the crashkernel memory for this kernel 3) with this kdumpctl updates kdump.conf so that every other standard kernel will use the larger crashkernel memory for the debug kernel unless the user manually resets the value back to the original value.
That's not the behavior I would expect.
Thanks Philipp
- if [[ $_grub_kernel_path == ALL ]]; then
_dump_mode="$DEFAULT_DUMP_MODE"
- else
_dump_mode=$(get_dump_mode_of_kernel "$_grub_kernel_path")
- fi
- if [[ $_crashkernel == "auto" ]] ; then
_kernel_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
- else
_kernel_crashkernel="$_crashkernel"
- fi
- _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel"
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1412,7 +1494,7 @@ main() get_default_crashkernel "$2" ;; reset-crashkernel)
reset_crashkernel "$2"
;; *) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}"reset_crashkernel "$2" "$3"
diff --git a/kdumpctl.8 b/kdumpctl.8 index 74be062..19734aa 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -50,13 +50,11 @@ Estimate a suitable crashkernel value for current machine. This is a best-effort estimate. It will print a recommanded crashkernel value based on current kdump setup, and list some details of memory usage. .TP -.I reset-crashkernel [KERNEL] -Reset crashkernel value to default value. kdumpctl will try to read -from /usr/lib/modules/<KERNEL>/crashkernel.default and reset specified -kernel's crashkernel cmdline value. If no kernel is -specified, will reset current running kernel's crashkernel value. -If /usr/lib/modules/<KERNEL>/crashkernel.default doesn't exist, will -simply exit return 1. +.I reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]] +Reset crashkernel value to CRASHKERNEL or the value specified in +/etc/kdump.conf. If no kernel is specified, will reset current running +kernel's crashkernel value. If CRASHKERNEL is given, the value would be also +writeen to /etc/kdump.conf.
.SH "SEE ALSO"
Hi Philipp,
On Wed, Dec 01, 2021 at 04:04:11PM +0100, Philipp Rudo wrote:
Hi Coiby,
On Fri, 19 Nov 2021 11:23:04 +0800 Coiby Xu coxu@redhat.com wrote:
kumpctl reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]]
With no CRASHKERNEL specified, kexec-tools would use the value from kdump.conf. With valid CRASHKERNEL specified, kexec-tools would also write the value to kdump.conf.
With no KERNELPATH specified, crashkernel would be set for current running kernel, i.e. `uname -r`. If KERNELRELEASE=ALL, the same
s/KERNELRELEASE/KERNELPATH/ ?
Thanks for spotting the typo.
crashkernel values would be set for all kernels.
This interface will also be called by kernel installation hook 92-crashkernel.install to set crashkernel for a newly installed kernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 122 ++++++++++++++++++++++++++++++++++++++++++++--------- kdumpctl.8 | 12 +++--- 2 files changed, 107 insertions(+), 27 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 6f1afad..345e112 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1315,41 +1315,123 @@ get_grub_kernel_boot_parameter() { grubby --info="$_kernel_path" | sed -n 's/^args="(.*)"$/\1/p' | sed -n "s/^.*${_para}=(\S*).*/\1/p" }
-reset_crashkernel() +_update_crashkernel() {
- local kernel=$1 entry crashkernel_default
- local _entry="$1" _crashkernel="$2" local grub_etc_default="/etc/default/grub"
- [[ -z $kernel ]] && kernel=$(uname -r)
- crashkernel_default=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2> /dev/null)
This silently removes the support for crashkernel.default again. Please mention it in the commit message.
Sure, thanks for the reminder!
- if [[ -z $crashkernel_default ]]; then
derror "$kernel doesn't have a crashkernel.default"
exit 1
- fi
- if is_atomic; then if rpm-ostree kargs | grep -q "crashkernel="; then
rpm-ostree --replace="crashkernel=$crashkernel_default"
elserpm-ostree --replace="crashkernel=$_crashkernel"
rpm-ostree --append="crashkernel=$crashkernel_default"
fi elserpm-ostree --append="crashkernel=$_crashkernel"
entry=$(grubby --info ALL | grep "^kernel=.*$kernel")
entry=${entry#kernel=}
entry=${entry#\"}
entry=${entry%\"}
- if [[ -f $grub_etc_default ]]; then
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$crashkernel_default\2/" "$grub_etc_default"
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$_crashkernel\2/" "$grub_etc_default"
Like in patch 5 this regex is frail to partial matches, i.e. it also matches foo-crashkernel=.
Taking the case of setting debug kernel's crashkernel value into consideration, I think it's better to drop it. Another reason is grubby would "update the GRUB_CMDLINE_LINUX variable in /etc/default/grub when the --update-kernel option is used with the ALL argument". So there is no need to fix the regex issue in v2.
fi [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl"
grubby --args "$crashkernel_default" --update-kernel "$entry" $zipl_arg
[[ $zipl_arg ]] && zipl > /dev/null figrubby --args "crashkernel=$_crashkernel" --update-kernel "$_entry" $zipl_arg
}
+_find_grubby_kernel_path() +{
- local _kernel="$1" _kernel_path
- if [[ $_kernel == ALL || $_kernel == DEFAULT ]]; then
_kernel_path=$_kernel
- else
_kernel_path=$(grubby --info ALL | grep "^kernel=.*$_kernel")
_kernel_path=${_kernel_path#kernel=}
_kernel_path=${_kernel_path#\"}
_kernel_path=${_kernel_path%\"}
[[ -z "$_kernel_path" ]] && derror "kernel $_kernel doesn't eixt" && return 1
typo s/eixt/exist/
Thanks for pointing out the typo!
in general can you explain, which values $_kernel (which IIUC is identical to the CRASHKERNEL parameter passed by the user) can have?
Sure, I'll add this part in the commit msg next time.
The way I understand grubby allows either ALL, DEFAULT, vmlinuz-<version> or the path to the vmlinuz file. The last case (path to vmlinuz file) isn't handled correctly here. In particular the path could also be relative, e.g. ../../boot/vmlinuz-<version>, which would break the grep. I guess the easiest solution is to add
[[ -e $_kernel ]] && _kernel=$(realpath $_kernel)
at the beginning of the else block. This would also allow symbolic links to the vmlinuz file, something grubby doesn't support. But I don't think that is a problem.
It seems grubby don't accept vmlinuz-<version> or relative path ot the vmlinux file,
$ sudo grubby --info=vmlinuz-`uname -r` The param vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
$ sudo grubby --info=./vmlinuz-5.14.14-200.fc34.x86_64 The param ./vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
So we don't need to take care these two cases.
- fi
- echo -n "$_kernel_path"
+}
+# Besides valid kernel path, grubby also accept DEFAULT and ALL +_valid_grubby_kernel_path() +{
- [[ -e $1 ]] || [[ $1 == ALL ]] || [[ $1 == DEFAULT ]]
-e only checks if the file exists but not if it is a valid kernel grubby can work with. Why not just call grubby and see if it can work with the provided kernel, i.e.
grubby --info="$1" > /dev/null 2>&1
Thanks for a better solution!
+}
+get_dump_mode_of_kernel() +{
- local _kernel_path=$1 _fadump_val
- _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel_path" fadump)
- if [[ -z $_fadump_val ]] || [[ $_fadump_val == off ]]; then
echo -n fadump
- elif [[ $_fadump_val == on ]] || [[ $_fadump_val == nocma ]]; then
echo -n kdump
When $_fadump_val is "on" the dump mode is kdump and when it's "off" it's "fadump"? Is that correct? From the naming I would expect the opposite. If it is correct could you please add a comment with an explanation. I find that very confusing.
- else
derror "invalid fadump=$_fadump_val"
exit
- fi
+}
+# determine which parameter is kernel_path and crashkernel +# return kernel_path;crashkernel +_determine_kernel_path_and_crashkernel() +{
- local _grub_kernel_path _crashkernel
- if [[ -n "$1" ]] && [[ -n "$2" ]]; then
_grub_kernel_path=$(_find_grubby_kernel_path "$1") || return 1
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
derror "kernel $1 doesn't exist"
exit 1
fi
_crashkernel="$2"
- elif [[ -n "$1" ]]; then
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
_crashkernel="$1"
fi
- fi
- [[ -z "$_grub_kernel_path" ]] && _grub_kernel_path=$(_find_grubby_kernel_path "$(uname -r)")
- echo -n "${_grub_kernel_path};${_crashkernel}"
Introducing this special notation isn't really nice. You could simplify it by simply
echo $_grub_kernel_path $_crashkernel
and then ...
+}
+reset_crashkernel() +{
- local _crashkernel _kernel_crashkernel _grub_kernel_path _tmp_str _dump_mode
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$1" "$2"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
... change this to
read _grub_kernel_path _crashkernel < <(_determine_kernel_path_and_crashkernel "$1" "$2")
This also removes the superfluous error check above. The way I see it _determine_kernel_path_and_crashkernel will either exit directly or at least return ";". So $tmp_str will always evaluate as true and the the else block will never be reached.
I designed this by purpose since bash couldn't return two values (in retrospect, an array seems to be a better idea). Because both _grub_kernel_path and _crashkernel could be empty. So if _grub_kernel_path is empty and _crashkernel is not, the following way won't work,
read _grub_kernel_path _crashkernel < <(_determine_kernel_path_and_crashkernel "$1" "$2")
But in next version, the interface would be implemented as,
kdumpctl reset-crashkernel [--fadump=[on|off|nocma]] [--kernel=path_to_kernel] [--reboot]
and "kumpctl fadump" is not needed. So there is no need to abstract _determine_kernel_path_and_crashkernel.
- if [[ -z "$_crashkernel" ]]; then
_crashkernel=$(kdump_get_conf_val crashkernel)
The -z _grub_kernel_path is handled in _determine_kernel_path_and_crashkernel. Wouldn't it make sense to handle both -z cases in the same function?
Thanks for the suggestion. Unfortunately, this suggestion couldn't be applied to v2 since the implementation has changed as mentioned before.
- else
kdump_write_conf_val crashkernel "$_crashkernel"
- fi
As said in an earlier mail I wouldn't silently update kdump.conf with the new value. Imagine the case
- a user runs the standard kernel, has kdump setup and everything
works fine 2) the user installs kernel-debug and wants to increase the crashkernel memory for this kernel 3) with this kdumpctl updates kdump.conf so that every other standard kernel will use the larger crashkernel memory for the debug kernel unless the user manually resets the value back to the original value.
That's not the behavior I would expect.
Thanks for the suggestion! There is no updating kdump.conf in v2.
Thanks Philipp
- if [[ $_grub_kernel_path == ALL ]]; then
_dump_mode="$DEFAULT_DUMP_MODE"
- else
_dump_mode=$(get_dump_mode_of_kernel "$_grub_kernel_path")
- fi
- if [[ $_crashkernel == "auto" ]] ; then
_kernel_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
- else
_kernel_crashkernel="$_crashkernel"
- fi
- _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel"
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1412,7 +1494,7 @@ main() get_default_crashkernel "$2" ;; reset-crashkernel)
reset_crashkernel "$2"
;; *) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}"reset_crashkernel "$2" "$3"
diff --git a/kdumpctl.8 b/kdumpctl.8 index 74be062..19734aa 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -50,13 +50,11 @@ Estimate a suitable crashkernel value for current machine. This is a best-effort estimate. It will print a recommanded crashkernel value based on current kdump setup, and list some details of memory usage. .TP -.I reset-crashkernel [KERNEL] -Reset crashkernel value to default value. kdumpctl will try to read -from /usr/lib/modules/<KERNEL>/crashkernel.default and reset specified -kernel's crashkernel cmdline value. If no kernel is -specified, will reset current running kernel's crashkernel value. -If /usr/lib/modules/<KERNEL>/crashkernel.default doesn't exist, will -simply exit return 1. +.I reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]] +Reset crashkernel value to CRASHKERNEL or the value specified in +/etc/kdump.conf. If no kernel is specified, will reset current running +kernel's crashkernel value. If CRASHKERNEL is given, the value would be also +writeen to /etc/kdump.conf.
.SH "SEE ALSO"
Hi Coiby,
On Fri, 3 Dec 2021 18:18:55 +0800 Coiby Xu coxu@redhat.com wrote:
Hi Philipp,
On Wed, Dec 01, 2021 at 04:04:11PM +0100, Philipp Rudo wrote:
Hi Coiby,
On Fri, 19 Nov 2021 11:23:04 +0800 Coiby Xu coxu@redhat.com wrote:
[...]
- if [[ -z $crashkernel_default ]]; then
derror "$kernel doesn't have a crashkernel.default"
exit 1
- fi
- if is_atomic; then if rpm-ostree kargs | grep -q "crashkernel="; then
rpm-ostree --replace="crashkernel=$crashkernel_default"
elserpm-ostree --replace="crashkernel=$_crashkernel"
rpm-ostree --append="crashkernel=$crashkernel_default"
fi elserpm-ostree --append="crashkernel=$_crashkernel"
entry=$(grubby --info ALL | grep "^kernel=.*$kernel")
entry=${entry#kernel=}
entry=${entry#\"}
entry=${entry%\"}
- if [[ -f $grub_etc_default ]]; then
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$crashkernel_default\2/" "$grub_etc_default"
sed -i -e "s/^\(GRUB_CMDLINE_LINUX=.*\)crashkernel=[^\ \"]*\([\ \"].*\)$/\1$_crashkernel\2/" "$grub_etc_default"
Like in patch 5 this regex is frail to partial matches, i.e. it also matches foo-crashkernel=.
Taking the case of setting debug kernel's crashkernel value into consideration, I think it's better to drop it. Another reason is grubby would "update the GRUB_CMDLINE_LINUX variable in /etc/default/grub when the --update-kernel option is used with the ALL argument". So there is no need to fix the regex issue in v2.
That's even better :)
fi [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl"
grubby --args "$crashkernel_default" --update-kernel "$entry" $zipl_arg
[[ $zipl_arg ]] && zipl > /dev/null figrubby --args "crashkernel=$_crashkernel" --update-kernel "$_entry" $zipl_arg
}
+_find_grubby_kernel_path() +{
- local _kernel="$1" _kernel_path
- if [[ $_kernel == ALL || $_kernel == DEFAULT ]]; then
_kernel_path=$_kernel
- else
_kernel_path=$(grubby --info ALL | grep "^kernel=.*$_kernel")
_kernel_path=${_kernel_path#kernel=}
_kernel_path=${_kernel_path#\"}
_kernel_path=${_kernel_path%\"}
[[ -z "$_kernel_path" ]] && derror "kernel $_kernel doesn't eixt" && return 1
typo s/eixt/exist/
Thanks for pointing out the typo!
np, thanks for taking care of the problem!
in general can you explain, which values $_kernel (which IIUC is identical to the CRASHKERNEL parameter passed by the user) can have?
Sure, I'll add this part in the commit msg next time.
The way I understand grubby allows either ALL, DEFAULT, vmlinuz-<version> or the path to the vmlinuz file. The last case (path to vmlinuz file) isn't handled correctly here. In particular the path could also be relative, e.g. ../../boot/vmlinuz-<version>, which would break the grep. I guess the easiest solution is to add
[[ -e $_kernel ]] && _kernel=$(realpath $_kernel)
at the beginning of the else block. This would also allow symbolic links to the vmlinuz file, something grubby doesn't support. But I don't think that is a problem.
It seems grubby don't accept vmlinuz-<version> or relative path ot the vmlinux file,
$ sudo grubby --info=vmlinuz-`uname -r` The param vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
$ sudo grubby --info=./vmlinuz-5.14.14-200.fc34.x86_64 The param ./vmlinuz-5.14.14-200.fc34.x86_64 is incorrect
So we don't need to take care these two cases.
In my test on F35 it works...
# grubby --info=vmlinuz-$(uname -r) index=0 kernel="/boot/vmlinuz-5.15.5-200.fc35.x86_64" args="ro rd.lvm.lv=fedora_fedora/root console=ttyS0 crashkernel=256M" root="/dev/mapper/fedora_fedora-root" initrd="/boot/initramfs-5.15.5-200.fc35.x86_64.img" title="Fedora Linux (5.15.5-200.fc35.x86_64) 35 (Server Edition)" id="ed32f6182bc44595983ddbc6ed06bc92-5.15.5-200.fc35.x86_64"
# pwd && grubby --info=../boot/vmlinuz-$(uname -r) /root index=0 kernel="/boot/vmlinuz-5.15.5-200.fc35.x86_64" args="ro rd.lvm.lv=fedora_fedora/root console=ttyS0 crashkernel=256M" root="/dev/mapper/fedora_fedora-root" initrd="/boot/initramfs-5.15.5-200.fc35.x86_64.img" title="Fedora Linux (5.15.5-200.fc35.x86_64) 35 (Server Edition)" id="ed32f6182bc44595983ddbc6ed06bc92-5.15.5-200.fc35.x86_64"
# ls -l kernel && grubby --info=kernel lrwxrwxrwx. 1 root root 36 Dec 6 15:47 kernel -> /boot/vmlinuz-5.15.5-200.fc35.x86_64 The param kernel is incorrect
- fi
- echo -n "$_kernel_path"
+}
+# Besides valid kernel path, grubby also accept DEFAULT and ALL +_valid_grubby_kernel_path() +{
- [[ -e $1 ]] || [[ $1 == ALL ]] || [[ $1 == DEFAULT ]]
-e only checks if the file exists but not if it is a valid kernel grubby can work with. Why not just call grubby and see if it can work with the provided kernel, i.e.
grubby --info="$1" > /dev/null 2>&1
Thanks for a better solution!
+}
+get_dump_mode_of_kernel() +{
- local _kernel_path=$1 _fadump_val
- _fadump_val=$(get_grub_kernel_boot_parameter "$_kernel_path" fadump)
- if [[ -z $_fadump_val ]] || [[ $_fadump_val == off ]]; then
echo -n fadump
- elif [[ $_fadump_val == on ]] || [[ $_fadump_val == nocma ]]; then
echo -n kdump
When $_fadump_val is "on" the dump mode is kdump and when it's "off" it's "fadump"? Is that correct? From the naming I would expect the opposite. If it is correct could you please add a comment with an explanation. I find that very confusing.
- else
derror "invalid fadump=$_fadump_val"
exit
- fi
+}
+# determine which parameter is kernel_path and crashkernel +# return kernel_path;crashkernel +_determine_kernel_path_and_crashkernel() +{
- local _grub_kernel_path _crashkernel
- if [[ -n "$1" ]] && [[ -n "$2" ]]; then
_grub_kernel_path=$(_find_grubby_kernel_path "$1") || return 1
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
derror "kernel $1 doesn't exist"
exit 1
fi
_crashkernel="$2"
- elif [[ -n "$1" ]]; then
if _valid_grubby_kernel_path "$1"; then
_grub_kernel_path=$1
else
_crashkernel="$1"
fi
- fi
- [[ -z "$_grub_kernel_path" ]] && _grub_kernel_path=$(_find_grubby_kernel_path "$(uname -r)")
- echo -n "${_grub_kernel_path};${_crashkernel}"
Introducing this special notation isn't really nice. You could simplify it by simply
echo $_grub_kernel_path $_crashkernel
and then ...
+}
+reset_crashkernel() +{
- local _crashkernel _kernel_crashkernel _grub_kernel_path _tmp_str _dump_mode
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$1" "$2"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
... change this to
read _grub_kernel_path _crashkernel < <(_determine_kernel_path_and_crashkernel "$1" "$2")
This also removes the superfluous error check above. The way I see it _determine_kernel_path_and_crashkernel will either exit directly or at least return ";". So $tmp_str will always evaluate as true and the the else block will never be reached.
I designed this by purpose since bash couldn't return two values (in retrospect, an array seems to be a better idea). Because both _grub_kernel_path and _crashkernel could be empty. So if _grub_kernel_path is empty and _crashkernel is not, the following way won't work,
yes, not being able to return two values reliably is a real pain in bash. But you are right, my proposal wouldn't handle situations properly, when _grub_kernel_path and/or _crashkernel are empty.
read _grub_kernel_path _crashkernel < <(_determine_kernel_path_and_crashkernel "$1" "$2")
But in next version, the interface would be implemented as,
kdumpctl reset-crashkernel [--fadump=[on|off|nocma]] [--kernel=path_to_kernel] [--reboot]
and "kumpctl fadump" is not needed. So there is no need to abstract _determine_kernel_path_and_crashkernel.
I'm looking forward to see your v2.
- if [[ -z "$_crashkernel" ]]; then
_crashkernel=$(kdump_get_conf_val crashkernel)
The -z _grub_kernel_path is handled in _determine_kernel_path_and_crashkernel. Wouldn't it make sense to handle both -z cases in the same function?
Thanks for the suggestion. Unfortunately, this suggestion couldn't be applied to v2 since the implementation has changed as mentioned before.
np, it's just a minor nit anyway.
- else
kdump_write_conf_val crashkernel "$_crashkernel"
- fi
As said in an earlier mail I wouldn't silently update kdump.conf with the new value. Imagine the case
- a user runs the standard kernel, has kdump setup and everything
works fine 2) the user installs kernel-debug and wants to increase the crashkernel memory for this kernel 3) with this kdumpctl updates kdump.conf so that every other standard kernel will use the larger crashkernel memory for the debug kernel unless the user manually resets the value back to the original value.
That's not the behavior I would expect.
Thanks for the suggestion! There is no updating kdump.conf in v2.
Thanks!
Thanks Philipp
- if [[ $_grub_kernel_path == ALL ]]; then
_dump_mode="$DEFAULT_DUMP_MODE"
- else
_dump_mode=$(get_dump_mode_of_kernel "$_grub_kernel_path")
- fi
- if [[ $_crashkernel == "auto" ]] ; then
_kernel_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
- else
_kernel_crashkernel="$_crashkernel"
- fi
- _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel"
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1412,7 +1494,7 @@ main() get_default_crashkernel "$2" ;; reset-crashkernel)
reset_crashkernel "$2"
;; *) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}"reset_crashkernel "$2" "$3"
diff --git a/kdumpctl.8 b/kdumpctl.8 index 74be062..19734aa 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -50,13 +50,11 @@ Estimate a suitable crashkernel value for current machine. This is a best-effort estimate. It will print a recommanded crashkernel value based on current kdump setup, and list some details of memory usage. .TP -.I reset-crashkernel [KERNEL] -Reset crashkernel value to default value. kdumpctl will try to read -from /usr/lib/modules/<KERNEL>/crashkernel.default and reset specified -kernel's crashkernel cmdline value. If no kernel is -specified, will reset current running kernel's crashkernel value. -If /usr/lib/modules/<KERNEL>/crashkernel.default doesn't exist, will -simply exit return 1. +.I reset-crashkernel [[CRASHKERNEL], [KERNELPATH[, CRASHKERNEL]] +Reset crashkernel value to CRASHKERNEL or the value specified in +/etc/kdump.conf. If no kernel is specified, will reset current running +kernel's crashkernel value. If CRASHKERNEL is given, the value would be also +writeen to /etc/kdump.conf.
.SH "SEE ALSO"
Say let's add extra 20M to "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", add_extra_mem_to_crashkernel will cover the above string to "2G-4G:406M,4G-16G:534M,16G-64G:1046M,64G-128G:2070M,128G-:4118M"
Signed-off-by: Coiby Xu coxu@redhat.com --- kdump-lib.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 94cc8ff..5c79436 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,6 +822,41 @@ get_recommend_size() IFS="$OLDIFS" }
+# add memory to crashkernel string +# $1 extra memory size, unit:M +# return crashkernel string (unit=M) +add_extra_mem_to_crashkernel() +{ + local _extra_mem="$1" _ck_cmdline="$2" _new_ck_cmdline + local _range _mem _size _unit _ele _new_ele + local OLDIFS="$IFS" + + IFS=',' + for _ele in $_ck_cmdline; do + _range=$(awk -F ":" '{print $1}' <<< "$_ele") + _mem=$(awk -F ":" '{print $2}' <<< "$_ele") + _size=${_mem::-1} + _unit=${_mem: -1} + if [[ $_unit != "M" ]] && [[ $_unit != "G" ]]; then + perror_exit "can't process $_unit" + fi + + if [[ $_unit == 'G' ]]; then + _size=$((_size * 1024)) + fi + _size=$((_size + _extra_mem)) + + _new_ele="${_range}:${_size}M" + if [[ -z $_new_ck_cmdline ]]; then + _new_ck_cmdline=$_new_ele + else + _new_ck_cmdline="${_new_ck_cmdline},${_new_ele}" + fi + done + IFS="$OLDIFS" + echo -n "$_new_ck_cmdline" +} + # get default crashkernel # $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable kdump_get_arch_recommend_crashkernel()
On Fri, Nov 19, 2021 at 11:23:05AM +0800, Coiby Xu wrote:
Say let's add extra 20M to "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", add_extra_mem_to_crashkernel will cover the above string to "2G-4G:406M,4G-16G:534M,16G-64G:1046M,64G-128G:2070M,128G-:4118M"
The "crashkernel=" is a practice value. There is no connection between the scale of the different system memory size.
I do not strongly argue, but maybe let user explictly to set a value is a better choice.
Thanks,
Pingfan
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 94cc8ff..5c79436 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,6 +822,41 @@ get_recommend_size() IFS="$OLDIFS" }
+# add memory to crashkernel string +# $1 extra memory size, unit:M +# return crashkernel string (unit=M) +add_extra_mem_to_crashkernel() +{
- local _extra_mem="$1" _ck_cmdline="$2" _new_ck_cmdline
- local _range _mem _size _unit _ele _new_ele
- local OLDIFS="$IFS"
- IFS=','
- for _ele in $_ck_cmdline; do
_range=$(awk -F ":" '{print $1}' <<< "$_ele")
_mem=$(awk -F ":" '{print $2}' <<< "$_ele")
_size=${_mem::-1}
_unit=${_mem: -1}
if [[ $_unit != "M" ]] && [[ $_unit != "G" ]]; then
perror_exit "can't process $_unit"
fi
if [[ $_unit == 'G' ]]; then
_size=$((_size * 1024))
fi
_size=$((_size + _extra_mem))
_new_ele="${_range}:${_size}M"
if [[ -z $_new_ck_cmdline ]]; then
_new_ck_cmdline=$_new_ele
else
_new_ck_cmdline="${_new_ck_cmdline},${_new_ele}"
fi
- done
- IFS="$OLDIFS"
- echo -n "$_new_ck_cmdline"
+}
# get default crashkernel # $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable kdump_get_arch_recommend_crashkernel() -- 2.31.1
On Fri, Nov 19, 2021 at 01:10:37PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:05AM +0800, Coiby Xu wrote:
Say let's add extra 20M to "2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", add_extra_mem_to_crashkernel will cover the above string to "2G-4G:406M,4G-16G:534M,16G-64G:1046M,64G-128G:2070M,128G-:4118M"
The "crashkernel=" is a practice value. There is no connection between the scale of the different system memory size.
I do not strongly argue, but maybe let user explictly to set a value is a better choice.
Thanks for the suggestion! But according to CEE, a significant number of users want kdump to work out of box i.e. not bothering to set a value by him/herself. This patch is actually a preparation for reserving extra memory when SME or SEV is active which has been implemented in the kernel space in RHEL8.
Thanks,
Pingfan
Signed-off-by: Coiby Xu coxu@redhat.com
kdump-lib.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 94cc8ff..5c79436 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -822,6 +822,41 @@ get_recommend_size() IFS="$OLDIFS" }
+# add memory to crashkernel string +# $1 extra memory size, unit:M +# return crashkernel string (unit=M) +add_extra_mem_to_crashkernel() +{
- local _extra_mem="$1" _ck_cmdline="$2" _new_ck_cmdline
- local _range _mem _size _unit _ele _new_ele
- local OLDIFS="$IFS"
- IFS=','
- for _ele in $_ck_cmdline; do
_range=$(awk -F ":" '{print $1}' <<< "$_ele")
_mem=$(awk -F ":" '{print $2}' <<< "$_ele")
_size=${_mem::-1}
_unit=${_mem: -1}
if [[ $_unit != "M" ]] && [[ $_unit != "G" ]]; then
perror_exit "can't process $_unit"
fi
if [[ $_unit == 'G' ]]; then
_size=$((_size * 1024))
fi
_size=$((_size + _extra_mem))
_new_ele="${_range}:${_size}M"
if [[ -z $_new_ck_cmdline ]]; then
_new_ck_cmdline=$_new_ele
else
_new_ck_cmdline="${_new_ck_cmdline},${_new_ele}"
fi
- done
- IFS="$OLDIFS"
- echo -n "$_new_ck_cmdline"
+}
# get default crashkernel # $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable kdump_get_arch_recommend_crashkernel() -- 2.31.1
Reserve 60MB at maximum for SWIOTLB.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdumpctl | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 345e112..5149cfe 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1358,7 +1358,6 @@ _valid_grubby_kernel_path() [[ -e $1 ]] || [[ $1 == ALL ]] || [[ $1 == DEFAULT ]] }
- get_dump_mode_of_kernel() { local _kernel_path=$1 _fadump_val @@ -1378,6 +1377,7 @@ get_dump_mode_of_kernel() _determine_kernel_path_and_crashkernel() { local _grub_kernel_path _crashkernel + if [[ -n "$1" ]] && [[ -n "$2" ]]; then _grub_kernel_path=$(_find_grubby_kernel_path "$1") || return 1 if _valid_grubby_kernel_path "$1"; then @@ -1400,9 +1400,31 @@ _determine_kernel_path_and_crashkernel() echo -n "${_grub_kernel_path};${_crashkernel}" }
+calculate_swiotlb_mem() +{ + local _default_mem=64 _grub_kernel_path="$1" + local _num_re="^[0-9]+$" + if [[ $(get_grub_kernel_boot_parameter "$_grub_kernel_path" mem_encrypt) == on ]]; then + # sanity check? + _swiotlb_str=$(get_grub_kernel_boot_parameter "$_grub_kernel_path" swiotlb) + if [[ $_swiotlb_str == noforce ]]; then + echo -n 0 + elif [[ $_swiotlb_str =~ $_num_re ]]; then + _swiotlb_sab_mem=$(((_swiotlb_str*128+127)/128)) + [[ $_swiotlb_sab_mem -gt 64 ]] && _swiotlb_sab_mem="$_default_mem" + echo -n "$_swiotlb_sab_mem" + else + echo -n "$_default_mem" + fi + else + echo -n 0 + fi +} + reset_crashkernel() { local _crashkernel _kernel_crashkernel _grub_kernel_path _tmp_str _dump_mode + local _extra_mem _swiotlb_mem
if _tmp_str=$(_determine_kernel_path_and_crashkernel "$1" "$2"); then _grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str") @@ -1425,6 +1447,10 @@ reset_crashkernel()
if [[ $_crashkernel == "auto" ]] ; then _kernel_crashkernel=$(kdump_get_arch_recommend_crashkernel "$_dump_mode") + _extra_mem=0 + _swiotlb_mem=$(calculate_swiotlb_mem "$_grub_kernel_path") + _extra_mem=$((_extra_mem+_swiotlb_mem)) + _kernel_crashkernel=$(add_extra_mem_to_crashkernel "$_extra_mem" "$_kernel_crashkernel") else _kernel_crashkernel="$_crashkernel" fi
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com --- kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{ + + local _grub_kernel_path _crashkernel _tmp_str + if [[ $1 != on && $1 != nocma && $1 != off ]]; then + derror "$1 invalid, valid values are on/off/nocma" + exit 1 + fi + + if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then + _grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str") + _crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str") + else + exit 1 + fi + + grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path" + reset_crashkernel "$_grub_kernel_path" "$_crashkernel" +} + if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1522,6 +1542,9 @@ main() reset-crashkernel) reset_crashkernel "$2" "$3" ;; + fadump) + toggle_fadump "$2" "$3" "$4" + ;; *) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" exit 1 diff --git a/kdumpctl.8 b/kdumpctl.8 index 19734aa..17b10cf 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -55,7 +55,9 @@ Reset crashkernel value to CRASHKERNEL or the value specified in /etc/kdump.conf. If no kernel is specified, will reset current running kernel's crashkernel value. If CRASHKERNEL is given, the value would be also writeen to /etc/kdump.conf. - +.TP +.I fadump on/off [[KERNELPATH[, CRASHKERNEL]], [CRASHKERNEL], [KERNELPATH]] +Toggle fadump on or off and reset crashkernel.
.SH "SEE ALSO" .BR kdump.conf (5),
On Fri, Nov 19, 2021 at 11:23:07AM +0800, Coiby Xu wrote:
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{
- local _grub_kernel_path _crashkernel _tmp_str
- if [[ $1 != on && $1 != nocma && $1 != off ]]; then
derror "$1 invalid, valid values are on/off/nocma"
exit 1
- fi
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
- grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path"
- reset_crashkernel "$_grub_kernel_path" "$_crashkernel"
The kdump_get_arch_recommend_size()->is_fadump_capable() only works if booting with fadump=on.
So here let us say fadump=off -> on, unless I misunderstand, it can get the correct "crashkernel="
Thanks,
Pingfan
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1522,6 +1542,9 @@ main() reset-crashkernel) reset_crashkernel "$2" "$3" ;;
- fadump)
toggle_fadump "$2" "$3" "$4"
*) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" exit 1;;
diff --git a/kdumpctl.8 b/kdumpctl.8 index 19734aa..17b10cf 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -55,7 +55,9 @@ Reset crashkernel value to CRASHKERNEL or the value specified in /etc/kdump.conf. If no kernel is specified, will reset current running kernel's crashkernel value. If CRASHKERNEL is given, the value would be also writeen to /etc/kdump.conf.
+.TP +.I fadump on/off [[KERNELPATH[, CRASHKERNEL]], [CRASHKERNEL], [KERNELPATH]] +Toggle fadump on or off and reset crashkernel.
.SH "SEE ALSO" .BR kdump.conf (5), -- 2.31.1
On Fri, Nov 19, 2021 at 01:25:25PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:07AM +0800, Coiby Xu wrote:
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{
- local _grub_kernel_path _crashkernel _tmp_str
- if [[ $1 != on && $1 != nocma && $1 != off ]]; then
derror "$1 invalid, valid values are on/off/nocma"
exit 1
- fi
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
- grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path"
- reset_crashkernel "$_grub_kernel_path" "$_crashkernel"
The kdump_get_arch_recommend_size()->is_fadump_capable() only works if booting with fadump=on.
This interface doesn't use kdump_get_arch_recommend_size. To determine if fadump is enabled for a kernel, the only reliably way is to get it from grubby. For example, a user enables fadump for a kernel by running "kumpctl fadump on" but is_fadump_capable is false in this case before rebooting the system.
So here let us say fadump=off -> on, unless I misunderstand, it can get the correct "crashkernel="
Thanks,
Pingfan
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1522,6 +1542,9 @@ main() reset-crashkernel) reset_crashkernel "$2" "$3" ;;
- fadump)
toggle_fadump "$2" "$3" "$4"
*) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" exit 1;;
diff --git a/kdumpctl.8 b/kdumpctl.8 index 19734aa..17b10cf 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -55,7 +55,9 @@ Reset crashkernel value to CRASHKERNEL or the value specified in /etc/kdump.conf. If no kernel is specified, will reset current running kernel's crashkernel value. If CRASHKERNEL is given, the value would be also writeen to /etc/kdump.conf.
+.TP +.I fadump on/off [[KERNELPATH[, CRASHKERNEL]], [CRASHKERNEL], [KERNELPATH]] +Toggle fadump on or off and reset crashkernel.
.SH "SEE ALSO" .BR kdump.conf (5), -- 2.31.1
On Fri, Nov 19, 2021 at 1:52 PM Coiby Xu coxu@redhat.com wrote:
On Fri, Nov 19, 2021 at 01:25:25PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:07AM +0800, Coiby Xu wrote:
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{
- local _grub_kernel_path _crashkernel _tmp_str
- if [[ $1 != on && $1 != nocma && $1 != off ]]; then
derror "$1 invalid, valid values are on/off/nocma"
exit 1
- fi
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
- grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path"
- reset_crashkernel "$_grub_kernel_path" "$_crashkernel"
The kdump_get_arch_recommend_size()->is_fadump_capable() only works if booting with fadump=on.
This interface doesn't use kdump_get_arch_recommend_size. To determine if fadump is enabled for a kernel, the only reliably way is to get it from grubby. For example, a user enables fadump for a kernel by running "kumpctl fadump on" but is_fadump_capable is false in this case before rebooting the system.
So here let us say fadump=off -> on, unless I misunderstand, it can get the correct "crashkernel="
As the above question, could you enlighten me about how to get the correct "crashkernel=" in the series ?
Thanks
Thanks,
Pingfan
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1522,6 +1542,9 @@ main() reset-crashkernel) reset_crashkernel "$2" "$3" ;;
- fadump)
toggle_fadump "$2" "$3" "$4"
*) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" exit 1;;
diff --git a/kdumpctl.8 b/kdumpctl.8 index 19734aa..17b10cf 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -55,7 +55,9 @@ Reset crashkernel value to CRASHKERNEL or the value specified in /etc/kdump.conf. If no kernel is specified, will reset current running kernel's crashkernel value. If CRASHKERNEL is given, the value would be also writeen to /etc/kdump.conf.
+.TP +.I fadump on/off [[KERNELPATH[, CRASHKERNEL]], [CRASHKERNEL], [KERNELPATH]] +Toggle fadump on or off and reset crashkernel.
.SH "SEE ALSO" .BR kdump.conf (5), -- 2.31.1
-- Best regards, Coiby
On Fri, Nov 19, 2021 at 02:20:44PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 1:52 PM Coiby Xu coxu@redhat.com wrote:
On Fri, Nov 19, 2021 at 01:25:25PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:07AM +0800, Coiby Xu wrote:
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{
- local _grub_kernel_path _crashkernel _tmp_str
- if [[ $1 != on && $1 != nocma && $1 != off ]]; then
derror "$1 invalid, valid values are on/off/nocma"
exit 1
- fi
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
- grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path"
- reset_crashkernel "$_grub_kernel_path" "$_crashkernel"
The kdump_get_arch_recommend_size()->is_fadump_capable() only works if booting with fadump=on.
This interface doesn't use kdump_get_arch_recommend_size. To determine if fadump is enabled for a kernel, the only reliably way is to get it from grubby. For example, a user enables fadump for a kernel by running "kumpctl fadump on" but is_fadump_capable is false in this case before rebooting the system.
So here let us say fadump=off -> on, unless I misunderstand, it can get the correct "crashkernel="
As the above question, could you enlighten me about how to get the correct "crashkernel=" in the series ?
For crashkernel=auto, there are three cases where we need to get crashkernel value,
1. when installing OS
kdump-anaconda-addon will call "kdumpctl get-default-crashkernel" to get the value. If the user chooses to enable fadump, the addon would call "kdumpctl get-default-crashkernel fadump" instead.
2. when the user toggles fadump on
a) kdumpctl would add "fadump=on" to the specified kernel cmdline. b) reset_crashkernel would call get_dump_mode_of_kernel which would return fadump since fadump=on is found in the kernel cmdline. c) Then kdump_get_arch_recommend_crashkernel "$_dump_mode" would return the fadump default crashkernel.
3. when a new kernel is installed
92-crashkernel.install is ran after grubby set up cmdline for the new kernel. According to my observation, grubby would use the cmdline of the running kernel for the installed kernel. So if the running kernel has fadump enabled, the new kernel would also have fadump=on thus fadump default crashkernel would be used in reset_crashkernel which is the same to the above "2. when the user toggles fadump on".
Thanks
Thanks,
Pingfan
+}
if [[ ! -f $KDUMP_CONFIG_FILE ]]; then derror "Error: No kdump config file found!" exit 1 @@ -1522,6 +1542,9 @@ main() reset-crashkernel) reset_crashkernel "$2" "$3" ;;
- fadump)
toggle_fadump "$2" "$3" "$4"
*) dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem}" exit 1;;
diff --git a/kdumpctl.8 b/kdumpctl.8 index 19734aa..17b10cf 100644 --- a/kdumpctl.8 +++ b/kdumpctl.8 @@ -55,7 +55,9 @@ Reset crashkernel value to CRASHKERNEL or the value specified in /etc/kdump.conf. If no kernel is specified, will reset current running kernel's crashkernel value. If CRASHKERNEL is given, the value would be also writeen to /etc/kdump.conf.
+.TP +.I fadump on/off [[KERNELPATH[, CRASHKERNEL]], [CRASHKERNEL], [KERNELPATH]] +Toggle fadump on or off and reset crashkernel.
.SH "SEE ALSO" .BR kdump.conf (5), -- 2.31.1
-- Best regards, Coiby
On Fri, Nov 19, 2021 at 2:42 PM Coiby Xu coxu@redhat.com wrote:
On Fri, Nov 19, 2021 at 02:20:44PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 1:52 PM Coiby Xu coxu@redhat.com wrote:
On Fri, Nov 19, 2021 at 01:25:25PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:07AM +0800, Coiby Xu wrote:
"kdumpctl fadump on/off" would be used to toggle on/off fadump and then call reset-crashkernel.
Signed-off-by: Coiby Xu coxu@redhat.com
kdumpctl | 23 +++++++++++++++++++++++ kdumpctl.8 | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 5149cfe..22ee48b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1458,6 +1458,26 @@ reset_crashkernel() _update_crashkernel "$_grub_kernel_path" "$_kernel_crashkernel" }
+toggle_fadump() +{
- local _grub_kernel_path _crashkernel _tmp_str
- if [[ $1 != on && $1 != nocma && $1 != off ]]; then
derror "$1 invalid, valid values are on/off/nocma"
exit 1
- fi
- if _tmp_str=$(_determine_kernel_path_and_crashkernel "$2" "$3"); then
_grub_kernel_path=$(cut -d ";" -f 1 <<< "$_tmp_str")
_crashkernel=$(cut -d ";" -f 2 <<< "$_tmp_str")
- else
exit 1
- fi
- grubby --args "fadump=$1" --update-kernel "$_grub_kernel_path"
- reset_crashkernel "$_grub_kernel_path" "$_crashkernel"
The kdump_get_arch_recommend_size()->is_fadump_capable() only works if booting with fadump=on.
This interface doesn't use kdump_get_arch_recommend_size. To determine if fadump is enabled for a kernel, the only reliably way is to get it from grubby. For example, a user enables fadump for a kernel by running "kumpctl fadump on" but is_fadump_capable is false in this case before rebooting the system.
So here let us say fadump=off -> on, unless I misunderstand, it can get the correct "crashkernel="
As the above question, could you enlighten me about how to get the correct "crashkernel=" in the series ?
For crashkernel=auto, there are three cases where we need to get crashkernel value,
- when installing OS
kdump-anaconda-addon will call "kdumpctl get-default-crashkernel" to get the value. If the user chooses to enable fadump, the addon would call "kdumpctl get-default-crashkernel fadump" instead.
- when the user toggles fadump on
a) kdumpctl would add "fadump=on" to the specified kernel cmdline. b) reset_crashkernel would call get_dump_mode_of_kernel which would return fadump since fadump=on is found in the kernel cmdline. c) Then kdump_get_arch_recommend_crashkernel "$_dump_mode" would return the fadump default crashkernel.
This is what I was concerned about. And I think you can avoid to call grubby twice by taking the "1" way, something like "kdumpctl get-default-crashkernel fadump=on"
Thanks,
Pingfan
On Fri, Nov 19, 2021 at 04:24:58PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 2:42 PM Coiby Xu coxu@redhat.com wrote:
[...]
As the above question, could you enlighten me about how to get the correct "crashkernel=" in the series ?
For crashkernel=auto, there are three cases where we need to get crashkernel value,
- when installing OS
kdump-anaconda-addon will call "kdumpctl get-default-crashkernel" to get the value. If the user chooses to enable fadump, the addon would call "kdumpctl get-default-crashkernel fadump" instead.
- when the user toggles fadump on
a) kdumpctl would add "fadump=on" to the specified kernel cmdline. b) reset_crashkernel would call get_dump_mode_of_kernel which would return fadump since fadump=on is found in the kernel cmdline. c) Then kdump_get_arch_recommend_crashkernel "$_dump_mode" would return the fadump default crashkernel.
This is what I was concerned about. And I think you can avoid to call grubby twice by taking the "1" way, something like "kdumpctl get-default-crashkernel fadump=on"
Thanks for the suggestion! I'll try to find a way to avoid calling grubby twice.
Thanks,
Pingfan
The installation hook can call "kdumpctl reset-crashkernel KERNELIMAGE" to set crashkernel for new kernel. Also remove crashkenel.default related code.
Signed-off-by: Coiby Xu coxu@redhat.com --- 92-crashkernel.install | 135 +---------------------------------------- 1 file changed, 1 insertion(+), 134 deletions(-)
diff --git a/92-crashkernel.install b/92-crashkernel.install index 78365ff..b8025e4 100755 --- a/92-crashkernel.install +++ b/92-crashkernel.install @@ -5,142 +5,9 @@ KERNEL_VERSION="$2" KDUMP_INITRD_DIR_ABS="$3" KERNEL_IMAGE="$4"
-grub_etc_default="/etc/default/grub" - -ver_lt() { - [[ "$(echo -e "$1\n$2" | sort -V)" == $1$'\n'* ]] && [[ $1 != "$2" ]] -} - -# Read crashkernel= value in /etc/default/grub -get_grub_etc_ck() { - [[ -e $grub_etc_default ]] && \ - sed -n -e "s/^GRUB_CMDLINE_LINUX=.*(crashkernel=[^\ "]*)[\ "].*$/\1/p" $grub_etc_default -} - -# Read crashkernel.default value of specified kernel -get_ck_default() { - ck_file="/usr/lib/modules/$1/crashkernel.default" - [[ -f "$ck_file" ]] && cat "$ck_file" -} - -# Iterate installed kernels, find the kernel with the highest version that has a -# valid crashkernel.default file, exclude current installing/removing kernel -# -# $1: a string representing a crashkernel= cmdline. If given, will also check the -# content of crashkernel.default, only crashkernel.default with the same value will match -get_highest_ck_default_kver() { - for kernel in $(find /usr/lib/modules -maxdepth 1 -mindepth 1 -printf "%f\n" | sort --version-sort -r); do - [[ $kernel == "$KERNEL_VERSION" ]] && continue - [[ -s "/usr/lib/modules/$kernel/crashkernel.default" ]] || continue - - echo "$kernel" - return 0 - done - - return 1 -} - -set_grub_ck() { - sed -i -e "s/^(GRUB_CMDLINE_LINUX=.*)crashkernel=[^\ "]*([\ "].*)$/\1$1\2/" "$grub_etc_default" -} - -# Set specified kernel's crashkernel cmdline value -set_kernel_ck() { - kernel=$1 - ck_cmdline=$2 - - entry=$(grubby --info ALL | grep "^kernel=.*$kernel") - entry=${entry#kernel=} - entry=${entry#"} - entry=${entry%"} - - if [[ -z "$entry" ]]; then - echo "$0: failed to find boot entry for kernel $kernel" - return 1 - fi - - [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl" - grubby --args "$ck_cmdline" --update-kernel "$entry" $zipl_arg - [[ $zipl_arg ]] && zipl > /dev/null ||: -} - case "$COMMAND" in add) - # - If current boot kernel is using default crashkernel value, update - # installing kernel's crashkernel value to its default value, - # - If intalling a higher version kernel, and /etc/default/grub's - # crashkernel value is using default value, update it to installing - # kernel's default value. - inst_ck_default=$(get_ck_default "$KERNEL_VERSION") - # If installing kernel doesn't have crashkernel.default, just exit. - [[ -z "$inst_ck_default" ]] && exit 0 - - boot_kernel=$(uname -r) - boot_ck_cmdline=$(sed -n -e "s/^.*(crashkernel=\S*).*$/\1/p" /proc/cmdline) - highest_ck_default_kver=$(get_highest_ck_default_kver) - highest_ck_default=$(get_ck_default "$highest_ck_default_kver") - - # Try update /etc/default/grub if present, else grub2-mkconfig could - # override crashkernel value. - grub_etc_ck=$(get_grub_etc_ck) - if [[ -n "$grub_etc_ck" ]]; then - if [[ -z "$highest_ck_default_kver" ]]; then - # None of installed kernel have a crashkernel.default, - # check for 'crashkernel=auto' in case of legacy kernel - [[ "$grub_etc_ck" == "crashkernel=auto" ]] && \ - set_grub_ck "$inst_ck_default" - else - # There is a valid crashkernel.default, check if installing kernel - # have a higher version and grub config is using default value - ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION" && \ - [[ "$grub_etc_ck" == "$highest_ck_default" ]] && \ - [[ "$grub_etc_ck" != "$inst_ck_default" ]] && \ - set_grub_ck "$inst_ck_default" - fi - fi - - # Exit if crashkernel is not used in current cmdline - [[ -z $boot_ck_cmdline ]] && exit 0 - - # Get current boot kernel's default value - boot_ck_default=$(get_ck_default "$boot_kernel") - if [[ $boot_ck_cmdline == "crashkernel=auto" ]]; then - # Legacy RHEL kernel defaults to "auto" - boot_ck_default="$boot_ck_cmdline" - fi - - # If boot kernel doesn't have a crashkernel.default, check - # if it's using any installed kernel's crashkernel.default - if [[ -z $boot_ck_default ]]; then - [[ $(get_highest_ck_default_kver "$boot_ck_cmdline") ]] && boot_ck_default="$boot_ck_cmdline" - fi - - # If boot kernel is using a default crashkernel, update - # installing kernel's crashkernel to new default value - if [[ "$boot_ck_cmdline" != "$inst_ck_default" ]] && [[ "$boot_ck_cmdline" == "$boot_ck_default" ]]; then - set_kernel_ck "$KERNEL_VERSION" "$inst_ck_default" - fi - - exit 0 - ;; -remove) - # If grub default value is upgraded when this kernel was installed, try downgrade it - grub_etc_ck=$(get_grub_etc_ck) - [[ $grub_etc_ck ]] || exit 0 - - removing_ck_conf=$(get_ck_default "$KERNEL_VERSION") - [[ $removing_ck_conf ]] || exit 0 - - highest_ck_default_kver=$(get_highest_ck_default_kver) || exit 0 - highest_ck_default=$(get_ck_default "$highest_ck_default_kver") - [[ $highest_ck_default ]] || exit 0 - - if ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION"; then - if [[ $grub_etc_ck == "$removing_ck_conf" ]] && [[ $grub_etc_ck != "$highest_ck_default" ]]; then - set_grub_ck "$highest_ck_default" - fi - fi - + kdumpctl set-crashkernel "$KERNEL_IMAGE" exit 0 ;; esac
On Fri, Nov 19, 2021 at 11:23:08AM +0800, Coiby Xu wrote:
The installation hook can call "kdumpctl reset-crashkernel KERNELIMAGE" to set crashkernel for new kernel. Also remove crashkenel.default related code.
Signed-off-by: Coiby Xu coxu@redhat.com
92-crashkernel.install | 135 +---------------------------------------- 1 file changed, 1 insertion(+), 134 deletions(-)
diff --git a/92-crashkernel.install b/92-crashkernel.install index 78365ff..b8025e4 100755 --- a/92-crashkernel.install +++ b/92-crashkernel.install @@ -5,142 +5,9 @@ KERNEL_VERSION="$2" KDUMP_INITRD_DIR_ABS="$3" KERNEL_IMAGE="$4"
-grub_etc_default="/etc/default/grub"
-ver_lt() {
- [[ "$(echo -e "$1\n$2" | sort -V)" == $1$'\n'* ]] && [[ $1 != "$2" ]]
-}
-# Read crashkernel= value in /etc/default/grub -get_grub_etc_ck() {
- [[ -e $grub_etc_default ]] && \
- sed -n -e "s/^GRUB_CMDLINE_LINUX=.*(crashkernel=[^\ "]*)[\ "].*$/\1/p" $grub_etc_default
-}
-# Read crashkernel.default value of specified kernel -get_ck_default() {
- ck_file="/usr/lib/modules/$1/crashkernel.default"
- [[ -f "$ck_file" ]] && cat "$ck_file"
-}
-# Iterate installed kernels, find the kernel with the highest version that has a -# valid crashkernel.default file, exclude current installing/removing kernel -# -# $1: a string representing a crashkernel= cmdline. If given, will also check the -# content of crashkernel.default, only crashkernel.default with the same value will match -get_highest_ck_default_kver() {
- for kernel in $(find /usr/lib/modules -maxdepth 1 -mindepth 1 -printf "%f\n" | sort --version-sort -r); do
[[ $kernel == "$KERNEL_VERSION" ]] && continue
[[ -s "/usr/lib/modules/$kernel/crashkernel.default" ]] || continue
echo "$kernel"
return 0
- done
- return 1
-}
-set_grub_ck() {
- sed -i -e "s/^(GRUB_CMDLINE_LINUX=.*)crashkernel=[^\ "]*([\ "].*)$/\1$1\2/" "$grub_etc_default"
-}
-# Set specified kernel's crashkernel cmdline value -set_kernel_ck() {
- kernel=$1
- ck_cmdline=$2
- entry=$(grubby --info ALL | grep "^kernel=.*$kernel")
- entry=${entry#kernel=}
- entry=${entry#"}
- entry=${entry%"}
- if [[ -z "$entry" ]]; then
echo "$0: failed to find boot entry for kernel $kernel"
return 1
- fi
- [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl"
- grubby --args "$ck_cmdline" --update-kernel "$entry" $zipl_arg
- [[ $zipl_arg ]] && zipl > /dev/null ||:
-}
case "$COMMAND" in add)
- # - If current boot kernel is using default crashkernel value, update
- # installing kernel's crashkernel value to its default value,
- # - If intalling a higher version kernel, and /etc/default/grub's
- # crashkernel value is using default value, update it to installing
- # kernel's default value.
- inst_ck_default=$(get_ck_default "$KERNEL_VERSION")
- # If installing kernel doesn't have crashkernel.default, just exit.
- [[ -z "$inst_ck_default" ]] && exit 0
- boot_kernel=$(uname -r)
- boot_ck_cmdline=$(sed -n -e "s/^.*(crashkernel=\S*).*$/\1/p" /proc/cmdline)
- highest_ck_default_kver=$(get_highest_ck_default_kver)
- highest_ck_default=$(get_ck_default "$highest_ck_default_kver")
- # Try update /etc/default/grub if present, else grub2-mkconfig could
- # override crashkernel value.
- grub_etc_ck=$(get_grub_etc_ck)
- if [[ -n "$grub_etc_ck" ]]; then
if [[ -z "$highest_ck_default_kver" ]]; then
# None of installed kernel have a crashkernel.default,
# check for 'crashkernel=auto' in case of legacy kernel
[[ "$grub_etc_ck" == "crashkernel=auto" ]] && \
set_grub_ck "$inst_ck_default"
else
# There is a valid crashkernel.default, check if installing kernel
# have a higher version and grub config is using default value
ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION" && \
[[ "$grub_etc_ck" == "$highest_ck_default" ]] && \
[[ "$grub_etc_ck" != "$inst_ck_default" ]] && \
set_grub_ck "$inst_ck_default"
fi
- fi
- # Exit if crashkernel is not used in current cmdline
- [[ -z $boot_ck_cmdline ]] && exit 0
- # Get current boot kernel's default value
- boot_ck_default=$(get_ck_default "$boot_kernel")
- if [[ $boot_ck_cmdline == "crashkernel=auto" ]]; then
# Legacy RHEL kernel defaults to "auto"
boot_ck_default="$boot_ck_cmdline"
- fi
- # If boot kernel doesn't have a crashkernel.default, check
- # if it's using any installed kernel's crashkernel.default
- if [[ -z $boot_ck_default ]]; then
[[ $(get_highest_ck_default_kver "$boot_ck_cmdline") ]] && boot_ck_default="$boot_ck_cmdline"
- fi
- # If boot kernel is using a default crashkernel, update
- # installing kernel's crashkernel to new default value
- if [[ "$boot_ck_cmdline" != "$inst_ck_default" ]] && [[ "$boot_ck_cmdline" == "$boot_ck_default" ]]; then
set_kernel_ck "$KERNEL_VERSION" "$inst_ck_default"
- fi
- exit 0
- ;;
-remove)
- # If grub default value is upgraded when this kernel was installed, try downgrade it
- grub_etc_ck=$(get_grub_etc_ck)
- [[ $grub_etc_ck ]] || exit 0
- removing_ck_conf=$(get_ck_default "$KERNEL_VERSION")
- [[ $removing_ck_conf ]] || exit 0
- highest_ck_default_kver=$(get_highest_ck_default_kver) || exit 0
- highest_ck_default=$(get_ck_default "$highest_ck_default_kver")
- [[ $highest_ck_default ]] || exit 0
- if ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION"; then
if [[ $grub_etc_ck == "$removing_ck_conf" ]] && [[ $grub_etc_ck != "$highest_ck_default" ]]; then
set_grub_ck "$highest_ck_default"
fi
- fi
- kdumpctl set-crashkernel "$KERNEL_IMAGE"
^^^ reset?
exit 0 ;; esac -- 2.31.1
On Fri, Nov 19, 2021 at 01:13:48PM +0800, Pingfan Liu wrote:
On Fri, Nov 19, 2021 at 11:23:08AM +0800, Coiby Xu wrote:
The installation hook can call "kdumpctl reset-crashkernel KERNELIMAGE" to set crashkernel for new kernel. Also remove crashkenel.default related code.
Signed-off-by: Coiby Xu coxu@redhat.com
92-crashkernel.install | 135 +---------------------------------------- 1 file changed, 1 insertion(+), 134 deletions(-)
diff --git a/92-crashkernel.install b/92-crashkernel.install index 78365ff..b8025e4 100755 --- a/92-crashkernel.install +++ b/92-crashkernel.install @@ -5,142 +5,9 @@ KERNEL_VERSION="$2" KDUMP_INITRD_DIR_ABS="$3" KERNEL_IMAGE="$4"
-grub_etc_default="/etc/default/grub"
-ver_lt() {
- [[ "$(echo -e "$1\n$2" | sort -V)" == $1$'\n'* ]] && [[ $1 != "$2" ]]
-}
-# Read crashkernel= value in /etc/default/grub -get_grub_etc_ck() {
- [[ -e $grub_etc_default ]] && \
- sed -n -e "s/^GRUB_CMDLINE_LINUX=.*(crashkernel=[^\ "]*)[\ "].*$/\1/p" $grub_etc_default
-}
-# Read crashkernel.default value of specified kernel -get_ck_default() {
- ck_file="/usr/lib/modules/$1/crashkernel.default"
- [[ -f "$ck_file" ]] && cat "$ck_file"
-}
-# Iterate installed kernels, find the kernel with the highest version that has a -# valid crashkernel.default file, exclude current installing/removing kernel -# -# $1: a string representing a crashkernel= cmdline. If given, will also check the -# content of crashkernel.default, only crashkernel.default with the same value will match -get_highest_ck_default_kver() {
- for kernel in $(find /usr/lib/modules -maxdepth 1 -mindepth 1 -printf "%f\n" | sort --version-sort -r); do
[[ $kernel == "$KERNEL_VERSION" ]] && continue
[[ -s "/usr/lib/modules/$kernel/crashkernel.default" ]] || continue
echo "$kernel"
return 0
- done
- return 1
-}
-set_grub_ck() {
- sed -i -e "s/^(GRUB_CMDLINE_LINUX=.*)crashkernel=[^\ "]*([\ "].*)$/\1$1\2/" "$grub_etc_default"
-}
-# Set specified kernel's crashkernel cmdline value -set_kernel_ck() {
- kernel=$1
- ck_cmdline=$2
- entry=$(grubby --info ALL | grep "^kernel=.*$kernel")
- entry=${entry#kernel=}
- entry=${entry#"}
- entry=${entry%"}
- if [[ -z "$entry" ]]; then
echo "$0: failed to find boot entry for kernel $kernel"
return 1
- fi
- [[ -f /etc/zipl.conf ]] && zipl_arg="--zipl"
- grubby --args "$ck_cmdline" --update-kernel "$entry" $zipl_arg
- [[ $zipl_arg ]] && zipl > /dev/null ||:
-}
case "$COMMAND" in add)
- # - If current boot kernel is using default crashkernel value, update
- # installing kernel's crashkernel value to its default value,
- # - If intalling a higher version kernel, and /etc/default/grub's
- # crashkernel value is using default value, update it to installing
- # kernel's default value.
- inst_ck_default=$(get_ck_default "$KERNEL_VERSION")
- # If installing kernel doesn't have crashkernel.default, just exit.
- [[ -z "$inst_ck_default" ]] && exit 0
- boot_kernel=$(uname -r)
- boot_ck_cmdline=$(sed -n -e "s/^.*(crashkernel=\S*).*$/\1/p" /proc/cmdline)
- highest_ck_default_kver=$(get_highest_ck_default_kver)
- highest_ck_default=$(get_ck_default "$highest_ck_default_kver")
- # Try update /etc/default/grub if present, else grub2-mkconfig could
- # override crashkernel value.
- grub_etc_ck=$(get_grub_etc_ck)
- if [[ -n "$grub_etc_ck" ]]; then
if [[ -z "$highest_ck_default_kver" ]]; then
# None of installed kernel have a crashkernel.default,
# check for 'crashkernel=auto' in case of legacy kernel
[[ "$grub_etc_ck" == "crashkernel=auto" ]] && \
set_grub_ck "$inst_ck_default"
else
# There is a valid crashkernel.default, check if installing kernel
# have a higher version and grub config is using default value
ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION" && \
[[ "$grub_etc_ck" == "$highest_ck_default" ]] && \
[[ "$grub_etc_ck" != "$inst_ck_default" ]] && \
set_grub_ck "$inst_ck_default"
fi
- fi
- # Exit if crashkernel is not used in current cmdline
- [[ -z $boot_ck_cmdline ]] && exit 0
- # Get current boot kernel's default value
- boot_ck_default=$(get_ck_default "$boot_kernel")
- if [[ $boot_ck_cmdline == "crashkernel=auto" ]]; then
# Legacy RHEL kernel defaults to "auto"
boot_ck_default="$boot_ck_cmdline"
- fi
- # If boot kernel doesn't have a crashkernel.default, check
- # if it's using any installed kernel's crashkernel.default
- if [[ -z $boot_ck_default ]]; then
[[ $(get_highest_ck_default_kver "$boot_ck_cmdline") ]] && boot_ck_default="$boot_ck_cmdline"
- fi
- # If boot kernel is using a default crashkernel, update
- # installing kernel's crashkernel to new default value
- if [[ "$boot_ck_cmdline" != "$inst_ck_default" ]] && [[ "$boot_ck_cmdline" == "$boot_ck_default" ]]; then
set_kernel_ck "$KERNEL_VERSION" "$inst_ck_default"
- fi
- exit 0
- ;;
-remove)
- # If grub default value is upgraded when this kernel was installed, try downgrade it
- grub_etc_ck=$(get_grub_etc_ck)
- [[ $grub_etc_ck ]] || exit 0
- removing_ck_conf=$(get_ck_default "$KERNEL_VERSION")
- [[ $removing_ck_conf ]] || exit 0
- highest_ck_default_kver=$(get_highest_ck_default_kver) || exit 0
- highest_ck_default=$(get_ck_default "$highest_ck_default_kver")
- [[ $highest_ck_default ]] || exit 0
- if ver_lt "$highest_ck_default_kver" "$KERNEL_VERSION"; then
if [[ $grub_etc_ck == "$removing_ck_conf" ]] && [[ $grub_etc_ck != "$highest_ck_default" ]]; then
set_grub_ck "$highest_ck_default"
fi
- fi
- kdumpctl set-crashkernel "$KERNEL_IMAGE"
^^^ reset?
Yes, it should be reset-crashkernel. Thanks for spotting this mistake!
exit 0 ;; esac -- 2.31.1
On Fri, Nov 19, 2021 at 11:22:57AM +0800, Coiby Xu wrote:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
Overall, this series make sense to me. My major concern is about [3/11].
Thanks,
Pingfan
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1
On Fri, Nov 19, 2021 at 1:34 PM Pingfan Liu piliu@redhat.com wrote:
On Fri, Nov 19, 2021 at 11:22:57AM +0800, Coiby Xu wrote:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
Overall, this series make sense to me. My major concern is about [3/11].
^^^ [2/11]. Sorry about the mistake
Thanks,
Pingfan
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Hi Coiby, Thanks for the patches, ccing Hari about the fadump part..
On Fri, 19 Nov 2021 at 11:23, Coiby Xu coxu@redhat.com wrote:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Hi Coiby,
i still need a little time to fully understand the big picture. Nevertheless here are some nits.
Thanks Philipp
On Fri, 19 Nov 2021 11:22:57 +0800 Coiby Xu coxu@redhat.com wrote:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
Coiby Xu coxu@redhat.com 于2021年11月19日周五 上午11:24写道:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Nice idea👍, this makes thing so much cleaner.
I remember the per version crashkernel.default file is introduced for many purposes in mind. For example a new kernel package may enabled/disabled something so it will need a larger/smaller crashkernel value, or, eg. a variant kernel, like debug kernel, can set itself a larger value. And one can easily distinguish if the actual used crashkernel value is the default value of a specified kernel version, even cross OS upgrade.
I guess these cases are finally considered too rare to be covered? Decoupling it from kernel version definitely saves tons of trouble (which was almost killing me :D).
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
On Wed, Dec 01, 2021 at 06:15:07PM +0800, Kairui Song wrote:
Coiby Xu coxu@redhat.com 于2021年11月19日周五 上午11:24写道:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Nice idea👍, this makes thing so much cleaner.
Thanks for endorsing this idea!
I remember the per version crashkernel.default file is introduced for many purposes in mind. For example a new kernel package may enabled/disabled something so it will need a larger/smaller crashkernel value, or, eg. a variant kernel, like debug kernel, can set itself a larger value.
I have been wondering why you ship a crashkernel.default with a kernel package, debug kernel could be one of the reasons. But kdump memory requirement could change dynamically. For example, the user could toggle SME on/off. So a static crashkernel couldn't address this dynamic change. On the other hand, we should be able to tell if a kernel is a debug kernel or has something enabled/disabled in kexec-tools. So my idea is the default crashkernel value could act as a baseline value and we will increase/decrease the crashernel value dynamically after evaluating different cases in kexec-tools. Btw, do you have a list of how different factors affect the memory requirement? The list may look like this, 1. debug kernel: need to increase the default crashkernel value by 30% 2. SME: an extra memory of 64MB at maximum 3. kernel config option CONFIG_XXX: 100MB+ 4. ...
And one can easily distinguish if the actual used crashkernel value is the default value of a specified kernel version, even cross OS upgrade.
I guess these cases are finally considered too rare to be covered? Decoupling it from kernel version definitely saves tons of trouble (which was almost killing me :D).
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Coiby Xu coxu@redhat.com 于 2021年12月3日周五 下午6:00写道:
On Wed, Dec 01, 2021 at 06:15:07PM +0800, Kairui Song wrote:
Coiby Xu coxu@redhat.com 于2021年11月19日周五 上午11:24写道:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Nice idea👍, this makes thing so much cleaner.
Thanks for endorsing this idea!
I remember the per version crashkernel.default file is introduced for many purposes in mind. For example a new kernel package may enabled/disabled something so it will need a larger/smaller crashkernel value, or, eg. a variant kernel, like debug kernel, can set itself a larger value.
Hi, thanks for the reply.
I have been wondering why you ship a crashkernel.default with a kernel package, debug kernel could be one of the reasons. But kdump memory requirement could change dynamically. For example, the user could toggle SME on/off. So a static crashkernel couldn't address this dynamic change.
That's absolutely correct, kernel itself isn't capable of estimating the crashkernel value. And actually crashkernel.default wasn't suppose to play the sole role on deciding the final crashkernel value.
Userspace have the ultimate right and more capable of estimating and deciding the crashkernel value.
i was planning previously, that crashkernel value decision will be composed of two parts: - kernel's crashkernel.default value as a reference. - kexec-tools do some estimation and adjust based on the kernel value.
This way both kernel and kexec-tools package have a say on deciding the final crashkernel value.
On the other hand, we should be able to tell if a kernel is a debug kernel or has something enabled/disabled in kexec-tools. So my idea is the default crashkernel value could act as a baseline value and we will increase/decrease the crashernel value dynamically after evaluating different cases in kexec-tools.
I totally agree, I originally wanted to enhance the "kdumpctl estimate", it will have two ways of estimating:
- Fast path: according to data collectable in first kernel (including the crashkernel.default file). - Slow path: do a actually kdump and collect info during the kdump run. It need at least one reboot, which will be really slow on some big servers, it's an unanswered question if this really worth it.
Then kexec-tools can suggest, or even set the crashkernel based on the estimating. But it's undecided how the two different estimating will play together on deciding the final crashkernel value. Maybe keep using the value estimated by fast path unless user manually triggers a slow path run. (And the slow path run will be invalided after kernel upgrade, so again not sure if user will really like it, maybe just focus on development of the fast path estimate is simpler).
Btw, do you have a list of how different factors affect the memory requirement? The list may look like this,
- debug kernel: need to increase the default crashkernel value by 30%
- SME: an extra memory of 64MB at maximum
- kernel config option CONFIG_XXX: 100MB+
- ...
I'm afraid no, it's really hard to make a table about the memory effect of each kernel component/feature.
You may need to do tons of experiments and testing to get the data, and in most time, a kenrel debug/feature config only consume a little part of the memory but a lot of such configs are enabled.
And these memory usage data will change from time to time as kernel updates, and some CONFIG combination will have more complex memory effect pattern... so I thought a crashkernel.default file set based on experience is preferred, and more doable.
This whole approach may need some simplification, eg. previously I was avoiding adding a new method of customizing crashkernel value, so grubby will still be user's first choice on customizing the crashkernel value. Grubby and the instal.d hook will take care of the management of crashkernel value, but this made the hook doing a lot of complex work. This patch adding a new config in kdump.conf, is just much cleaner, and I definitely like this more.
Maybe like you said, use the .default file as a baseline, and let kexec-tools maintain the actual value, then just cover some known cases, will be better idea. Other works can get respinned later.
And one can easily distinguish if the actual used crashkernel value is the default value of a specified kernel version, even cross OS upgrade.
I guess these cases are finally considered too rare to be covered? Decoupling it from kernel version definitely saves tons of trouble (which was almost killing me :D).
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
-- Best regards, Coiby
On Fri, 3 Dec 2021 21:05:11 +0800 Kairui Song ryncsn@gmail.com wrote:
Coiby Xu coxu@redhat.com 于 2021年12月3日周五 下午6:00写道:
On Wed, Dec 01, 2021 at 06:15:07PM +0800, Kairui Song wrote:
Coiby Xu coxu@redhat.com 于2021年11月19日周五 上午11:24写道:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Nice idea👍, this makes thing so much cleaner.
Thanks for endorsing this idea!
I remember the per version crashkernel.default file is introduced for many purposes in mind. For example a new kernel package may enabled/disabled something so it will need a larger/smaller crashkernel value, or, eg. a variant kernel, like debug kernel, can set itself a larger value.
Hi, thanks for the reply.
@Kairui: Nice to see you active on the mailing list :)
I have been wondering why you ship a crashkernel.default with a kernel package, debug kernel could be one of the reasons. But kdump memory requirement could change dynamically. For example, the user could toggle SME on/off. So a static crashkernel couldn't address this dynamic change.
That's absolutely correct, kernel itself isn't capable of estimating the crashkernel value. And actually crashkernel.default wasn't suppose to play the sole role on deciding the final crashkernel value.
Userspace have the ultimate right and more capable of estimating and deciding the crashkernel value.
i was planning previously, that crashkernel value decision will be composed of two parts:
- kernel's crashkernel.default value as a reference.
- kexec-tools do some estimation and adjust based on the kernel value.
This way both kernel and kexec-tools package have a say on deciding the final crashkernel value.
On the other hand, we should be able to tell if a kernel is a debug kernel or has something enabled/disabled in kexec-tools. So my idea is the default crashkernel value could act as a baseline value and we will increase/decrease the crashernel value dynamically after evaluating different cases in kexec-tools.
I totally agree, I originally wanted to enhance the "kdumpctl estimate", it will have two ways of estimating:
- Fast path: according to data collectable in first kernel (including
the crashkernel.default file).
- Slow path: do a actually kdump and collect info during the kdump
run. It need at least one reboot, which will be really slow on some big servers, it's an unanswered question if this really worth it.
Then kexec-tools can suggest, or even set the crashkernel based on the estimating. But it's undecided how the two different estimating will play together on deciding the final crashkernel value. Maybe keep using the value estimated by fast path unless user manually triggers a slow path run. (And the slow path run will be invalided after kernel upgrade, so again not sure if user will really like it, maybe just focus on development of the fast path estimate is simpler).
Actually this is something I was pondering on in the last few days, too. My trigger was looking at patch 9 from this series as it is adding the extra memory for SEV only when setting crashkernel= but not when estimating it. On the other hand do_estimate does consider some cases (like the memory required for encrypted targets) that are missing in reset_kernel. So I started thinking about how those two cases but couldn't find a proper solution yet.
The main problem I see is that 'estimate' and 'reset-crashkernel' run in completely different environments. Especially 'reset-crashkernel' is supposed to run during the installation of a kernel which leads to some problems. For example there is no dump initramfs created yet and it might not be possible to create one as the currently running kernel and the one that is installed might require different modules.
So the "perfect" solution might need to look something like this
1) boot system to run updates 2) reboot new kernel to estimate and set crashkernel= 2b) reboot for slow path (optional) 3) reboot to make use of new crashkernel= value
and that every time when installing a new kernel, which I don't think is reasonable.
That's where I'm stuck at the moment...
Thanks Philipp
Btw, do you have a list of how different factors affect the memory requirement? The list may look like this,
- debug kernel: need to increase the default crashkernel value by 30%
- SME: an extra memory of 64MB at maximum
- kernel config option CONFIG_XXX: 100MB+
- ...
I'm afraid no, it's really hard to make a table about the memory effect of each kernel component/feature.
You may need to do tons of experiments and testing to get the data, and in most time, a kenrel debug/feature config only consume a little part of the memory but a lot of such configs are enabled.
And these memory usage data will change from time to time as kernel updates, and some CONFIG combination will have more complex memory effect pattern... so I thought a crashkernel.default file set based on experience is preferred, and more doable.
This whole approach may need some simplification, eg. previously I was avoiding adding a new method of customizing crashkernel value, so grubby will still be user's first choice on customizing the crashkernel value. Grubby and the instal.d hook will take care of the management of crashkernel value, but this made the hook doing a lot of complex work. This patch adding a new config in kdump.conf, is just much cleaner, and I definitely like this more.
Maybe like you said, use the .default file as a baseline, and let kexec-tools maintain the actual value, then just cover some known cases, will be better idea. Other works can get respinned later.
And one can easily distinguish if the actual used crashkernel value is the default value of a specified kernel version, even cross OS upgrade.
I guess these cases are finally considered too rare to be covered? Decoupling it from kernel version definitely saves tons of trouble (which was almost killing me :D).
Coiby Xu (11): update default crashkernel value factor out kdump_get_arch_recommend_crashkernel provide get_default_crashkernel for kdump_anaconda_addon introduce crashkernel option to kdump.conf add a helper function to write a config value to kdump.conf add a helper function to read kernel cmdline parameter from grubby --info rewrite reset_crashkernel to provide more features for the user and to be called by kernel installation hook allow to add extra memory to crashkernel string Reserve extra memory when SME or SEV is active provide kdumpctl fadump on/off use "kdumpctl reset-crashkernel KERNELIMAGE" in kernel installation hook
92-crashkernel.install | 135 +---------------------------- kdump-lib-initramfs.sh | 9 ++ kdump-lib.sh | 95 +++++++++++++++------ kdump.conf | 6 ++ kdump.conf.5 | 7 ++ kdumpctl | 188 ++++++++++++++++++++++++++++++++++++----- kdumpctl.8 | 16 ++-- 7 files changed, 271 insertions(+), 185 deletions(-)
-- 2.31.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
-- Best regards, Coiby
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Philipp Rudo prudo@redhat.com 于2021年12月6日周一 23:47写道:
On Fri, 3 Dec 2021 21:05:11 +0800 Kairui Song ryncsn@gmail.com wrote:
Coiby Xu coxu@redhat.com 于 2021年12月3日周五 下午6:00写道:
On Wed, Dec 01, 2021 at 06:15:07PM +0800, Kairui Song wrote:
Coiby Xu coxu@redhat.com 于2021年11月19日周五 上午11:24写道:
The crashkernel=auto implementation in kernel space has been rejected upstream [1]. The current user space implementation [2] [3] ships a crashkernel.default but hasn't supported the swiotlb memory requirement, custom crashkernel value from user and fadump.
The crashkernel.default implementation seems to be overly complex, - the default crashkernel value rarely changes. This is no need to ship the same crashkernel.default default for every kernel package of a architecture; - when deciding the value of crashkernel for a new kernel, the crashkernel.default of existing kernel is took into consideration
We can simply let the kexec-tools maintain the default crashkernel values and provide an API for kdump-anacon-addon to query it. And for a newly installed kernel, we can simply call "kdumpctl reset-crashkernel KERNELPATH" to set its crashkernel value.
For the unfulfilled requirements, - crashkernel is introduced to /etc/kdump.conf for the user can set custom crashkernel value to tell kexec-tools to manage crashkernel value automatically. - "kdumpctl reset-crashkernel" has been written for the above purpose. - "kdumpctl fadump on/off" is added for supporting fadump.
[1] https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-found... [2] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171 [3] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/...
Nice idea👍, this makes thing so much cleaner.
Thanks for endorsing this idea!
I remember the per version crashkernel.default file is introduced for many purposes in mind. For example a new kernel package may enabled/disabled something so it will need a larger/smaller crashkernel value, or, eg. a variant kernel, like debug kernel, can set itself a larger value.
Hi, thanks for the reply.
@Kairui: Nice to see you active on the mailing list :)
Nice to see you too :)
I have been wondering why you ship a crashkernel.default with a kernel package, debug kernel could be one of the reasons. But kdump memory requirement could change dynamically. For example, the user could toggle SME on/off. So a static crashkernel couldn't address this dynamic change.
That's absolutely correct, kernel itself isn't capable of estimating the crashkernel value. And actually crashkernel.default wasn't suppose to play the sole role on deciding the final crashkernel value.
Userspace have the ultimate right and more capable of estimating and deciding the crashkernel value.
i was planning previously, that crashkernel value decision will be composed of two parts:
- kernel's crashkernel.default value as a reference.
- kexec-tools do some estimation and adjust based on the kernel value.
This way both kernel and kexec-tools package have a say on deciding the final crashkernel value.
On the other hand, we should be able to tell if a kernel is a debug kernel or has something enabled/disabled in kexec-tools. So my idea is the default crashkernel value could act as a baseline value and we will increase/decrease the crashernel value dynamically after evaluating different cases in kexec-tools.
I totally agree, I originally wanted to enhance the "kdumpctl estimate", it will have two ways of estimating:
- Fast path: according to data collectable in first kernel (including
the crashkernel.default file).
- Slow path: do a actually kdump and collect info during the kdump
run. It need at least one reboot, which will be really slow on some big servers, it's an unanswered question if this really worth it.
Then kexec-tools can suggest, or even set the crashkernel based on the estimating. But it's undecided how the two different estimating will play together on deciding the final crashkernel value. Maybe keep using the value estimated by fast path unless user manually triggers a slow path run. (And the slow path run will be invalided after kernel upgrade, so again not sure if user will really like it, maybe just focus on development of the fast path estimate is simpler).
Actually this is something I was pondering on in the last few days, too. My trigger was looking at patch 9 from this series as it is adding the extra memory for SEV only when setting crashkernel= but not when estimating it. On the other hand do_estimate does consider some cases (like the memory required for encrypted targets) that are missing in reset_kernel. So I started thinking about how those two cases but couldn't find a proper solution yet.
The main problem I see is that 'estimate' and 'reset-crashkernel' run in completely different environments. Especially 'reset-crashkernel' is supposed to run during the installation of a kernel which leads to some problems. For example there is no dump initramfs created yet and it might not be possible to create one as the currently running kernel and the one that is installed might require different modules.
So the "perfect" solution might need to look something like this
- boot system to run updates
- reboot new kernel to estimate and set crashkernel=
2b) reboot for slow path (optional) 3) reboot to make use of new crashkernel= value
and that every time when installing a new kernel, which I don't think is reasonable.
That's where I'm stuck at the moment...
I'm also not very sure about this, I had some other ideas previously...
First maybe the installer can just use default value for default installation, this is no way one can know what the user will use for kdump later, so installer just don't do anything special. (there is currently a special case for encrypted storage, because encrypted storage is more and more common but kdump doesn't work by default... it was suppose to be removed once the keyring can be reused across kexec, then the default value should cover most default local dump setup).
And after the installation, I was thinking about two solutions:
A. Make the crashkernel.default value set to an acceptable value, covering 99% of kdump setup.
Then kexec-tools can do a fast path (should spend about <1s) estimation every time it boot/start/restart, and print a warning if the crashkernel value is not suitable for the kdump config for special cases. It's up to user to customize the crashkernel value, kexec-tools just provide some helper.
New installer kernel either inherit the customized value or stick with default value, user is responsible for updating the value if customized.
B. Make the crashkernel.default value a large enough value to cover (almost) every cases.
kexec-tools do a estimation on boot, and frees unneeded memory. If kdump is disabled then free all. One issue is how to balance the value between big enough to cover everything and not failing boot due to OOM. Kexec-tools can still generate some warning if memory is not enough but this is suppose to be very very rare, and I doubt anyone will still want kdump if it eat that much memory.
New installed kernel just use default value, as in such case, customized value will be very rare now, and kexec-tools can warn the user seriously that after kernel upgrade, remember to redo the crashkernel value customization.
For both solution, the slow path estimation can be used to refine the estimation result, and user can also use it regularly for debug or test the crashkernel value, and do a slow path estimate for first boot might not be a bad idea. Only issue is how the slow path estimating result should be invalidated, invalidate it for every kernel upgrade seem too aggressive, invalidate it every major/minor release might be too inaccurate?
Hi
I don't understand
kdumpctl reset-crashkernel
What does this do ?
The new kdump.conf has :
auto_reset_crashkernel <yes|no>
I don't understand the usage model .
---
What if. I want to define a new crashkernel. value ? how is that down ?
crashkernel=1G-4G:126M,4G-64G:256M
Is this added to kdump.conf ?
Hi,
On Tue, Jun 14, 2022 at 02:53:35PM -0000, Jp D wrote:
Hi
I don't understand
kdumpctl reset-crashkernel
The users can run "kdumpctl reset-crashkernel" manually to reset crashkernel to the default value.
What does this do ?
The new kdump.conf has :
auto_reset_crashkernel <yes|no>
And this option is for the users to choose whether to let kexec-tools automatically reset crashkernel to new default value after kexec-tools updates its default value when kexec-tools find a kernel is using the old default value for the crashkernel parameter.
I don't understand the usage model .
One big reason we don't use "crashkernel auto/CUSTOM-VALUE" option in kdump.conf is the users may be used to set custom crashkernel value by grubby and kexec-tools tries to respect that.
What if. I want to define a new crashkernel. value ? how is that down ?
crashkernel=1G-4G:126M,4G-64G:256M
Is this added to kdump.conf ?
If you want to set custom value, you need to use tools like grubby.
kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure