Package: kdump-tools
Version: 1:1.6.2-1
Severity: normal
Tags: patch

The current KDUMP_CMDLINE_APPEND and crashkernel= settings for arm64 are
suboptimal. Several fo the KDUMP_CMDLINE_APPEND options seem to be x86-
specific, and the crashkernel reserved range isn't sufficient for any arm64
server I've tested with.

The attached patches provide reasonable defaults that work for me on Cavium
ThunderX and Qualcomm QDF2400 platforms. The crashkernel= parameter is now
very similar to ppc64el, and the KDUMP_CMDLINE_APPEND drops a number of
unnecessary parameters.

While doing this I noticed that the default value for KDUMP_CMDLINE_APPEND
is duplicated in several places. I took the opportunity to clean that up,
and now use a templating scheme to insert the same value in all the places
at build time.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.14.0-rc7-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages kdump-tools depends on:
ii  bsdmainutils           9.0.14
ii  debconf [debconf-2.0]  1.5.65
ii  file                   1:5.32-1
pn  kexec-tools            <none>
ii  lsb-base               9.20170808
pn  makedumpfile           <none>
ii  ucf                    3.0036

kdump-tools recommends no packages.

kdump-tools suggests no packages.
>From d9a79bb5cc7d836ca8396081b27805e06facab96 Mon Sep 17 00:00:00 2001
From: dann frazier <dann.fraz...@canonical.com>
Date: Fri, 8 Dec 2017 12:00:44 -0700
Subject: [PATCH 1/3] Use templating to factor out the kdump kernel cmdline

The kdump cmdline is in 3 different places in the source. Let's
store the string in one place and generate the affected files.

This will also enable us to later use different cmdlines per-arch.
---
 debian/{kdump-config => kdump-config.in}         |  2 +-
 debian/{kdump-tools.5 => kdump-tools.5.in}       |  2 +-
 debian/{kdump-tools.conf => kdump-tools.conf.in} |  4 ++--
 debian/rules                                     | 13 ++++++++++++-
 4 files changed, 16 insertions(+), 5 deletions(-)
 rename debian/{kdump-config => kdump-config.in} (99%)
 rename debian/{kdump-tools.5 => kdump-tools.5.in} (99%)
 rename debian/{kdump-tools.conf => kdump-tools.conf.in} (95%)

diff --git a/debian/kdump-config b/debian/kdump-config.in
similarity index 99%
rename from debian/kdump-config
rename to debian/kdump-config.in
index ba79bc8..b93d8bb 100755
--- a/debian/kdump-config
+++ b/debian/kdump-config.in
@@ -51,7 +51,7 @@ KDUMP_NUM_DUMPS=${KDUMP_NUM_DUMPS:=0}
 NFS_TIMEO=${NFS_TIMEO:=600}
 NFS_RETRANS=${NFS_RETRANS:=3}
 MAKEDUMP_ARGS=${MAKEDUMP_ARGS:="-c -d 31"}
