Accepting request 224287 from Kernel:kdump

Make kdump work with dracut

OBS-URL: https://build.opensuse.org/request/show/224287
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kdump?expand=0&rev=62
This commit is contained in:
Stephan Kulow 2014-03-01 06:51:21 +00:00 committed by Git OBS Bridge
commit b18ca60c87
9 changed files with 32 additions and 336 deletions

View File

@ -1,49 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Add disable_cpu_apicid for BSP to the commandline
References: bnc#861981
Patch-mainline: v0.8.8
Since the BSP cannot be brought up in the kdump environment, and there is no
reliable way of getting the APIC ID of an offlined CPU, it must be figured
out by the primary kernel and passed as a command-line option.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
NEWS | 2 ++
init/rc.kdump.functions | 13 +++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
0.8.8
-----
+ * Add disable_cpu_apicid parameter to the command line on x86 to prevent
+ bringing up the BSP in the kdump kernel.
* Use nr_cpus instead of maxcpus with recent kernels.
0.8.7
--- a/init/rc.kdump.functions
+++ b/init/rc.kdump.functions
@@ -103,9 +103,18 @@ function build_kdump_commandline()
< /proc/cmdline)
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices"
- case `uname -i` in
+ local arch=$(uname -i)
+ case "$arch" in
i?86|x86_64|ia64)
- commandline="$commandline irqpoll maxcpus=${KDUMP_CPUS:-1}"
+ local nr_cpus=$(cpus_param "$kdump_kernel")
+ commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}"
+ if [ "$arch" = "x86_64" -o -z "${arch#i?86}" ]; then
+ local boot_apicid=$(
+ awk -F':[ \t]' '/^initial apicid[ \t]*:/ {print $2; exit}' \
+ /proc/cpuinfo)
+ test -n "$boot_apicid" &&
+ commandline="$commandline disable_cpu_apicid=$boot_apicid"
+ fi
;;
s390*)
commandline="$commandline zfcp.allow_lun_scan=0"

View File

@ -1,200 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Implement kdump memory calibration
References: FATE#315241
Patch-mainline: v0.8.8
This command is used by yast-kdump to find out how much RAM should
be reserved for the crash kernel.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
NEWS | 1
kdumptool/CMakeLists.txt | 2 +
kdumptool/calibrate.cc | 78 +++++++++++++++++++++++++++++++++++++++++++++++
kdumptool/calibrate.h | 60 ++++++++++++++++++++++++++++++++++++
kdumptool/main.cc | 2 +
5 files changed, 143 insertions(+)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
0.8.8
-----
+ * New command: calibrate
* Add disable_cpu_apicid parameter to the command line on x86 to prevent
bringing up the BSP in the kdump kernel.
* Use nr_cpus instead of maxcpus with recent kernels.
--- a/kdumptool/CMakeLists.txt
+++ b/kdumptool/CMakeLists.txt
@@ -86,6 +86,8 @@ SET(COMMON_SRC
quotedstring.h
multipath.cc
multipath.h
+ calibrate.cc
+ calibrate.h
)
add_library(common STATIC ${COMMON_SRC})
--- /dev/null
+++ b/kdumptool/calibrate.cc
@@ -0,0 +1,78 @@
+/*
+ * (c) 2014, Petr Tesarik <ptesarik@suse.de>, SUSE LINUX Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+#include <iostream>
+
+#include "subcommand.h"
+#include "debug.h"
+#include "calibrate.h"
+
+// Default reservation size depends on architecture
+#if defined(__x86_64__)
+# define DEF_RESERVE_MB 128
+#elif defined(__i386__)
+# define DEF_RESERVE_MB 128
+#elif defined(__powerpc64__)
+# define DEF_RESERVE_MB 256
+#elif defined(__powerpc__)
+# define DEF_RESERVE_MB 128
+#elif defined(__s390x__)
+# define DEF_RESERVE_MB 128
+#elif defined(__s390__)
+# define DEF_RESERVE_MB 128
+#elif defined(__ia64__)
+# define DEF_RESERVE_MB 512
+#elif defined(__aarch64__)
+# define DEF_RESERVE_MB 128
+#elif defined(__arm__)
+# define DEF_RESERVE_MB 128
+#else
+# error "No default crashkernel reservation for your architecture!"
+#endif
+
+using std::cout;
+using std::endl;
+
+//{{{ Calibrate ----------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+Calibrate::Calibrate()
+ throw ()
+{}
+
+// -----------------------------------------------------------------------------
+const char *Calibrate::getName() const
+ throw ()
+{
+ return "calibrate";
+}
+
+// -----------------------------------------------------------------------------
+void Calibrate::execute()
+ throw (KError)
+{
+ unsigned long required;
+ Debug::debug()->trace("Calibrate::execute()");
+
+ required = DEF_RESERVE_MB;
+ cout << required << endl;
+}
+
+//}}}
+
+// vim: set sw=4 ts=4 fdm=marker et: :collapseFolds=1:
--- /dev/null
+++ b/kdumptool/calibrate.h
@@ -0,0 +1,60 @@
+/*
+ * (c) 2014, Petr Tesarik <ptesarik@suse.de>, SUSE LINUX Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+#ifndef CALIBRATE_H
+#define CALIBRATE_H
+
+#include "subcommand.h"
+
+//{{{ Calibrate ----------------------------------------------------------------
+
+/**
+ * Subcommand to calibrate reserved memory
+ */
+class Calibrate : public Subcommand {
+
+ public:
+ /**
+ * Creates a new Calibrate object.
+ */
+ Calibrate()
+ throw ();
+
+ public:
+ /**
+ * Returns the name of the subcommand (calibrate).
+ */
+ const char *getName() const
+ throw ();
+
+ /**
+ * Executes the function.
+ *
+ * @throw KError on any error. No exception indicates success.
+ */
+ void execute()
+ throw (KError);
+
+ private:
+};
+
+//}}}
+
+#endif /* CALIBRATE_H */
+
+// vim: set sw=4 ts=4 fdm=marker et: :collapseFolds=1:
--- a/kdumptool/main.cc
+++ b/kdumptool/main.cc
@@ -38,6 +38,7 @@
#include "read_ikconfig.h"
#include "read_vmcoreinfo.h"
#include "savedump.h"
+#include "calibrate.h"
using std::cerr;
using std::cout;
@@ -61,6 +62,7 @@ int main(int argc, char *argv[])
kdt.addSubcommand(new ReadIKConfig);
kdt.addSubcommand(new ReadVmcoreinfo);
kdt.addSubcommand(new SaveDump);
+ kdt.addSubcommand(new Calibrate);
kdt.parseCommandline(argc, argv);
kdt.readConfiguration();

