ee95057247
Improve SMP handling OBS-URL: https://build.opensuse.org/request/show/505875 OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=135
177 lines
6.2 KiB
Diff
177 lines
6.2 KiB
Diff
From: Petr Tesarik <ptesarik@suse.com>
|
|
Date: Fri Jun 23 13:43:15 2017 +0200
|
|
Subject: Treat KDUMP_CPUS=0 as "all available CPUs"
|
|
References: bsc#1036223
|
|
Upstream: v0.8.17
|
|
Git-commit: 34192abe9a0f5ddbcd580fa52b7fa4400533b9a4
|
|
|
|
Since SMP after crash is now considered stable, remove the warnings and
|
|
make the feature more useful by not requiring a fixed number of CPUs.
|
|
|
|
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
|
|
|
---
|
|
doc/man/kdump.5.txt.in | 7 +++----
|
|
init/load.sh | 7 +++++--
|
|
kdumptool/calibrate.cc | 6 +++---
|
|
kdumptool/savedump.cc | 23 ++++++++++++++---------
|
|
kdumptool/savedump.h | 2 +-
|
|
sysconfig.kdump.in | 7 +------
|
|
6 files changed, 27 insertions(+), 25 deletions(-)
|
|
|
|
--- a/doc/man/kdump.5.txt.in
|
|
+++ b/doc/man/kdump.5.txt.in
|
|
@@ -136,13 +136,12 @@ the number of CPUs in your system.
|
|
This parameter modifies the _maxcpus_ parameter of the kdump kernel and
|
|
the number of *makedumpfile*(8) processes created.
|
|
|
|
+If the value is zero, all available CPUs are used, i.e. the _maxcpus_
|
|
+parameter is not added to the kdump kernel command line.
|
|
+
|
|
*Note:* This parameter does not work properly for the _ELF_ format,
|
|
because *makedumpfile*(8) does not support split _ELF_ dump files.
|
|
|
|
-*WARNING:* SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL!
|
|
-SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION
|
|
-OF THE DUMP KERNEL IF KDUMP_CPUS > 1.
|
|
-
|
|
Default is 1.
|
|
|
|
|
|
--- a/init/load.sh
|
|
+++ b/init/load.sh
|
|
@@ -63,14 +63,17 @@ function build_kdump_commandline()
|
|
local commandline="$KDUMP_COMMANDLINE"
|
|
|
|
if [ -z "$commandline" ] ; then
|
|
- local nr_cpus=$(cpus_param "$kdump_kernel")
|
|
+ local nr_cpus
|
|
commandline=$(
|
|
remove_from_commandline \
|
|
'root|resume|crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable|unknown_nmi_panic|rd\.udev\.children-max' \
|
|
< /proc/cmdline)
|
|
+ if [ ${KDUMP_CPUS:-1} -ne 0 ] ; then
|
|
+ nr_cpus=$(cpus_param "$kdump_kernel")=${KDUMP_CPUS:-1}
|
|
+ fi
|
|
# Use deadline for saving the memory footprint
|
|
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"
|
|
- commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}"
|
|
+ commandline="$commandline irqpoll ${nr_cpus}"
|
|
commandline="$commandline root=kdump rootflags=bind rd.udev.children-max=8"
|
|
case $(uname -i) in
|
|
i?86|x86_64)
|
|
--- a/kdumptool/calibrate.cc
|
|
+++ b/kdumptool/calibrate.cc
|
|
@@ -905,10 +905,10 @@ void Calibrate::execute()
|
|
}
|
|
|
|
// Add memory based on CPU count
|
|
- unsigned long cpus;
|
|
- if (CAN_REDUCE_CPUS) {
|
|
+ unsigned long cpus = 0;
|
|
+ if (CAN_REDUCE_CPUS)
|
|
cpus = config->KDUMP_CPUS.value();
|
|
- } else {
|
|
+ if (!cpus) {
|
|
SystemCPU syscpu;
|
|
unsigned long online = syscpu.numOnline();
|
|
unsigned long offline = syscpu.numOffline();
|
|
--- a/kdumptool/savedump.cc
|
|
+++ b/kdumptool/savedump.cc
|
|
@@ -41,6 +41,7 @@
|
|
#include "identifykernel.h"
|
|
#include "email.h"
|
|
#include "routable.h"
|
|
+#include "calibrate.h"
|
|
|
|
using std::string;
|
|
using std::list;
|
|
@@ -60,7 +61,7 @@ using std::ifstream;
|
|
SaveDump::SaveDump()
|
|
throw ()
|
|
: m_dump(DEFAULT_DUMP), m_transfer(NULL), m_usedDirectSave(false),
|
|
- m_useMakedumpfile(false), m_useSplit(false), m_nomail(false)
|
|
+ m_useMakedumpfile(false), m_split(0), m_nomail(false)
|
|
{
|
|
Debug::debug()->trace("SaveDump::SaveDump()");
|
|
|
|
@@ -284,10 +285,15 @@ void SaveDump::saveDump(const RootDirURL
|
|
if (noDump)
|
|
return; // nothing to be done
|
|
|
|
+ unsigned long cpus = config->KDUMP_CPUS.value();
|
|
+ if (cpus) {
|
|
+ SystemCPU syscpu;
|
|
+ cpus = syscpu.numOnline();
|
|
+ }
|
|
if (!config->kdumptoolContainsFlag("NOSPLIT") &&
|
|
- config->KDUMP_CPUS.value() > 1) {
|
|
+ cpus > 1) {
|
|
if (!useElf)
|
|
- m_useSplit = true;
|
|
+ m_split = cpus;
|
|
else
|
|
cerr << "Splitting ELF dumps is not supported." << endl;
|
|
}
|
|
@@ -305,7 +311,7 @@ void SaveDump::saveDump(const RootDirURL
|
|
// use makedumpfile
|
|
ostringstream cmdline;
|
|
cmdline << "makedumpfile ";
|
|
- if (m_useSplit)
|
|
+ if (m_split)
|
|
cmdline << "--split ";
|
|
cmdline << config->MAKEDUMPFILE_OPTIONS.value() << " ";
|
|
cmdline << "-d " << config->KDUMP_DUMPLEVEL.value() << " ";
|
|
@@ -340,10 +346,9 @@ void SaveDump::saveDump(const RootDirURL
|
|
provider->setProgress(&progress);
|
|
else
|
|
cout << "Saving dump ..." << endl;
|
|
- if (m_useSplit) {
|
|
+ if (m_split) {
|
|
StringVector targets;
|
|
- const int cpus = config->KDUMP_CPUS.value();
|
|
- for (int i = 1; i <= cpus; ++i) {
|
|
+ for (unsigned long i = 1; i <= m_split; ++i) {
|
|
ostringstream ss;
|
|
ss << "vmcore" << i;
|
|
targets.push_back(ss.str());
|
|
@@ -482,8 +487,8 @@ void SaveDump::generateInfo()
|
|
ss << "Dump level : "
|
|
<< Stringutil::number2string(config->KDUMP_DUMPLEVEL.value()) << endl;
|
|
ss << "Dump format : " << config->KDUMP_DUMPFORMAT.value() << endl;
|
|
- if (m_useSplit && m_usedDirectSave)
|
|
- ss << "Split parts : " << config->KDUMP_CPUS.value() << endl;
|
|
+ if (m_split && m_usedDirectSave)
|
|
+ ss << "Split parts : " << m_split << endl;
|
|
ss << endl;
|
|
|
|
|
|
--- a/kdumptool/savedump.h
|
|
+++ b/kdumptool/savedump.h
|
|
@@ -112,7 +112,7 @@ class SaveDump : public Subcommand {
|
|
Transfer *m_transfer;
|
|
bool m_usedDirectSave;
|
|
bool m_useMakedumpfile;
|
|
- bool m_useSplit;
|
|
+ unsigned long m_split;
|
|
std::string m_crashtime;
|
|
std::string m_crashrelease;
|
|
std::string m_rootdir;
|
|
--- a/sysconfig.kdump.in
|
|
+++ b/sysconfig.kdump.in
|
|
@@ -18,13 +18,8 @@ KDUMP_KERNELVER=""
|
|
#
|
|
# Number of CPUs to be used in the kdump environment. You may want to
|
|
# increase the number if computing power is the bottleneck in your setup.
|
|
-# This value is used as the maxcpus parameter of the secondary kernel, so
|
|
-# DON'T CHANGE IT unless your system can reliably re-initialize SMP after
|
|
-# a kernel crash.
|
|
#
|
|
-# WARNING: SETTING THIS NUMBER TO A NUMBER HIGHER THAN 1 IS EXPERIMENTAL!
|
|
-# SOME MACHINES ARE KNOWN TO HANG OR REBOOT RANDOMLY DURING INITIALISATION
|
|
-# OF THE DUMP KERNEL IF KDUMP_CPUS > 1.
|
|
+# If the value is zero, use all available CPUs.
|
|
#
|
|
# See also: kdump(5).
|
|
#
|