-KDUMP_CMDLINE_APPEND=${KDUMP_CMDLINE_APPEND:="irqpoll nr_cpus=1 nousb 
systemd.unit=kdump-tools.service ata_piix.prefer_ms_hyperv=0"}
+KDUMP_CMDLINE_APPEND=${KDUMP_CMDLINE_APPEND:="@KDUMP_CMDLINE_APPEND@"}
 KDUMP_KERNEL_HOOK="/etc/kernel/postinst.d/kdump-tools"
 [ -d $KDUMP_COREDIR ] || mkdir -p $KDUMP_COREDIR ;
 
diff --git a/debian/kdump-tools.5 b/debian/kdump-tools.5.in
similarity index 99%
rename from debian/kdump-tools.5
rename to debian/kdump-tools.5.in
index 01eb7d7..7cadc6f 100644
--- a/debian/kdump-tools.5
+++ b/debian/kdump-tools.5.in
@@ -125,7 +125,7 @@ Set this variable to override
 .B KDUMP_CMDLINE_APPEND
 Additional arguments to append to the command line for the kdump kernel.  
 If not set,  
-.RI \*(lq "irqpoll nr_cpus=1 nousb" \*(rq
+.RI \*(lq "@KDUMP_CMDLINE_APPEND@" \*(rq
 will be used.
 .TP
 .B SSH
diff --git a/debian/kdump-tools.conf b/debian/kdump-tools.conf.in
similarity index 95%
rename from debian/kdump-tools.conf
rename to debian/kdump-tools.conf.in
index 0173d6d..97cccb4 100644
--- a/debian/kdump-tools.conf
+++ b/debian/kdump-tools.conf.in
@@ -68,10 +68,10 @@ KDUMP_COREDIR="/var/crash"
 #     Set this variable to override /proc/cmdline.
 # KDUMP_CMDLINE_APPEND - Additional arguments to append to the command line 
 #     for the kdump kernel.  If unset, it defaults to
-#     "irqpoll nr_cpus=1 nousb systemd.unit=kdump-tools.service 
ata_piix.prefer_ms_hyperv=0"
+#     "@KDUMP_CMDLINE_APPEND@"
 #KDUMP_KEXEC_ARGS=""
 #KDUMP_CMDLINE=""
-#KDUMP_CMDLINE_APPEND="irqpoll nr_cpus=1 nousb 
systemd.unit=kdump-tools.service ata_piix.prefer_ms_hyperv=0"
+#KDUMP_CMDLINE_APPEND="@KDUMP_CMDLINE_APPEND@"
 
 # ---------------------------------------------------------------------------
 # Architecture specific Overrides:
diff --git a/debian/rules b/debian/rules
index eec109e..77ed939 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,8 @@ else
        SUBSTVARS = -Vdist:Depends="kexec-tools"
 endif
 
+KDUMP_CMDLINE_APPEND = irqpoll nr_cpus=1 nousb 
systemd.unit=kdump-tools.service ata_piix.prefer_ms_hyperv=0
+
 %:
        dh $@ --with=systemd
 
@@ -16,7 +18,15 @@ override_dh_gencontrol:
 override_dh_auto_build:
        dh_auto_build -- LINKTYPE=dynamic USELZO=on
 
-override_dh_install:
+kdump_cmdline_insert = sed "s/@KDUMP_CMDLINE_APPEND@/$(KDUMP_CMDLINE_APPEND)/" 
< $< > $@
+debian/kdump-config: debian/kdump-config.in
+       $(kdump_cmdline_insert)
+debian/kdump-tools.conf: debian/kdump-tools.conf.in
+       $(kdump_cmdline_insert)
+debian/kdump-tools.5: debian/kdump-tools.5.in
+       $(kdump_cmdline_insert)
+
+override_dh_install: debian/kdump-config debian/kdump-tools.conf 
debian/kdump-tools.5
        dh_install
        install -D -m 755 debian/kernel-postinst-generate-initrd 
debian/kdump-tools/etc/kernel/postinst.d/kdump-tools
        install -D -m 755 debian/kernel-postrm-delete-initrd 
debian/kdump-tools/etc/kernel/postrm.d/kdump-tools
@@ -37,4 +47,5 @@ override_dh_installdeb:
 
 override_dh_auto_clean:
        rm -f debian/kdump-tools.maintscript
+       rm -f debian/kdump-config debian/kdump-tools.conf debian/kdump-tools.5
        dh_auto_clean
-- 
2.15.1

>From 16787d476c0028362ce6b5709a2b40808a7328f8 Mon Sep 17 00:00:00 2001
From: dann frazier <da...@debian.org>
Date: Thu, 26 Oct 2017 17:38:02 +0000
Subject: [PATCH 2/3] Remove unnecessary kdump kernel arguments for arm64

irqpoll isn't supported, at least on some arm64 platforms (e.g. qdf2400).

ata_piix.prefer_ms_hyperv=0 is x86 specific.

I'm not sure what the rationale is for disabling USB - seems like it
could be useful for some scenarios, and doesn't seem to be causing a
problem.
---
 debian/rules | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 77ed939..61445d0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,12 @@ else
        SUBSTVARS = -Vdist:Depends="kexec-tools"
 endif
 
-KDUMP_CMDLINE_APPEND = irqpoll nr_cpus=1 nousb 
systemd.unit=kdump-tools.service ata_piix.prefer_ms_hyperv=0
+KDUMP_CMDLINE_APPEND = nr_cpus=1 systemd.unit=kdump-tools.service
+ifeq ($(DEB_HOST_ARCH),arm64)
+       # pass
+else
+       KDUMP_CMDLINE_APPEND += irqpoll nousb ata_piix.prefer_ms_hyperv=0
+endif
 
 %:
        dh $@ --with=systemd
-- 
2.15.1

>From deab7b24721a01f0b9fbf220ad2292d1f3067051 Mon Sep 17 00:00:00 2001
From: dann frazier <da...@debian.org>
Date: Fri, 8 Dec 2017 10:53:50 -0700
Subject: [PATCH 3/3] Make arm64 use a similar crashkernel parameter as ppc64el

The generic defaults max out at 128M. Testing shows that this is not
enough for arm64 servers. Instead, we use the defaults for ppc64el, but
without the @32MB constraint (not a valid location on tested systems).
---
 debian/kdump-tools.grub.arm64 | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 debian/kdump-tools.grub.arm64

diff --git a/debian/kdump-tools.grub.arm64 b/debian/kdump-tools.grub.arm64
new file mode 100644
index 0000000..d73038f
--- /dev/null
+++ b/debian/kdump-tools.grub.arm64
@@ -0,0 +1 @@
+GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT 
crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M"
-- 
2.15.1

Reply via email to