View File

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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0668537bf197b5e49a27d245f45dbcf753aae52f2b133e304c1420a9157cbd83
size 107201

3
kdump-0.8.9.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c94bd8c4c577fc05db4d01f07b0cdb794d94588c1bede848fe99afc0ff8b1133
size 109350

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Fri Feb 28 19:18:00 UTC 2014 - ptesarik@suse.cz
- Update to 0.8.9
o fix dracut support
o fix dump save when /boot is not a mount point
- kdumptool_find_kernel.patch: Dropped.
-------------------------------------------------------------------
Fri Feb 28 17:21:29 UTC 2014 - ptesarik@suse.cz
- Update to 0.8.8
o dracut support
o new kdumptool command: calibrate
o new kdumptool flag: NOSPLIT
o better support for SMP dumps
- kdump-0.8.7-bsp.patch: Dropped.
- kdump-0.8.7-calibrate.patch: Dropped.
- kdump-0.8.7-nr_cpus.patch: Dropped.
-------------------------------------------------------------------
Fri Feb 14 16:14:45 UTC 2014 - ptesarik@suse.cz

View File

@ -16,10 +16,12 @@
#
%define dracutlibdir %{_prefix}/lib/dracut
Url: http://freehg.org/u/bwalle/kdump/
Name: kdump
Version: 0.8.7
Version: 0.8.9
Release: 0
Requires: curl
Requires: makedumpfile
@ -47,10 +49,6 @@ PreReq: %insserv_prereq %fillup_prereq mkinitrd
Source: %{name}-%{version}.tar.bz2
Source2: %{name}-%{version}-rpmlintrc
Source3: kdump.service
Patch1: kdumptool_find_kernel.patch
Patch2: %{name}-%{version}-nr_cpus.patch
Patch3: %{name}-%{version}-bsp.patch
Patch4: %{name}-%{version}-calibrate.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = %{version}
@ -88,10 +86,6 @@ Authors:
%prep
%setup
%patch1 -p0
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
export CFLAGS="%optflags"
@ -181,6 +175,10 @@ rm -rf $RPM_BUILD_ROOT
/lib/mkinitrd/scripts/*-kdump.sh
/lib/mkinitrd/scripts/setup-kdumpfs.sh
/lib/mkinitrd/scripts/setup-mkdumprd.sh
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%dir %{dracutlibdir}/modules.d/99kdump
%{dracutlibdir}/modules.d/99kdump/*
%dir /lib/kdump
/lib/kdump/*
%config %{_sysconfdir}/udev/rules.d/70-kdump.rules

View File

@ -1,11 +0,0 @@
--- init/rc.kdump.functions.old 2014-01-13 07:35:41.000000000 +0100
+++ init/rc.kdump.functions 2014-02-14 12:46:28.375308000 +0100
@@ -261,7 +261,7 @@
find_kernel_args="-D"
fi
- local output=$(kdumptool find_kernel $find_kernel_args)
+ local output=$(kdumptool $find_kernel_args find_kernel)
if [ $? -ne 0 ] ; then
rc_status -s
rc_failed 6