From 5309c08efa1a694b38d2881afd9faffca6a7af70 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Nov 01 2022 02:38:40 +0000 Subject: Include the memory overhead cost of cryptsetup when estimating the memory requirement for LUKS-encrypted target Resolves: bz2076206 Upstream: Fedora Conflict: None commit 6ce4b85bb3ed6c97beda9ee4774e0924afbbf58a Author: Coiby Xu Date: Mon Sep 5 18:08:44 2022 +0800 Include the memory overhead cost of cryptsetup when estimating the memory requirement for LUKS-encrypted target Currently, "kdumpctl estimate" neglects the memory overhead cost of cryptsetup itself. Unfortunately, there is no golden formula to calculate the overhead cost [1]. So estimate the overhead cost as 50M for aarch64 and 20M for other architectures based on the following empirical data, | Overhead (M) | OS | arch | | ------------ | ----------------------------------------- | ------- | | 14.1 | RHEL-9.2.0-20220829.d.1 | ppc64le | | 14 | Fedora-37-20220830.n.0 Everything ppc64le | ppc64le | | 17 | Fedora 36 | ppc64le | | 8.8 | Fedora 35 | s390x | | 10.1 | Fedora-Rawhide-20220829.n.0, fc38 | s390x | | 42 | Fedora-Rawhide-20220829.n.0, fc38 | arch64 | | 40 | F35 | arch64 | | 42 | F36 | arch64 | | 42 | Fedora-Rawhide-20220901.n.0 | arch64 | | 10 | F35 | x86_64 | | 10 | Fedora-Rawhide-20220901.n.0 | x86_64 | | 11 | Fedora-Rawhide-20220901.n.0 | x86_64 | [1] https://lore.kernel.org/cryptsetup/20220616044339.376qlipk5h2omhx2@Rk/T/#u Fixes: e9e6a2c ("kdumpctl: Add kdumpctl estimate") Signed-off-by: Coiby Xu Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu --- diff --git a/kdumpctl b/kdumpctl index 1a0bd6d..fcbf899 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1220,7 +1220,7 @@ do_estimate() local kdump_mods local -A large_mods local baseline - local kernel_size mod_size initrd_size baseline_size runtime_size reserved_size estimated_size recommended_size + local kernel_size mod_size initrd_size baseline_size runtime_size reserved_size estimated_size recommended_size _cryptsetup_overhead local size_mb=$((1024 * 1024)) setup_initrd @@ -1274,7 +1274,17 @@ do_estimate() break done done - [[ $crypt_size -ne 0 ]] && echo -e "Encrypted kdump target requires extra memory, assuming using the keyslot with maximum memory requirement\n" + + if [[ $crypt_size -ne 0 ]]; then + if [[ $(uname -m) == aarch64 ]]; then + _cryptsetup_overhead=50 + else + _cryptsetup_overhead=20 + fi + + crypt_size=$((crypt_size + _cryptsetup_overhead * size_mb)) + echo -e "Encrypted kdump target requires extra memory, assuming using the keyslot with maximum memory requirement\n" + fi estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size + crypt_size)) if [[ $baseline_size -gt $estimated_size ]]; then