Use KDUMP_COMMANDLINE_REMOVE config instead of hardcode them in
kdumpctl, which makes it possible system admins decide what params to
remove such as "quiet" or other debug flags.
This patch also adds backward compatibility even if an old config is
used. It will behave the same as the old version.
Signed-off-by: Dangyi Liu <dliu(a)redhat.com>
Cc: Baoquan He <bhe(a)redhat.com>
Cc: Dave Young <dyoung(a)redhat.com>
---
Changes:
v2->v3: Always remove crashkernel and panic_on_warn
v1->v2: Add compatibility; describle the order to process cmdline
kdump.sysconfig | 7 ++++++-
kdump.sysconfig.i386 | 7 ++++++-
kdump.sysconfig.ppc64 | 7 ++++++-
kdump.sysconfig.ppc64le | 7 ++++++-
kdump.sysconfig.s390x | 7 ++++++-
kdump.sysconfig.x86_64 | 7 ++++++-
kdumpctl | 9 +++++++--
7 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/kdump.sysconfig b/kdump.sysconfig
index effe466..d44c8ae 100644
--- a/kdump.sysconfig
+++ b/kdump.sysconfig
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices"
# Any additional kexec arguments required. In most situations, this should
diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386
index bb7a6e5..37d1b96 100644
--- a/kdump.sysconfig.i386
+++ b/kdump.sysconfig.i386
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never"
# Any additional kexec arguments required. In most situations, this should
diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64
index dd09598..3d4db57 100644
--- a/kdump.sysconfig.ppc64
+++ b/kdump.sysconfig.ppc64
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never"
# Any additional kexec arguments required. In most situations, this should
diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le
index dd09598..3d4db57 100644
--- a/kdump.sysconfig.ppc64le
+++ b/kdump.sysconfig.ppc64le
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 rootflags=nofail kvm_cma_resv_ratio=0 transparent_hugepage=never"
# Any additional kexec arguments required. In most situations, this should
diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x
index b103a88..96b3d1b 100644
--- a/kdump.sysconfig.s390x
+++ b/kdump.sysconfig.s390x
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 rootflags=nofail transparent_hugepage=never"
# Any additional /sbin/mkdumprd arguments required.
diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64
index 7991d68..5faab65 100644
--- a/kdump.sysconfig.x86_64
+++ b/kdump.sysconfig.x86_64
@@ -14,8 +14,13 @@ KDUMP_KERNELVER=""
# /proc/cmdline
KDUMP_COMMANDLINE=""
+# This variable lets us remove arguments from the current kdump commandline
+# as taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# NOTE: some arguments such as crashkernel will always be removed
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
# This variable lets us append arguments to the current kdump commandline
-# As taken from either KDUMP_COMMANDLINE above, or from /proc/cmdline
+# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 rootflags=nofail acpi_no_memhotplug transparent_hugepage=never"
# Any additional kexec arguments required. In most situations, this should
diff --git a/kdumpctl b/kdumpctl
index 9f7e56b..ef18a2d 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -19,6 +19,9 @@ DEFAULT_DUMP_MODE="kdump"
standard_kexec_args="-p"
+# Some default values in case /etc/sysconfig/kdump doesn't include
+KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
+
if [ -f /etc/sysconfig/kdump ]; then
. /etc/sysconfig/kdump
fi
@@ -105,8 +108,10 @@ prepare_cmdline()
else
cmdline=${KDUMP_COMMANDLINE}
fi
- cmdline=`remove_cmdline_param "$cmdline" crashkernel hugepages hugepagesz panic_on_warn slub_debug`
-
+ # These params should always be removed
+ cmdline=`remove_cmdline_param "$cmdline" crashkernel panic_on_warn`
+ # These params can be removed configurably
+ cmdline=`remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE}`
cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
--
2.5.0