Allow _crashkernel_add to address larger memory ranges
Resolves: https://issues.redhat.com/browse/RHEL-8727 Resolves: https://issues.redhat.com/browse/RHEL-8710 Upstream: Fedora Conflict: spec/kdump-lib_spec.sh doesn't exist in RHEL, so I remove the hunk directly. commit 3d253ab81134d9f68d230aeeceb3158026b597aa Author: Coiby Xu <coxu@redhat.com> Date: Tue Oct 10 14:31:36 2023 +0800 Allow _crashkernel_add to address larger memory ranges Currently _crashkernel_add can't deal with larger memory ranges like terabyte. For example, '_crashkernel_add "128G-1T:4G" "0"' actually returns empty result. This patch allows _crashkernel_add to address terabyte, petabyte and exabyte memory ranges. Fixes: 64f2827a ("kdump-lib: Harden _crashkernel_add") Signed-off-by: Coiby Xu <coxu@redhat.com> Acked-by: Baoquan He <bhe@redhat.com> Signed-off-by: Baoquan He <bhe@redhat.com>
This commit is contained in:
parent
0778b6add9
commit
01ea017106
16
kdump-lib.sh
16
kdump-lib.sh
|
@ -993,7 +993,7 @@ has_aarch64_smmu()
|
||||||
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
|
ls /sys/devices/platform/arm-smmu-* 1> /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
is_memsize() { [[ "$1" =~ ^[+-]?[0-9]+[KkMmGg]?$ ]]; }
|
is_memsize() { [[ "$1" =~ ^[+-]?[0-9]+[KkMmGgTtPbEe]?$ ]]; }
|
||||||
|
|
||||||
# range defined for crashkernel parameter
|
# range defined for crashkernel parameter
|
||||||
# i.e. <start>-[<end>]
|
# i.e. <start>-[<end>]
|
||||||
|
@ -1024,6 +1024,18 @@ to_bytes()
|
||||||
_s=${_s::-1}
|
_s=${_s::-1}
|
||||||
_s="$((_s * 1024 * 1024 * 1024))"
|
_s="$((_s * 1024 * 1024 * 1024))"
|
||||||
;;
|
;;
|
||||||
|
T|t)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
P|p)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
|
E|e)
|
||||||
|
_s=${_s::-1}
|
||||||
|
_s="$((_s * 1024 * 1024 * 1024 * 1024 * 1024 * 1024))"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1032,7 +1044,7 @@ to_bytes()
|
||||||
|
|
||||||
memsize_add()
|
memsize_add()
|
||||||
{
|
{
|
||||||
local -a units=("" "K" "M" "G")
|
local -a units=("" "K" "M" "G" "T" "P" "E")
|
||||||
local i a b
|
local i a b
|
||||||
|
|
||||||
a=$(to_bytes "$1") || return 1
|
a=$(to_bytes "$1") || return 1
|
||||||
|
|
Loading…
Reference in New Issue