diff --git a/0012-powerpc-consider-CPU-count-while-calculating-crashke.patch b/0012-powerpc-consider-CPU-count-while-calculating-crashke.patch new file mode 100644 index 0000000..8ef1840 --- /dev/null +++ b/0012-powerpc-consider-CPU-count-while-calculating-crashke.patch @@ -0,0 +1,82 @@ +From 0d389855086ca3f1de8421c540ade79d403e1abd 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 | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/kdump-lib.sh b/kdump-lib.sh +index 61da1f7..816a6ff 100755 +--- a/kdump-lib.sh ++++ b/kdump-lib.sh +@@ -974,6 +974,36 @@ _crashkernel_add() + echo "${ret%,}" + } + ++# Parses the kdump or fadump command line to extract a valid ++# positive nr_cpus= value, defaulting to 1 if none is found. ++find_nr_cpus() ++{ ++ local _cmdline_append ++ local _nr_cpus=1 ++ ++ # shellcheck disable=SC2153 ++ if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then ++ _cmdline_append="$FADUMP_COMMANDLINE_APPEND" ++ else ++ _cmdline_append="$KDUMP_COMMANDLINE_APPEND" ++ fi ++ ++ for arg in $_cmdline_append; do ++ case $arg in ++ nr_cpus=[0-9]*) ++ # Only accept if it's strictly digits after '=' ++ value=${arg#nr_cpus=} ++ if [[ $value =~ ^[1-9][0-9]*$ ]]; then ++ _nr_cpus=$value ++ fi ++ ;; ++ esac ++ done ++ ++ 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 +@@ -1024,6 +1054,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 +-- +2.49.0 + diff --git a/0013-powerpc-Set-nr_cpus-16-for-kdump-kernel.patch b/0013-powerpc-Set-nr_cpus-16-for-kdump-kernel.patch new file mode 100644 index 0000000..0b68548 --- /dev/null +++ b/0013-powerpc-Set-nr_cpus-16-for-kdump-kernel.patch @@ -0,0 +1,26 @@ +From 2f360e819ae7b80347c567c29a9ead979edb6ed3 Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Tue, 16 Dec 2025 11:02:33 +0800 +Subject: [PATCH] powerpc: Set nr_cpus=16 for kdump kernel + +Signed-off-by: Pingfan Liu +--- + 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 eb5287b..53115c1 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" + ;; +-- +2.49.0 + diff --git a/kdump-utils.spec b/kdump-utils.spec index e5261bc..c36dfab 100644 --- a/kdump-utils.spec +++ b/kdump-utils.spec @@ -19,6 +19,9 @@ Patch08: 0008-Add-persisent-device-if-FIPS-is-enabled.patch Patch09: 0009-kdump.sh-Centralize-the-F-suboption-handling.patch Patch10: 0010-kdump.sh-Centralize-the-num-threads-sub-option-handl.patch Patch11: 0011-kdump.sh-Skip-num-threads-when-E-and-F-option-is-pre.patch +Patch12: 0012-powerpc-consider-CPU-count-while-calculating-crashke.patch +Patch13: 0013-powerpc-Set-nr_cpus-16-for-kdump-kernel.patch + %ifarch ppc64 ppc64le Requires(post): servicelog