From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com --- kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +TEMPLATE=$1 +ARCH=$2 +SED_EXP="" + +update_param() +{ + SED_EXP="${SED_EXP}s/^$1=.*$/$1="$2"/;" +} + +case "$ARCH" in +aarch64) + update_param KEXEC_ARGS "-s" + update_param KDUMP_COMMANDLINE_APPEND \ + "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0" + ;; +i386) + update_param KDUMP_COMMANDLINE_APPEND \ + "irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0" + ;; +ppc64) + update_param KDUMP_COMMANDLINE_REMOVE \ + "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" + update_param KDUMP_COMMANDLINE_APPEND \ + "irqpoll maxcpus=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" + update_param KEXEC_ARGS "--dt-no-old-root" + ;; +ppc64le) + update_param KDUMP_COMMANDLINE_REMOVE \ + "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" + update_param KDUMP_COMMANDLINE_APPEND \ + "irqpoll maxcpus=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" + update_param KEXEC_ARGS "--dt-no-old-root -s" + ;; +s390x) + update_param KDUMP_COMMANDLINE_REMOVE \ + "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt" + update_param KDUMP_COMMANDLINE_APPEND \ + "nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0" + update_param KEXEC_ARGS "-s" + ;; +x86_64) + update_param KDUMP_COMMANDLINE_APPEND \ + "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0" + update_param KEXEC_ARGS \ + "-s" + ;; +esac + +sed "$SED_EXP" "$TEMPLATE" diff --git a/kdump.sysconfig.aarch64 b/kdump.sysconfig.aarch64 deleted file mode 100644 index 67a2af7..0000000 --- a/kdump.sysconfig.aarch64 +++ /dev/null @@ -1,53 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb cma hugetlb_cma" - -# This variable lets us append arguments to the current kdump commandline -# after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="-s" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kdump.sysconfig.i386 b/kdump.sysconfig.i386 deleted file mode 100644 index 7e18c1c..0000000 --- a/kdump.sysconfig.i386 +++ /dev/null @@ -1,56 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb cma hugetlb_cma" - -# This variable lets us append arguments to the current kdump commandline -# after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -#What is the images extension. Relocatable kernels don't have one -KDUMP_IMG_EXT="" - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kdump.sysconfig.ppc64 b/kdump.sysconfig.ppc64 deleted file mode 100644 index ebb22f6..0000000 --- a/kdump.sysconfig.ppc64 +++ /dev/null @@ -1,58 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb hugetlb_cma" - -# This variable lets us append arguments to the current kdump commandline -# 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 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="--dt-no-old-root" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -#What is the images extension. Relocatable kernels don't have one -KDUMP_IMG_EXT="" - -#Specify the action after failure - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kdump.sysconfig.ppc64le b/kdump.sysconfig.ppc64le deleted file mode 100644 index 270a2cf..0000000 --- a/kdump.sysconfig.ppc64le +++ /dev/null @@ -1,58 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb hugetlb_cma" - -# This variable lets us append arguments to the current kdump commandline -# 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 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="--dt-no-old-root -s" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -#What is the images extension. Relocatable kernels don't have one -KDUMP_IMG_EXT="" - -#Specify the action after failure - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kdump.sysconfig.s390x b/kdump.sysconfig.s390x deleted file mode 100644 index 234cfe9..0000000 --- a/kdump.sysconfig.s390x +++ /dev/null @@ -1,59 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt" - -# This variable lets us append arguments to the current kdump commandline -# after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0" - -# Any additional /sbin/mkdumprd arguments required. -MKDUMPRD_ARGS="" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="-s" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -#What is the images extension. Relocatable kernels don't have one -KDUMP_IMG_EXT="" - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kdump.sysconfig b/kdump.sysconfig.template similarity index 96% rename from kdump.sysconfig rename to kdump.sysconfig.template index 70ebf04..39b1bdf 100644 --- a/kdump.sysconfig +++ b/kdump.sysconfig.template @@ -36,6 +36,9 @@ KEXEC_ARGS="" #What is the image type used for kdump KDUMP_IMG="vmlinuz"
+#What is the images extension. Relocatable kernels don't have one +KDUMP_IMG_EXT="" + # Logging is controlled by following variables in the first kernel: # - @var KDUMP_STDLOGLVL - logging level to standard error (console output) # - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) diff --git a/kdump.sysconfig.x86_64 b/kdump.sysconfig.x86_64 deleted file mode 100644 index 188ba3c..0000000 --- a/kdump.sysconfig.x86_64 +++ /dev/null @@ -1,56 +0,0 @@ -# Kernel Version string for the -kdump kernel, such as 2.6.13-1544.FC5kdump -# If no version is specified, then the init script will try to find a -# kdump kernel with the same version number as the running kernel. -KDUMP_KERNELVER="" - -# The kdump commandline is the command line that needs to be passed off to -# the kdump kernel. This will likely match the contents of the grub kernel -# line. For example: -# KDUMP_COMMANDLINE="ro root=LABEL=/" -# Dracut depends on proper root= options, so please make sure that appropriate -# root= options are copied from /proc/cmdline. In general it is best to append -# command line options using "KDUMP_COMMANDLINE_APPEND=". -# If a command line is not specified, the default will be taken from -# /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 quiet log_buf_len swiotlb cma hugetlb_cma" - -# This variable lets us append arguments to the current kdump commandline -# 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 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0" - -# Any additional kexec arguments required. In most situations, this should -# be left empty -# -# Example: -# KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="-s" - -#Where to find the boot image -#KDUMP_BOOTDIR="/boot" - -#What is the image type used for kdump -KDUMP_IMG="vmlinuz" - -#What is the images extension. Relocatable kernels don't have one -KDUMP_IMG_EXT="" - -# Logging is controlled by following variables in the first kernel: -# - @var KDUMP_STDLOGLVL - logging level to standard error (console output) -# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command) -# - @var KDUMP_KMSGLOGLVL - logging level to /dev/kmsg (only for boot-time) -# -# In the second kernel, kdump will use the rd.kdumploglvl option to set the -# log level in the above KDUMP_COMMANDLINE_APPEND. -# - @var rd.kdumploglvl - logging level to syslog (by logger command) -# - for example: add the rd.kdumploglvl=3 option to KDUMP_COMMANDLINE_APPEND -# -# Logging levels: no logging(0), error(1),warn(2),info(3),debug(4) -# -# KDUMP_STDLOGLVL=3 -# KDUMP_SYSLOGLVL=0 -# KDUMP_KMSGLOGLVL=0 diff --git a/kexec-tools.spec b/kexec-tools.spec index db6374c..08957b7 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -11,10 +11,8 @@ Summary: The kexec/kdump userspace component
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%%7Bname%7D-%%7Bversion%7D.ta... Source1: kdumpctl -Source2: kdump.sysconfig -Source3: kdump.sysconfig.x86_64 -Source4: kdump.sysconfig.i386 -Source5: kdump.sysconfig.ppc64 +Source2: kdump.sysconfig.template +Source3: kdump-gen-sysconfig.sh Source7: mkdumprd Source8: kdump.conf Source9: https://github.com/makedumpfile/makedumpfile/archive/%%7Bmkdf_ver%7D/makedum... @@ -25,18 +23,15 @@ Source13: 98-kexec.rules Source14: 98-kexec.rules.ppc64 Source15: kdump.conf.5 Source16: kdump.service -Source18: kdump.sysconfig.s390x Source19: https://github.com/lucchouina/eppic/archive/%%7Beppic_ver%7D/eppic-%%7Beppic... Source20: kdump-lib.sh Source21: kdump-in-cluster-environment.txt Source22: kdump-dep-generator.sh Source23: kdump-lib-initramfs.sh -Source24: kdump.sysconfig.ppc64le Source25: kdumpctl.8 Source26: live-image-kdump-howto.txt Source27: early-kdump-howto.txt Source28: kdump-udev-throttler -Source29: kdump.sysconfig.aarch64 Source30: 60-kdump.install Source31: kdump-logger.sh Source32: mkfadumprd @@ -152,6 +147,9 @@ cp %{SOURCE26} . cp %{SOURCE27} . cp %{SOURCE34} .
+# Generate sysconfig file +%{SOURCE3} %{SOURCE2} %{_target_cpu} > kdump.sysconfig + make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 make -C eppic-%{eppic_ver}/libeppic @@ -183,13 +181,9 @@ install -m 755 build/sbin/vmcore-dmesg $RPM_BUILD_ROOT/usr/sbin/vmcore-dmesg install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/ install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
-SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_target_cpu} -[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig.%{_arch} -[ -f $SYSCONFIG ] || SYSCONFIG=$RPM_SOURCE_DIR/kdump.sysconfig -install -m 644 $SYSCONFIG $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump - install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf +install -m 644 kdump.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8 install -m 644 %{SOURCE25} $RPM_BUILD_ROOT%{_mandir}/man8/kdumpctl.8
Hi Kairui,
great idea!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
- SED_EXP="${SED_EXP}s/^$1=.*$/$1="$2"/;"
+}
+case "$ARCH" in +aarch64)
- update_param KEXEC_ARGS "-s"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
- ;;
+i386)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
- ;;
+ppc64)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root"
- ;;
+ppc64le)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root -s"
- ;;
+s390x)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
- update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS "-s"
- ;;
+x86_64)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS \
"-s"
- ;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Thanks Philipp
+esac
+sed "$SED_EXP" "$TEMPLATE"
One more nit...
On Mon, 25 Apr 2022 15:18:47 +0200 Philipp Rudo prudo@redhat.com wrote:
Hi Kairui,
great idea!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
- SED_EXP="${SED_EXP}s/^$1=.*$/$1="$2"/;"
+}
+case "$ARCH" in +aarch64)
- update_param KEXEC_ARGS "-s"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
- ;;
+i386)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
- ;;
+ppc64)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root"
- ;;
+ppc64le)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root -s"
- ;;
+s390x)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
- update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS "-s"
- ;;
+x86_64)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS \
"-s"
- ;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Thanks Philipp
+esac
+sed "$SED_EXP" "$TEMPLATE"
... If SED_EXP is empty sed will fail with an error. So to be fully save the last line should probably be changed to something like
if [[ -n $SED_EXP ]]; then sed "$SED_EXP" "$TEMPLATE" else cat $TEMPLATE fi
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:32写道:
One more nit...
On Mon, 25 Apr 2022 15:18:47 +0200 Philipp Rudo prudo@redhat.com wrote:
Hi Kairui,
great idea!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
- SED_EXP="${SED_EXP}s/^$1=.*$/$1="$2"/;"
+}
+case "$ARCH" in +aarch64)
- update_param KEXEC_ARGS "-s"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
- ;;
+i386)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
- ;;
+ppc64)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root"
- ;;
+ppc64le)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
- update_param KEXEC_ARGS "--dt-no-old-root -s"
- ;;
+s390x)
- update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
- update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS "-s"
- ;;
+x86_64)
- update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
- update_param KEXEC_ARGS \
"-s"
- ;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Thanks Philipp
+esac
+sed "$SED_EXP" "$TEMPLATE"
... If SED_EXP is empty sed will fail with an error. So to be fully save the last line should probably be changed to something like
if [[ -n $SED_EXP ]]; then sed "$SED_EXP" "$TEMPLATE" else cat $TEMPLATE fi
Hmm, it seems `sed "" <file>` will not raise an error but simple cat the file, I tested with GNU sed 4.8 and BSD sed, both works.
Did you test it? Maybe I can add a comment here if it actually works, no need to add extra if/cat.
Hi Kairui,
On Tue, 26 Apr 2022 22:06:36 +0800 Kairui Song ryncsn@gmail.com wrote:
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:32写道:
One more nit...
On Mon, 25 Apr 2022 15:18:47 +0200 Philipp Rudo prudo@redhat.com wrote:
Hi Kairui,
great idea!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
[...]
... If SED_EXP is empty sed will fail with an error. So to be fully save the last line should probably be changed to something like
if [[ -n $SED_EXP ]]; then sed "$SED_EXP" "$TEMPLATE" else cat $TEMPLATE fi
Hmm, it seems `sed "" <file>` will not raise an error but simple cat the file, I tested with GNU sed 4.8 and BSD sed, both works.
Did you test it? Maybe I can add a comment here if it actually works, no need to add extra if/cat.
sorry, my mistake. I didn't quote the $SED_EXP in my test script. So sed interpreted the file as expression and failed. Adding an empty expression works.
Thanks Philipp
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:18写道:
Hi Kairui,
great idea!
Thanks!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
SED_EXP="${SED_EXP}s/^$1=.*$/$1=\"$2\"/;"
+}
+case "$ARCH" in +aarch64)
update_param KEXEC_ARGS "-s"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
OK, I'll update it, I thought it's better to just keep the code simple enough, a few redundant config lines won't hurt. But after second thought, two helpers will definately make the script cleaner.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
Hmm, I remember there were some discussions about these two params some time ago but I can't recall the detail...
Look at the kernel-doc: nr_cpus= [SMP] Maximum number of processors that an SMP kernel could support. nr_cpus=n : n >= 1 limits the kernel to support 'n' processors. It could be larger than the number of already plugged CPU during bootup, later in runtime you can physically add extra cpu until it reaches n. So during boot up some boot time memory for per-cpu variables need be pre-allocated for later physical cpu hot plugging.
maxcpus= [SMP] Maximum number of processors that an SMP kernel will bring up during bootup. maxcpus=n : n >= 0 limits the kernel to bring up 'n' processors. Surely after bootup you can bring up the other plugged cpu by executing "echo 1 > /sys/devices/system/cpu/cpuX/online". So maxcpus only takes effect during system bootup. While n=0 is a special case, it is equivalent to "nosmp", which also disables the IO APIC.
So nr_cpus is a hard limit and saves percpu memory, maxcpus is not.
The doc also mentioned this special value maxcpus=0, just curious has anyone tried that before with kdump?
;;
+i386)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
;;
+ppc64)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root"
;;
+ppc64le)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root -s"
;;
+s390x)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS "-s"
;;
+x86_64)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS \
"-s"
;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Maybe just ignoring other arches is fine I guess? The original behavior is fall back to the default template, this script didn't change the behavior.
Thanks Philipp
+esac
+sed "$SED_EXP" "$TEMPLATE"
Hi Kairui,
On Tue, 26 Apr 2022 22:30:03 +0800 Kairui Song ryncsn@gmail.com wrote:
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:18写道:
Hi Kairui,
great idea!
Thanks!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
SED_EXP="${SED_EXP}s/^$1=.*$/$1=\"$2\"/;"
+}
+case "$ARCH" in +aarch64)
update_param KEXEC_ARGS "-s"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
OK, I'll update it, I thought it's better to just keep the code simple enough, a few redundant config lines won't hurt. But after second thought, two helpers will definately make the script cleaner.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
Hmm, I remember there were some discussions about these two params some time ago but I can't recall the detail...
Look at the kernel-doc: nr_cpus= [SMP] Maximum number of processors that an SMP kernel could support. nr_cpus=n : n >= 1 limits the kernel to support 'n' processors. It could be larger than the number of already plugged CPU during bootup, later in runtime you can physically add extra cpu until it reaches n. So during boot up some boot time memory for per-cpu variables need be pre-allocated for later physical cpu hot plugging.
maxcpus= [SMP] Maximum number of processors that an SMP kernel will bring up during bootup. maxcpus=n : n >= 0 limits the kernel to bring up 'n' processors. Surely after bootup you can bring up the other plugged cpu by executing "echo 1 > /sys/devices/system/cpu/cpuX/online". So maxcpus only takes effect during system bootup. While n=0 is a special case, it is equivalent to "nosmp", which also disables the IO APIC.
So nr_cpus is a hard limit and saves percpu memory, maxcpus is not.
Right. But then it's probably better to go with nr_cpus. At least then we don't allocate memory for cpus that will never go online. As far as I see only the default and ppc64(le) are using maxcpus. All other architectures already use nr_cpus.
The doc also mentioned this special value maxcpus=0, just curious has anyone tried that before with kdump?
I've never tried that...
;;
+i386)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
;;
+ppc64)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root"
;;
+ppc64le)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root -s"
;;
+s390x)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS "-s"
;;
+x86_64)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS \
"-s"
;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Maybe just ignoring other arches is fine I guess? The original behavior is fall back to the default template, this script didn't change the behavior.
ok, how about printing a warning and continue with the default? When I was playing around with this I had a typo in the arch and it took me ten minutes to figure out why it wasn't working. So the warning would have been very appreciated ;-)
Thanks Philipp
Philipp Rudo prudo@redhat.com 于2022年4月27日周三 19:37写道:
Hi Kairui,
On Tue, 26 Apr 2022 22:30:03 +0800 Kairui Song ryncsn@gmail.com wrote:
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:18写道:
Hi Kairui,
great idea!
Thanks!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
SED_EXP="${SED_EXP}s/^$1=.*$/$1=\"$2\"/;"
+}
+case "$ARCH" in +aarch64)
update_param KEXEC_ARGS "-s"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
OK, I'll update it, I thought it's better to just keep the code simple enough, a few redundant config lines won't hurt. But after second thought, two helpers will definately make the script cleaner.
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
Hmm, I remember there were some discussions about these two params some time ago but I can't recall the detail...
Look at the kernel-doc: nr_cpus= [SMP] Maximum number of processors that an SMP kernel could support. nr_cpus=n : n >= 1 limits the kernel to support 'n' processors. It could be larger than the number of already plugged CPU during bootup, later in runtime you can physically add extra cpu until it reaches n. So during boot up some boot time memory for per-cpu variables need be pre-allocated for later physical cpu hot plugging.
maxcpus= [SMP] Maximum number of processors that an SMP kernel will bring up during bootup. maxcpus=n : n >= 0 limits the kernel to bring up 'n' processors. Surely after bootup you can bring up the other plugged cpu by executing "echo 1 > /sys/devices/system/cpu/cpuX/online". So maxcpus only takes effect during system bootup. While n=0 is a special case, it is equivalent to "nosmp", which also disables the IO APIC.
So nr_cpus is a hard limit and saves percpu memory, maxcpus is not.
Right. But then it's probably better to go with nr_cpus. At least then we don't allocate memory for cpus that will never go online. As far as I see only the default and ppc64(le) are using maxcpus. All other architectures already use nr_cpus.
The doc also mentioned this special value maxcpus=0, just curious has anyone tried that before with kdump?
I've never tried that...
;;
+i386)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
;;
+ppc64)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root"
;;
+ppc64le)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root -s"
;;
+s390x)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS "-s"
;;
+x86_64)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS \
"-s"
;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Maybe just ignoring other arches is fine I guess? The original behavior is fall back to the default template, this script didn't change the behavior.
ok, how about printing a warning and continue with the default? When I was playing around with this I had a typo in the arch and it took me ten minutes to figure out why it wasn't working. So the warning would have been very appreciated ;-)
Yes, that's a great idea, I'll update it this way. Thanks for the review :)
Thanks Philipp
Philipp Rudo prudo@redhat.com 于2022年4月25日周一 21:18写道:
Hi Kairui,
great idea!
A few comments/questions below.
On Sat, 23 Apr 2022 22:49:52 +0800 Kairui Song ryncsn@gmail.com wrote:
From: Kairui Song kasong@tencent.com
These kdump.sysconfig.* files are almost identical with a bit different in several parameters, just use a simple script to generate them upon packaging. This should make it easier to maintain, updating a comment or param for certain arch can be done in one place.
There are some minor differences with the generated version due to some arch's sysconfig is not up-to-dated, this actually fixed the issues, to check these differences:
# for arch in aarch64 i386 ppc64 ppc64le s390x x86_64; do ./kdump-gen-sysconfig.sh kdump.sysconfig.template $arch > kdump.sysconfig.$arch.new git checkout HEAD^ kdump.sysconfig.$arch &>/dev/null echo "Diff of arch $arch:" diff kdump.sysconfig.$arch kdump.sysconfig.$arch.new; echo "" done; git reset;
Diff of arch aarch64:
#What is the images extension. Relocatable kernels don't have one KDUMP_IMG_EXT=""
Diff of arch i386:
Diff of arch ppc64: 42,43d41 < #Specify the action after failure <
Diff of arch ppc64le: 42,43d41 < #Specify the action after failure <
Diff of arch s390x: 26,28d25 < # Any additional /sbin/mkdumprd arguments required. < MKDUMPRD_ARGS="" <
Diff of arch x86_64:
Signed-off-by: Kairui Song kasong@tencent.com
kdump-gen-sysconfig.sh | 51 ++++++++++++++++++ kdump.sysconfig.aarch64 | 53 ------------------ kdump.sysconfig.i386 | 56 ------------------- kdump.sysconfig.ppc64 | 58 -------------------- kdump.sysconfig.ppc64le | 58 -------------------- kdump.sysconfig.s390x | 59 --------------------- kdump.sysconfig => kdump.sysconfig.template | 3 ++ kdump.sysconfig.x86_64 | 56 ------------------- kexec-tools.spec | 18 +++---- 9 files changed, 60 insertions(+), 352 deletions(-) create mode 100755 kdump-gen-sysconfig.sh delete mode 100644 kdump.sysconfig.aarch64 delete mode 100644 kdump.sysconfig.i386 delete mode 100644 kdump.sysconfig.ppc64 delete mode 100644 kdump.sysconfig.ppc64le delete mode 100644 kdump.sysconfig.s390x rename kdump.sysconfig => kdump.sysconfig.template (96%) delete mode 100644 kdump.sysconfig.x86_64
diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh new file mode 100755 index 0000000..1eac80d --- /dev/null +++ b/kdump-gen-sysconfig.sh @@ -0,0 +1,51 @@ +#!/bin/bash
+TEMPLATE=$1 +ARCH=$2 +SED_EXP=""
+update_param() +{
SED_EXP="${SED_EXP}s/^$1=.*$/$1=\"$2\"/;"
+}
+case "$ARCH" in +aarch64)
update_param KEXEC_ARGS "-s"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0"
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
Hi Philipp,
After trying this idea, I found it rather difficult to implement these helpers... The problem is that regex/sed is not enough to parse arguments, so something like xargs is needed to parse the args. For example, parsing dracut_args which may contain quoted string, and kernel cmdline (KDUMP_COMMANDLINE) also allow quoted strings. And since we want to use this script for both sysconfig and kdump.conf, which introduces a lot more corner cases (matching word borders correctly, avoiding redundant space after removing a param, etc... ) and the code ends up really complex. Not sure worth maintaining a long chunk of code just for generating simple config files.
And think again, maybe a whole line replacement like setting whole KDUMP_COMMANDLINE_APPEND, for every arch, is not that hard to read, maybe not harder than calling param_add/update/del repeatedly. And the logic of the config and the script is much simpler to understand, and to maintain.
What do you think?
BTW, is there a difference between nr_cpus=1 and maxcpus=1?
;;
+i386)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0"
;;
+ppc64)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root"
;;
+ppc64le)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma"
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll maxcpus=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"
update_param KEXEC_ARGS "--dt-no-old-root -s"
;;
+s390x)
update_param KDUMP_COMMANDLINE_REMOVE \
"hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt"
update_param KDUMP_COMMANDLINE_APPEND \
"nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS "-s"
;;
+x86_64)
update_param KDUMP_COMMANDLINE_APPEND \
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
update_param KEXEC_ARGS \
"-s"
;;
Add some error handling? I.e.
*) echo "Unknown architecture $ARCH provided" >&2 exit 1 ;;
Thanks Philipp
+esac
+sed "$SED_EXP" "$TEMPLATE"
Hi Kairui,
On Fri, 29 Apr 2022 23:29:55 +0800 Kairui Song ryncsn@gmail.com wrote:
[...]
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
Hi Philipp,
After trying this idea, I found it rather difficult to implement these helpers... The problem is that regex/sed is not enough to parse arguments, so something like xargs is needed to parse the args. For example, parsing dracut_args which may contain quoted string, and kernel cmdline (KDUMP_COMMANDLINE) also allow quoted strings. And since we want to use this script for both sysconfig and kdump.conf, which introduces a lot more corner cases (matching word borders correctly, avoiding redundant space after removing a param, etc... ) and the code ends up really complex. Not sure worth maintaining a long chunk of code just for generating simple config files.
And think again, maybe a whole line replacement like setting whole KDUMP_COMMANDLINE_APPEND, for every arch, is not that hard to read, maybe not harder than calling param_add/update/del repeatedly. And the logic of the config and the script is much simpler to understand, and to maintain.
What do you think?
You've got some very good points here...
An other problem I noticed while thinking about this is that when we use one generator for multiple configs it most likely will get quite messy. What I mean is that we then have multiple places (the configs plus the generator) we need to check every time we update an option. My fear is that this will be forgotten from time to time resulting in unnecessary bugs we need to handle. Ideally we find a way such that a config is defined in just one place.
So how about this? We have one <config>-generator script for each config we want to generate. The <config>-generator is basically what you suggested except, that it also contains the current .config file in a here-doc. With that one config is completely handled in one place. The only downside is that there is a little bit of duplicate code but I think that is acceptable.
What do you think?
Thanks Philipp
Philipp Rudo prudo@redhat.com 于 2022年5月4日周三 下午8:24写道:
Hi Kairui,
On Fri, 29 Apr 2022 23:29:55 +0800 Kairui Song ryncsn@gmail.com wrote:
[...]
hmm... in the end KDUMP_COMMANDLINE_APPEND is set for every (supported) arch. So having a "default" set in the template currently doesn't make much sense. Furthermore the command line has quite a few common entries between the arches. So how about splitting update_param into two functions param_add and param_remove that add remove the given params from the default set in the template. With that I hope it will be easier to see the differences between the arches.
Hi Philipp,
After trying this idea, I found it rather difficult to implement these helpers... The problem is that regex/sed is not enough to parse arguments, so something like xargs is needed to parse the args. For example, parsing dracut_args which may contain quoted string, and kernel cmdline (KDUMP_COMMANDLINE) also allow quoted strings. And since we want to use this script for both sysconfig and kdump.conf, which introduces a lot more corner cases (matching word borders correctly, avoiding redundant space after removing a param, etc... ) and the code ends up really complex. Not sure worth maintaining a long chunk of code just for generating simple config files.
And think again, maybe a whole line replacement like setting whole KDUMP_COMMANDLINE_APPEND, for every arch, is not that hard to read, maybe not harder than calling param_add/update/del repeatedly. And the logic of the config and the script is much simpler to understand, and to maintain.
What do you think?
You've got some very good points here...
An other problem I noticed while thinking about this is that when we use one generator for multiple configs it most likely will get quite messy. What I mean is that we then have multiple places (the configs plus the generator) we need to check every time we update an option. My fear is that this will be forgotten from time to time resulting in unnecessary bugs we need to handle. Ideally we find a way such that a config is defined in just one place.
So how about this? We have one <config>-generator script for each config we want to generate. The <config>-generator is basically what you suggested except, that it also contains the current .config file in a here-doc. With that one config is completely handled in one place. The only downside is that there is a little bit of duplicate code but I think that is acceptable.
What do you think?
Yes, that's a great idea, will send an update shortly based on this idea
Thanks Philipp
Hi Kairui,
we just got a request from IBM to use zlib compression with makedumpfile for s390 but we don't want to change it for all architectures. So I thought your approach should work for kdump.conf as well. That's why I took the liberty to generalize your kdump-gen-sysconfig. What do you think?
FYI, it's only a quick and dirty implementation and I haven't properly tested it yet.
Thanks Philipp
Philipp Rudo (2): kdump-gen-configs: emphasize differences from default instead of overwriting it kdump-gen-configs: make generic and set core_collector for s390
.gitignore | 2 + kdump-gen-configs.sh | 73 +++++++++++++++++++++++++++++++ kdump-gen-sysconfig.sh | 51 --------------------- kdump.conf => kdump.conf.template | 0 kdump.sysconfig.template | 4 +- kexec-tools.spec | 6 +-- 6 files changed, 80 insertions(+), 56 deletions(-) create mode 100755 kdump-gen-configs.sh delete mode 100755 kdump-gen-sysconfig.sh rename kdump.conf => kdump.conf.template (100%)
Changes in the resulting kdump.sysconfig.$arch files:
- the one mentioned by Kairui in his cover letter - reordering of some parameters - nr_cpus=1 -> maxcpus=1 (I assume these two are identical)
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-gen-configs.sh | 69 ++++++++++++++++++++++++++++++++++++++++ kdump-gen-sysconfig.sh | 51 ----------------------------- kdump.sysconfig.template | 4 +-- 3 files changed, 71 insertions(+), 53 deletions(-) create mode 100755 kdump-gen-configs.sh delete mode 100755 kdump-gen-sysconfig.sh
diff --git a/kdump-gen-configs.sh b/kdump-gen-configs.sh new file mode 100755 index 0000000..3a79977 --- /dev/null +++ b/kdump-gen-configs.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +TEMPLATE=$1 +ARCH=$2 +SED_EXP="" + +param_set() +{ + SED_EXP="${SED_EXP}s/^$1>.*$/$1="$2"/;" +} + +param_add() +{ + SED_EXP="${SED_EXP}/^$1>/{s/(")?$/ $2\1/};" +} + +param_del() +{ + SED_EXP="${SED_EXP}/^$1>/{s/(\s|")$2>(=\S*)?(\s|")/\1\3/g};" +} + +case "$ARCH" in +aarch64) + param_del KDUMP_COMMANDLINE_APPEND "numa" + param_del KDUMP_COMMANDLINE_APPEND "transparent_hugepage" + param_add KDUMP_COMMANDLINE_APPEND "swiotlb=noforce" + ;; +i386) + param_del KDUMP_COMMANDLINE_APPEND "cgroup_disable" + + param_set KEXEC_ARGS "" + ;; +ppc64) + param_del KDUMP_COMMANDLINE_REMOVE "cma" + + param_del KDUMP_COMMANDLINE_APPEND "cma" + param_add KDUMP_COMMANDLINE_APPEND "noirqdistrib ehea.use_mcs=0 kvm_cma_resv_ratio=0" + + param_del KEXEC_ARGS "-s" + param_add KEXEC_ARGS "--dt-no-old-root" + ;; +ppc64le) + param_del KDUMP_COMMANDLINE_REMOVE "cma" + + param_del KDUMP_COMMANDLINE_APPEND "cma" + param_add KDUMP_COMMANDLINE_APPEND "noirqdistrib ehea.use_mcs=0 kvm_cma_resv_ratio=0" + + param_add KEXEC_ARGS "--dt-no-old-root" + ;; +s390x) + param_add KDUMP_COMMANDLINE_REMOVE "vmcp_cma prot_virt" + + param_del KDUMP_COMMANDLINE_APPEND "irqpoll" + param_del KDUMP_COMMANDLINE_APPEND "reset_devices" + param_add KDUMP_COMMANDLINE_APPEND "vmcp_cma=0" + ;; +x86_64) + param_add KDUMP_COMMANDLINE_APPEND "mce=off acpi_no_memhotplug nokaslr hest_disable" + ;; +*) + echo "$0: Unknown architecture $ARCH provided" >&2 + exit 1 +esac + +# On lines that are no comment, remove leading, trailing and double spaces as +# well as the ones at the beginning and end of a quote +SED_EXP="${SED_EXP}/^#/!{s/^\s+//g;s/\s+$//g;s/\s+/ /g;s/"\s+/"/g;s/\s+"/"/g};" + +sed "$SED_EXP" "$TEMPLATE" diff --git a/kdump-gen-sysconfig.sh b/kdump-gen-sysconfig.sh deleted file mode 100755 index 1eac80d..0000000 --- a/kdump-gen-sysconfig.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -TEMPLATE=$1 -ARCH=$2 -SED_EXP="" - -update_param() -{ - SED_EXP="${SED_EXP}s/^$1=.*$/$1="$2"/;" -} - -case "$ARCH" in -aarch64) - update_param KEXEC_ARGS "-s" - update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0" - ;; -i386) - update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0" - ;; -ppc64) - update_param KDUMP_COMMANDLINE_REMOVE \ - "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" - update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll maxcpus=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" - update_param KEXEC_ARGS "--dt-no-old-root" - ;; -ppc64le) - update_param KDUMP_COMMANDLINE_REMOVE \ - "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb hugetlb_cma" - update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll maxcpus=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" - update_param KEXEC_ARGS "--dt-no-old-root -s" - ;; -s390x) - update_param KDUMP_COMMANDLINE_REMOVE \ - "hugepages hugepagesz slub_debug quiet log_buf_len swiotlb vmcp_cma cma hugetlb_cma prot_virt" - update_param KDUMP_COMMANDLINE_APPEND \ - "nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0" - update_param KEXEC_ARGS "-s" - ;; -x86_64) - update_param KDUMP_COMMANDLINE_APPEND \ - "irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0" - update_param KEXEC_ARGS \ - "-s" - ;; -esac - -sed "$SED_EXP" "$TEMPLATE" diff --git a/kdump.sysconfig.template b/kdump.sysconfig.template index 39b1bdf..2ae7a51 100644 --- a/kdump.sysconfig.template +++ b/kdump.sysconfig.template @@ -21,14 +21,14 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
# This variable lets us append arguments to the current kdump commandline # after processed by KDUMP_COMMANDLINE_REMOVE -KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd cma=0 hugetlb_cma=0" +KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 panic=10 novmcoredd reset_devices cgroup_disable=memory numa=off transparent_hugepage=never cma=0 hugetlb_cma=0 udev.children-max=2"
# Any additional kexec arguments required. In most situations, this should # be left empty # # Example: # KEXEC_ARGS="--elf32-core-headers" -KEXEC_ARGS="" +KEXEC_ARGS="-s"
#Where to find the boot image #KDUMP_BOOTDIR="/boot"
Signed-off-by: Philipp Rudo prudo@redhat.com --- .gitignore | 2 ++ kdump-gen-configs.sh | 10 +++++++--- kdump.conf => kdump.conf.template | 0 kexec-tools.spec | 6 +++--- 4 files changed, 12 insertions(+), 6 deletions(-) rename kdump.conf => kdump.conf.template (100%)
diff --git a/.gitignore b/.gitignore index e9c2dd8..0c1c145 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,6 @@ /kexec-tools-2.0.11.tar.xz /makedumpfile-1.5.9.tar.gz /kexec-tools-2.0.12.tar.xz +kdump.sysconfig +kdump.conf coverage/ diff --git a/kdump-gen-configs.sh b/kdump-gen-configs.sh index 3a79977..ed8647c 100755 --- a/kdump-gen-configs.sh +++ b/kdump-gen-configs.sh @@ -1,7 +1,6 @@ #!/bin/bash
-TEMPLATE=$1 -ARCH=$2 +ARCH=$1; shift SED_EXP=""
param_set() @@ -53,6 +52,9 @@ s390x) param_del KDUMP_COMMANDLINE_APPEND "irqpoll" param_del KDUMP_COMMANDLINE_APPEND "reset_devices" param_add KDUMP_COMMANDLINE_APPEND "vmcp_cma=0" + + param_del core_collector "-l" + param_add core_collector "-c" ;; x86_64) param_add KDUMP_COMMANDLINE_APPEND "mce=off acpi_no_memhotplug nokaslr hest_disable" @@ -66,4 +68,6 @@ esac # well as the ones at the beginning and end of a quote SED_EXP="${SED_EXP}/^#/!{s/^\s+//g;s/\s+$//g;s/\s+/ /g;s/"\s+/"/g;s/\s+"/"/g};"
-sed "$SED_EXP" "$TEMPLATE" +for TEMPLATE in "$@"; do + sed "$SED_EXP" "$TEMPLATE" > ${TEMPLATE%%.template} +done diff --git a/kdump.conf b/kdump.conf.template similarity index 100% rename from kdump.conf rename to kdump.conf.template diff --git a/kexec-tools.spec b/kexec-tools.spec index 462a7a1..4087bec 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -14,7 +14,7 @@ Source1: kdumpctl Source2: kdump.sysconfig.template Source3: kdump-gen-sysconfig.sh Source7: mkdumprd -Source8: kdump.conf +Source8: kdump.conf.template Source9: https://github.com/makedumpfile/makedumpfile/archive/%%7Bmkdf_ver%7D/makedum... Source10: kexec-kdump-howto.txt Source11: fadump-howto.txt @@ -148,7 +148,7 @@ cp %{SOURCE27} . cp %{SOURCE34} .
# Generate sysconfig file -%{SOURCE3} %{SOURCE2} %{_target_cpu} > kdump.sysconfig +%{SOURCE3} %{_target_cpu} %{SOURCE2} %{SOURCE8}
make %ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64 @@ -182,7 +182,7 @@ install -m 644 build/man/man8/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/ install -m 644 build/man/man8/vmcore-dmesg.8 $RPM_BUILD_ROOT%{_mandir}/man8/
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/usr/sbin/mkdumprd -install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf +install -m 644 kdump.conf $RPM_BUILD_ROOT%{_sysconfdir}/kdump.conf install -m 644 kdump.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/kdump install -m 644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8/kexec.8 install -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_mandir}/man8/mkdumprd.8
Philipp Rudo prudo@redhat.com 于2022年4月26日周二 21:58写道:
Hi Kairui,
we just got a request from IBM to use zlib compression with makedumpfile for s390 but we don't want to change it for all architectures. So I thought your approach should work for kdump.conf as well. That's why I took the liberty to generalize your kdump-gen-sysconfig. What do you think?
Looks great :)
FYI, it's only a quick and dirty implementation and I haven't properly tested it yet.
Seems this based on the previous kdump-gen-configs V1 patch? I just replied to some of your comments, please have a look and I'll update V2.
Thanks Philipp
Philipp Rudo (2): kdump-gen-configs: emphasize differences from default instead of overwriting it kdump-gen-configs: make generic and set core_collector for s390
.gitignore | 2 + kdump-gen-configs.sh | 73 +++++++++++++++++++++++++++++++ kdump-gen-sysconfig.sh | 51 --------------------- kdump.conf => kdump.conf.template | 0 kdump.sysconfig.template | 4 +- kexec-tools.spec | 6 +-- 6 files changed, 80 insertions(+), 56 deletions(-) create mode 100755 kdump-gen-configs.sh delete mode 100755 kdump-gen-sysconfig.sh rename kdump.conf => kdump.conf.template (100%)
-- 2.35.1
Hi Kairui,
On Tue, 26 Apr 2022 22:38:34 +0800 Kairui Song ryncsn@gmail.com wrote:
Philipp Rudo prudo@redhat.com 于2022年4月26日周二 21:58写道:
Hi Kairui,
we just got a request from IBM to use zlib compression with makedumpfile for s390 but we don't want to change it for all architectures. So I thought your approach should work for kdump.conf as well. That's why I took the liberty to generalize your kdump-gen-sysconfig. What do you think?
Looks great :)
Thanks!
FYI, it's only a quick and dirty implementation and I haven't properly tested it yet.
Seems this based on the previous kdump-gen-configs V1 patch? I just replied to some of your comments, please have a look and I'll update V2.
yes, it's based on your v1. Sorry, should have mentioned it...
Thanks Philipp
Thanks Philipp
Philipp Rudo (2): kdump-gen-configs: emphasize differences from default instead of overwriting it kdump-gen-configs: make generic and set core_collector for s390
.gitignore | 2 + kdump-gen-configs.sh | 73 +++++++++++++++++++++++++++++++ kdump-gen-sysconfig.sh | 51 --------------------- kdump.conf => kdump.conf.template | 0 kdump.sysconfig.template | 4 +- kexec-tools.spec | 6 +-- 6 files changed, 80 insertions(+), 56 deletions(-) create mode 100755 kdump-gen-configs.sh delete mode 100755 kdump-gen-sysconfig.sh rename kdump.conf => kdump.conf.template (100%)
-- 2.35.1