In fadump mode, the crashkernel reserved area size cannot be obtained from /sys/kernel/kexec_crash_size sysfs node.
The do_estimate function has been modified to use /sys/kernel/fadump/mem_reserved to get the reserved area size for fadump mode.
Signed-off-by: Sourabh Jain sourabhjain@linux.ibm.com Reported-by: Sachin P Bappalige sachinpb@linux.vnet.ibm.com --- kdumpctl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 7e561fd..7580ab0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1270,7 +1270,12 @@ do_estimate() # The default pre-reserved crashkernel value baseline_size=$((baseline * size_mb)) # Current reserved crashkernel size - reserved_size=$(< /sys/kernel/kexec_crash_size) + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + reserved_size=$(< /sys/kernel/fadump/mem_reserved) + else + reserved_size=$(< /sys/kernel/kexec_crash_size) + fi + # A pre-estimated value for userspace usage and kernel # runtime allocation, 64M should good for most cases runtime_size=$((64 * size_mb)) -- 2.41.0
Hello,
Pasting the ouput of *kdumpctl estimate* for better understanding of this patch:
Kernel command-line: ==================
[root@ ~]# cat /proc/cmdline BOOT_IMAGE=(ieee1275//vdevice/v-scsi@30000071/disk@8100000000000000,msdos2)/vmlinuz-5.14.0-333.el9.ppc64le root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel-root rd.lvm.lv=rhel/swap biosdevname=0 crashkernel=1024M fadump=on
without this patch: ===============
[root]# kdumpctl estimate kdump: Dump mode is fadump kdump: Backing up /boot/initramfs-5.14.0-333.el9.ppc64le.img before rebuild. Reserved crashkernel: 0M Recommended crashkernel: 768M
Kernel image size: 46M Kernel modules size: 0M Initramfs size: 57M Runtime reservation: 64M Large modules: <none> WARNING: Current crashkernel size is lower than recommended size 768M
With this patch: =============
[root]# kdumpctl estimate kdump: Dump mode is fadump Reserved crashkernel: 1024M Recommended crashkernel: 768M
Kernel image size: 46M Kernel modules size: 0M Initramfs size: 57M Runtime reservation: 64M Large modules: <none>
The system has reserved 1024M for crash kernel, and kdumpctl estimate reporting *Reserved crashkernel* correctly with this patch.
Thanks, Sourabh Jain
On 24/07/23 12:21, Sourabh Jain wrote:
In fadump mode, the crashkernel reserved area size cannot be obtained from /sys/kernel/kexec_crash_size sysfs node.
The do_estimate function has been modified to use /sys/kernel/fadump/mem_reserved to get the reserved area size for fadump mode.
Signed-off-by: Sourabh Jain sourabhjain@linux.ibm.com Reported-by: Sachin P Bappalige sachinpb@linux.vnet.ibm.com
kdumpctl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 7e561fd..7580ab0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1270,7 +1270,12 @@ do_estimate() # The default pre-reserved crashkernel value baseline_size=$((baseline * size_mb)) # Current reserved crashkernel size
- reserved_size=$(< /sys/kernel/kexec_crash_size)
- if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
reserved_size=$(< /sys/kernel/fadump/mem_reserved)
- else
reserved_size=$(< /sys/kernel/kexec_crash_size)
- fi
- # A pre-estimated value for userspace usage and kernel # runtime allocation, 64M should good for most cases runtime_size=$((64 * size_mb))
-- 2.41.0 _______________________________________________ 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, report it: https://pagure.io/fedora-infrastructure/new_issue
Hi Sourabh,
thanks for the patch. All in all it looks sane to me. There are two nits/questions I have though.
On Mon, 24 Jul 2023 12:21:19 +0530 Sourabh Jain sourabhjain@linux.ibm.com wrote:
In fadump mode, the crashkernel reserved area size cannot be obtained from /sys/kernel/kexec_crash_size sysfs node.
The do_estimate function has been modified to use /sys/kernel/fadump/mem_reserved to get the reserved area size for fadump mode.
Signed-off-by: Sourabh Jain sourabhjain@linux.ibm.com Reported-by: Sachin P Bappalige sachinpb@linux.vnet.ibm.com
^^^^ 1) is this email address correct? I thought the .vnet. addresses were decommissioned years ago.
2) There are two more places where we read from /sys/kernel/kexec_crash_size which needs to be fixed (one in kdumpctl:show_reserved_mem and the other in kdump-lib.sh:check_crash_mem_reserved). Personally I think it makes more sense to move the read into a separate function and call that when in those three locations. This at least prevents the same bug to be re-introduced in the future.
Thanks Philipp
kdumpctl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl index 7e561fd..7580ab0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1270,7 +1270,12 @@ do_estimate() # The default pre-reserved crashkernel value baseline_size=$((baseline * size_mb)) # Current reserved crashkernel size
- reserved_size=$(< /sys/kernel/kexec_crash_size)
- if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
reserved_size=$(< /sys/kernel/fadump/mem_reserved)
- else
reserved_size=$(< /sys/kernel/kexec_crash_size)
- fi
- # A pre-estimated value for userspace usage and kernel # runtime allocation, 64M should good for most cases runtime_size=$((64 * size_mb))
-- 2.41.0 _______________________________________________ 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, report it: https://pagure.io/fedora-infrastructure/new_issue
Hello Philipp,
Thanks for reviewing the patch.
On 31/07/23 19:04, Philipp Rudo wrote:
Hi Sourabh,
thanks for the patch. All in all it looks sane to me. There are two nits/questions I have though.
On Mon, 24 Jul 2023 12:21:19 +0530 Sourabh Jain sourabhjain@linux.ibm.com wrote:
In fadump mode, the crashkernel reserved area size cannot be obtained from /sys/kernel/kexec_crash_size sysfs node.
The do_estimate function has been modified to use /sys/kernel/fadump/mem_reserved to get the reserved area size for fadump mode.
Signed-off-by: Sourabh Jain sourabhjain@linux.ibm.com Reported-by: Sachin P Bappalige sachinpb@linux.vnet.ibm.com
^^^^
- is this email address correct? I thought the .vnet. addresses were
decommissioned years ago.
I requested the bug reporter to provide his email, and this is what he gave me. I will double check with the bug report before sending v2.
- There are two more places where we read from
/sys/kernel/kexec_crash_size which needs to be fixed (one in kdumpctl:show_reserved_mem and the other in kdump-lib.sh:check_crash_mem_reserved). Personally I think it makes more sense to move the read into a separate function and call that when in those three locations. This at least prevents the same bug to be re-introduced in the future.
Sure I will introduce a function to get reserved area based on the dump mode.
Thanks, Sourabh