Accepting request 250129 from Kernel:kdump

1

OBS-URL: https://build.opensuse.org/request/show/250129
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kdump?expand=0&rev=79
This commit is contained in:
Stephan Kulow 2014-09-20 05:26:43 +00:00 committed by Git OBS Bridge
commit 40ab0628e0
6 changed files with 330 additions and 0 deletions

View File

@ -0,0 +1,99 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 17:03:46 2014 +0200
Subject: Calibrate: update the initramfs size
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: b2ab003f54da780cc1ca8ebfe47f39ddd936b34a
Yes, systemd also needs some space in the initramfs, causing approx.
20% increase. Let's account for it...
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -59,7 +59,7 @@
#if defined(__x86_64__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(16)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -69,7 +69,7 @@
#elif defined(__i386__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(14)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0
@@ -79,7 +79,7 @@
#elif defined(__powerpc64__)
# define DEF_RESERVE_KB MB(256)
# define KERNEL_KB MB(16)
-# define INIT_KB MB(48)
+# define INIT_KB MB(58)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD MB(128)
@@ -89,7 +89,7 @@
#elif defined(__powerpc__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD MB(128)
@@ -99,7 +99,7 @@
#elif defined(__s390x__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(13)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -111,7 +111,7 @@
#elif defined(__s390__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0
@@ -123,7 +123,7 @@
#elif defined(__ia64__)
# define DEF_RESERVE_KB MB(512)
# define KERNEL_KB MB(32)
-# define INIT_KB MB(36)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -133,7 +133,7 @@
#elif defined(__aarch64__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(10)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -143,7 +143,7 @@
#elif defined(__arm__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0

View File

@ -0,0 +1,49 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 17:01:08 2014 +0200
Subject: Calibrate: update user-space run-time requirements for systemd
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 04bc6fa91a88e7ff91acb6d2924774bf28463c6b
If systemd is included, journald is also started, so the estimate
must add:
1. the process
2. the journal, which is stored in ramfs
I would love to reduce the size of the journal, but systemd hard-codes
the minimum to 4M, see src/journal/journal-file.c:
/* This is the minimum journal file size */
#define JOURNAL_FILE_SIZE_MIN (4ULL*1024ULL*1024ULL) /* 4 MiB */
Strictly speaking, journald is allowed to use at least twice as much,
but let's hope it doesn't in practice.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -203,13 +203,15 @@ static inline unsigned long s390x_align_
#define DIRTY_RATIO 20
// Userspace base requirements:
-// bash (PID 1) 3 M
+// systemd (PID 1) 3 M
+// journald 2 M
+// the journal itself 4 M
// 10 * udevd 12 M
// kdumptool 4 M
// makedumpfile 1 M
// -------------------------
-// TOTAL: 20 M
-#define USER_BASE_KB MB(20)
+// TOTAL: 26 M
+#define USER_BASE_KB MB(26)
// Additional requirements when network is configured
// dhclient 7 M

View File

@ -0,0 +1,32 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 10:15:59 2014 +0200
Subject: Remove root= and resume= from the kdump kernel command line
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 8caaba657548133d476b2a13fd5abb68314927c7
Resume from hibernation should never be even attempted in kdump.
If using dracut, the module is even omitted from the initrd, so
passing the command line option only consumes command line space.
The default root device is not needed either, because all required
filesystems are handled by the mount dracut module. In fact, if the
root filesystem is also mounted, it may be mounted twice.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/rc.kdump.functions | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/init/rc.kdump.functions
+++ b/init/rc.kdump.functions
@@ -108,7 +108,7 @@ function build_kdump_commandline()
local nr_cpus=$(cpus_param "$kdump_kernel")
commandline=$(
remove_from_commandline \
- 'crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable' \
+ 'root|resume|crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable' \
< /proc/cmdline)
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"

131
kdump-systemd-support.patch Normal file
View File

