kdump/kdump-0.8.7-nr_cpus.patch
Petr Tesařík a57f5f77de Accepting request 222378 from home:ptesarik:branches:Kernel:kdump
- kdump-0.8.7-nr_cpus.patch: Use nr_cpus instead of maxcpus with
  recent kernels. (FATE#315725).
- kdump-0.8.7-bsp.patch: Add disable_cpu_apicid for BSP to the
  commandline (bnc#861981).
- kdump-0.8.7-calibrate.patch: Implement kdump memory calibration
  (FATE#315241).

OBS-URL: https://build.opensuse.org/request/show/222378
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=57
2014-02-14 16:18:09 +00:00

65 lines
1.7 KiB
Diff

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Use nr_cpus instead of maxcpus with recent kernels.
References: FATE#315725
Patch-mainline: v0.8.8
Linux 2.6.34+ has nr_cpus, which limits the number of possible CPUs
(unlike maxcpus, which only limits the number of online CPUs at boot).
For compatibility, use maxcpus with older kernels.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
NEWS | 4 ++++
init/rc.kdump.functions | 18 +++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+0.8.8
+-----
+ * Use nr_cpus instead of maxcpus with recent kernels.
+
0.8.7
-----
* Change libelf interface to elfutils (libelf1)
--- a/init/rc.kdump.functions
+++ b/init/rc.kdump.functions
@@ -75,9 +75,25 @@ function remove_from_commandline()
}
#
+# Get the name of kernel parameter to limit CPUs
+# Linux 2.6.34+ has nr_cpus, older versions must use maxcpus
+function cpus_param()
+{
+ local version=$(get_kernel_version "$1")
+ version="${version%%-*}"
+ local verhex=$(IFS=. ; set -- $version ; printf "0x%02x%02x%02x" $1 $2 $3)
+ if [ $(( $verhex )) -ge $(( 0x020622 )) ] ; then
+ echo nr_cpus
+ else
+ echo maxcpus
+ fi
+}
+
+#
# Builds the kdump command line from KDUMP_COMMANDLINE.
function build_kdump_commandline()
{
+ local kdump_kernel="$1"
local commandline="$KDUMP_COMMANDLINE"
if [ -z "$commandline" ]; then
@@ -168,7 +184,7 @@ function load_kdump_kexec()
rc_exit
fi
- local kdump_commandline=$(build_kdump_commandline)
+ local kdump_commandline=$(build_kdump_commandline "$kdump_kernel")
local kexec_options=$(build_kexec_options "$kdump_kernel")
KEXEC_CALL="$KEXEC -p $kdump_kernel --append=\"$kdump_commandline\""