[PATCH v3 0/4] Add support for crashkernel.default
by Kairui Song
In RHEL, kernel supports a `crashkernel=auto` param and when it's used,
kernel will use its built-in default value as the crashkernel value.
But upstream doesn't like this idea. [1]
`crashkernel=auto` was introduced to provide user a default value, and
make it possible to update the crashkernel value automatically as kernel
package updates if user is using the default `auto` value.
After more discussion, `crashkernel=auto` will be dropped. To track
the default crashkernel value, kernel package will include a
crashkernel.default file with it[2], and kexec-tools can make use of
that file, update kernel's boot cmdline accordingly, and help user to
reset the crashkernel value to default value.
[1]: https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-fo...
[2]: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171
Update from V2:
- Update the doc as suggested by Baoquan
- Fix some comment and code issues in 92-crashkernel.install
Update from V1:
- Add support for ostree
- Add a crashkernel-howto.txt
- Change crashkernel.conf to crashkernel.default
Kairui Song (4):
Revert "kdump-lib.sh: Remove is_atomic"
kdumpctl: Add kdumpctl reset-crashkernel
Add a new hook: 92-crashkernel.install
Add a crashkernel-howto.conf doc
92-crashkernel.install | 143 +++++++++++++++++++++++++++++
crashkernel-howto.conf | 204 +++++++++++++++++++++++++++++++++++++++++
kdump-lib.sh | 5 +
kdumpctl | 41 ++++++++-
kdumpctl.8 | 9 ++
kexec-tools.spec | 7 ++
6 files changed, 407 insertions(+), 2 deletions(-)
create mode 100755 92-crashkernel.install
create mode 100644 crashkernel-howto.conf
--
2.31.1
2 years, 8 months
[PATCH v2 0/4] Add support for crashkernel.default
by Kairui Song
In RHEL, kernel supports a `crashkernel=auto` param and when it's used,
kernel will use its built-in default value as the crashkernel value.
But upstream doesn't like this idea. [1]
`crashkernel=auto` was introduced to provide user a default value, and
make it possible to update the crashkernel value automatically as kernel
package updates if user is using the default `auto` value.
After more discussion, `crashkernel=auto` will be dropped. To track
the default crashkernel value, kernel package will include a
crashkernel.default file with it[2], and kexec-tools can make use of
that file, update kernel's boot cmdline accordingly, and help user to
reset the crashkernel value to default value.
[1]: https://lore.kernel.org/linux-mm/20210507010432.IN24PudKT%25akpm@linux-fo...
[2]: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1171
Update from V1:
- Add support for ostree
- Add a crashkernel-howto.txt
- Change crashkernel.conf to crashkernel.default
Kairui Song (4):
Revert "kdump-lib.sh: Remove is_atomic"
kdumpctl: Add kdumpctl reset-crashkernel
Add a new hook: 92-crashkernel.install
Add a crashkernel-howto.conf doc
92-crashkernel.install | 131 +++++++++++++++++++++++++++++++++++++++++
crashkernel-howto.conf | 113 +++++++++++++++++++++++++++++++++++
kdump-lib.sh | 5 ++
kdumpctl | 41 ++++++++++++-
kdumpctl.8 | 9 +++
kexec-tools.spec | 7 +++
6 files changed, 304 insertions(+), 2 deletions(-)
create mode 100755 92-crashkernel.install
create mode 100644 crashkernel-howto.conf
--
2.31.1
2 years, 9 months
[PATCH] kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
by Kairui Song
The new `crashkernel.default` file in kernel package can be used as the
ck_cmdline source.
Also keep the legacy code so old kernel packages will still work.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib.sh | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index df0aa02..4bd9751 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -952,31 +952,40 @@ get_recommend_size()
}
# 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()
{
- if ! [[ -r "/proc/iomem" ]] ; then
+ local kernel=$1 arch
+
+ if ! [ -r "/proc/iomem" ] ; then
echo "Error, can not access /proc/iomem."
return 1
fi
- 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"
- 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"
+
+ [ -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:160M,4G-64G:192M,64G-1T:256M,1T-: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=$(echo $ck_cmdline | sed -e 's/-:/-102400T:/g')
sys_mem=$(get_system_size)
- result=$(get_recommend_size $sys_mem "$ck_cmdline")
- echo $result
- return 0
+
+ get_recommend_size "$sys_mem" "$ck_cmdline"
}
# Print all underlying crypt devices of a block device
--
2.31.1
2 years, 9 months