@ -0,0 +1,131 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 15:40:37 2014 +0200
Subject: Dracut-systemd support
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 9940475e501273ddac4a13fa2f4284b4121415de
Adjust the dracut module to work with the systemd module.
A new service is added to the initrd. I could not use a pre-pivot
hook, because dracut-pre-pivot.service does not send the output
to the terminal, so dump progress was not visible.
It is also necessary to avoid mounting the root filesystem. All
filesystems needed by kdump are mounted under /kdump and set up
with the --mount dracut option.
The system root mount can be generated in two ways:
a. by initrd-fstab-generator (if "root=" is passed on the kernel
command line)
b. by dracut-rootfs-generator (if the root option is stored in
/etc/cmdline.d/*)
The root= parameter is already removed from the command line, but
it is always saved to /etc/cmdline.d/95root-dev.conf if dracut is
called with --hostonly-cmdline. This is the default in SLES (cf.
/etc/dracut.conf.d/01-dist.conf) and it is required to get correct
configuration for many setups.
So, the only way to avoid mounting /sysroot is to remove the
appropriate systemd generator from the initrd.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
diff --git a/init/CMakeLists.txt b/init/CMakeLists.txt
index 662197c..9cc8b71 100644
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -79,4 +79,15 @@ INSTALL(
WORLD_READ WORLD_EXECUTE
)
+INSTALL(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/kdump-save.service
+ DESTINATION
+ /usr/lib/dracut/modules.d/99kdump
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ
+)
+
# vim: set sw=4 ts=4 et:
diff --git a/init/kdump-save.service b/init/kdump-save.service
new file mode 100644
index 0000000..ac527f4
--- /dev/null
+++ b/init/kdump-save.service
@@ -0,0 +1,31 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=save kernel crash dump
+Documentation=man:kdump(7)
+Wants=dracut-mount.service dracut-pre-pivot.service
+After=dracut-mount.service dracut-pre-pivot.service
+After=initrd.target
+Before=initrd-cleanup.service
+ConditionPathExists=/etc/initrd-release
+ConditionPathExists=/proc/vmcore
+
+[Service]
+Type=oneshot
+ExecStart=/lib/kdump/save_dump.sh
+StandardInput=tty
+StandardOutput=tty
+StandardError=tty
+KillMode=process
+RemainAfterExit=yes
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/init/mkdumprd b/init/mkdumprd
index 334786f..bb818d2 100755
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -122,7 +122,7 @@ function run_dracut()
{
local modules="kdump"
- DRACUT_ARGS="--force --hostonly --omit 'systemd plymouth resume usrmount'"
+ DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount'"
DRACUT_ARGS="$DRACUT_ARGS --compress='xz -0 --check=crc32'"
# add mount points
diff --git a/init/module-setup.sh b/init/module-setup.sh
index 06f9775..690de38 100644
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -18,8 +18,18 @@ install() {
kdump_setup_files "$initdir" "${!host_fs_types[*]}"
- inst_hook mount 30 "$moddir/mount-kdump.sh"
- inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
+ if dracut_module_included "systemd" ; then
+ rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+ inst_simple /lib/kdump/save_dump.sh
+ inst_simple "$moddir/kdump-save.service" \
+ "$systemdsystemunitdir"/kdump-save.service
+ ln_r "$systemdsystemunitdir"/kdump-save.service \
+ "$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
+ else
+ inst_hook mount 30 "$moddir/mount-kdump.sh"
+ inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
+ fi
+
inst_multiple makedumpfile makedumpfile-R.pl kdumptool \
$KDUMP_REQUIRED_PROGRAMS
inst_simple /etc/resolv.conf

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Sep 18 15:33:21 UTC 2014 - ptesarik@suse.cz
- kdump-remove-root-and-resume.patch: Remove root= and resume= from
the kdump kernel command line (bnc#883883).
- kdump-systemd-support.patch: Dracut-systemd support (bnc#883883).
- kdump-calibrate-systemd-runtime.patch: Calibrate: update
user-space run-time requirements for systemd (bnc#883883).
- kdump-calibrate-systemd-initramfs.patch: Calibrate: update the
initramfs size (bnc#883883).
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 9 06:08:44 UTC 2014 - ptesarik@suse.cz Tue Sep 9 06:08:44 UTC 2014 - ptesarik@suse.cz

View File

@ -68,6 +68,10 @@ Patch0: 0001-multipath-Write-proper-regex-into-multipath-conf.patch
Patch1: %{name}-use-fstab-device.patch Patch1: %{name}-use-fstab-device.patch
Patch2: %{name}-count-framebuffer.patch Patch2: %{name}-count-framebuffer.patch
Patch3: %{name}-count-const-slabs.patch Patch3: %{name}-count-const-slabs.patch
Patch4: %{name}-remove-root-and-resume.patch
Patch5: %{name}-systemd-support.patch
Patch6: %{name}-calibrate-systemd-runtime.patch
Patch7: %{name}-calibrate-systemd-initramfs.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2) # rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = %{version} Provides: kdump-helpers = %{version}
@ -109,6 +113,10 @@ Authors:
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build %build
export CFLAGS="%optflags" export CFLAGS="%optflags"