From 01865571b73207b28973ac4de343b23c01eabcc6 Mon Sep 17 00:00:00 2001 From: Sourabh Jain Date: Sat, 23 Aug 2025 22:29:10 +0530 Subject: [PATCH 1/2] powerpc: consider CPU count while calculating crashkernel value The next patch in the series adds more CPUs to the capture kernel, which increases the memory requirement for the capture kernel. Experiments show that powerpc needs 1 MB of additional memory for every CPU added. Therefore, while calculating the crashkernel size, make sure to include an additional 1 MB for every CPU configured in the capture kernel. The changes are implemented in such a way that if the user changes the nr_cpus value in the kdump configuration, the script will adapt accordingly. Signed-off-by: Sourabh Jain --- kdump-lib.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/kdump-lib.sh b/kdump-lib.sh index 232d065f..48ea222b 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -975,6 +975,24 @@ _crashkernel_add() echo "${ret%,}" } + +find_nr_cpus() +{ + local _cmdline_append + local _nr_cpus + + # shellcheck disable=SC2153 + if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then + _cmdline_append="$FADUMP_COMMANDLINE_APPEND" + else + _cmdline_append="$KDUMP_COMMANDLINE_APPEND" + fi + _nr_cpus=$(echo "$_cmdline_append" | sed -n 's/.*nr_cpus=\([0-9]\+\).*/\1/p') + ddebug "Configured nr_cpus=$_nr_cpus" + echo "$_nr_cpus" +} + + # get default crashkernel # $1 dump mode, if not specified, dump_mode will be judged by is_fadump_capable # $2 kernel-release, if not specified, got by _get_kdump_kernel_version @@ -1025,6 +1043,14 @@ kdump_get_arch_recommend_crashkernel() has_mlx5 && ((_delta += 150)) fi elif [[ $_arch == "ppc64le" ]]; then + local _per_cpu_area + local _nr_cpus + + # 1MB per CPU + _per_cpu_area=1 + _nr_cpus=$(find_nr_cpus) + + _delta=$(( _delta + _per_cpu_area * _nr_cpus )) 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 From 3fca33447d583525acc6f4251a85fa3dc7893042 Mon Sep 17 00:00:00 2001 From: Sourabh Jain Date: Sat, 23 Aug 2025 22:35:06 +0530 Subject: [PATCH 2/2] powerpc: Set nr_cpus=16 for kdump kernel Configure the kdump kernel with nr_cpus=16 to enable multi-threading in the makedumpfile core collector, allowing faster dump collection. Commit d428557fc2b59 ("Use all available CPUs to collect dump") introduced multi-threading support in the core collector. There are two reasons for choosing nr_cpus=16: - Multiple experiments show that optimal performance is achieved when nr_cpus is between 16 and 30. The graph in commit d428557fc2b59 supports this. - nr_cpus=16 is already used for the fadump kernel, so using the same value for kdump to maintain consistency. Signed-off-by: Sourabh Jain --- gen-kdump-sysconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen-kdump-sysconfig.sh b/gen-kdump-sysconfig.sh index eb5287bd..53115c19 100755 --- a/gen-kdump-sysconfig.sh +++ b/gen-kdump-sysconfig.sh @@ -100,7 +100,7 @@ ppc64le) update_param KDUMP_COMMANDLINE_REMOVE \ "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma ignition.firstboot" update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll nr_cpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 kfence.sample_interval=0" + "irqpoll nr_cpus=16 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 kfence.sample_interval=0" update_param FADUMP_COMMANDLINE_APPEND \ "nr_cpus=16 numa=off cgroup_disable=memory cma=0 kvm_cma_resv_ratio=0 hugetlb_cma=0 transparent_hugepage=never novmcoredd udev.children-max=2" ;;