forked from pool/kdump
This commit is contained in:
parent
57c1b817cd
commit
4f7ecd0aaf
@ -8,16 +8,18 @@ It makes sense to generate a dump when NMI is encountered.
|
||||
Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
init/kdump | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
init/kdump | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/init/kdump
|
||||
+++ b/init/kdump
|
||||
@@ -214,6 +214,7 @@ load_kdump()
|
||||
@@ -214,6 +214,9 @@ load_kdump()
|
||||
if rc_status ; then
|
||||
result="Success"
|
||||
echo 1 > /proc/sys/kernel/panic_on_oops
|
||||
+ echo 1 > /proc/sys/kernel/panic_on_unrecovered_nmi
|
||||
+ if [ -f /proc/sys/kernel/panic_on_unrecovered_nmi ] ; then
|
||||
+ echo 1 > /proc/sys/kernel/panic_on_unrecovered_nmi
|
||||
+ fi
|
||||
else
|
||||
echo $result
|
||||
fi
|
||||
|
131
kdump-reload-memory-hotplug
Normal file
131
kdump-reload-memory-hotplug
Normal file
@ -0,0 +1,131 @@
|
||||
From: Bernhard Walle <bwalle@suse.de>
|
||||
Subject: [PATCH] Add udev rule to reload kdump
|
||||
References: bnc#389658
|
||||
|
||||
This patch
|
||||
|
||||
- implements "try-restart" in the init script
|
||||
- adds a udev rule that uses "try-restart" to reload the kdump kernel
|
||||
in case of a memory or CPU hot plug event
|
||||
|
||||
|
||||
Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
||||
|
||||
---
|
||||
Makefile | 1 +
|
||||
init/kdump | 47 +++++++++++++++++++++++++++++++++++------------
|
||||
udev/70-kdump.rules | 12 ++++++++++++
|
||||
udev/Makefile | 9 +++++++++
|
||||
4 files changed, 57 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -30,6 +30,7 @@ install:
|
||||
make -C init install
|
||||
make -C gdb install
|
||||
make -C config install
|
||||
+ make -C udev install
|
||||
|
||||
clean:
|
||||
make -C src clean
|
||||
--- a/init/kdump
|
||||
+++ b/init/kdump
|
||||
@@ -1,4 +1,4 @@
|
||||
-#! /bin/sh
|
||||
+#!/bin/bash
|
||||
#
|
||||
# Copyright 2005 Red Hat, Inc.
|
||||
# Author: Jeff Moyer <jmoyer@redhat.com>
|
||||
@@ -36,6 +36,25 @@ KDUMP_IDENTIFY_KERNEL=/usr/sbin/kdump-id
|
||||
|
||||
BOOTDIR="/boot"
|
||||
|
||||
+#
|
||||
+# Checks if currently a kdump kernel is loaded.
|
||||
+#
|
||||
+# Returns: 0 (true) if a kdump kernel is loaded,
|
||||
+# 1 (false) if the kdump kernel is not loaded and
|
||||
+# -1 (false) if the feature is not implemented (too old kernel)
|
||||
+kdump_kernel_loaded()
|
||||
+{
|
||||
+ if [ -r /sys/kernel/kexec_crash_loaded ]; then
|
||||
+ if [ "$(cat /sys/kernel/kexec_crash_loaded)" = "1" ]; then
|
||||
+ return 0
|
||||
+ else
|
||||
+ return 1
|
||||
+ fi
|
||||
+ else
|
||||
+ return -1
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
# The default dumper
|
||||
#
|
||||
# Clean up old stuff if necessary, check the free size
|
||||
@@ -301,24 +320,28 @@ case "$1" in
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
- if [ -r /sys/kernel/kexec_crash_loaded ]; then
|
||||
- if [ "$(cat /sys/kernel/kexec_crash_loaded)" = "1" ]; then
|
||||
- echo "kdump kernel loaded"
|
||||
- else
|
||||
- echo "kdump kernel not loaded"
|
||||
- fi
|
||||
- else
|
||||
- echo "not implemented"
|
||||
- fi
|
||||
+ kdump_kernel_loaded
|
||||
+ loaded=$?
|
||||
+ case $? in
|
||||
+ 0) echo "kdump kernel loaded" ;;
|
||||
+ 1) echo "kdump kernel not loaded" ;;
|
||||
+ -1) echo "not implemented" ;;
|
||||
+ esac
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
- condrestart)
|
||||
+ condrestart|try-restart)
|
||||
+ if kdump_kernel_loaded ; then
|
||||
+ $0 start
|
||||
+ else
|
||||
+ rc_reset
|
||||
+ fi
|
||||
+ rc_status
|
||||
;;
|
||||
*)
|
||||
- echo $"Usage: $0 {start|stop|status|restart|reload}"
|
||||
+ echo $"Usage: $0 {start|stop|status|restart|reload|try-reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
--- /dev/null
|
||||
+++ b/udev/70-kdump.rules
|
||||
@@ -0,0 +1,12 @@
|
||||
+#
|
||||
+# Kdump core headers needs to be regnerated if the CPUs or memory changes.
|
||||
+# For this, reload kdump.
|
||||
+#
|
||||
+# Novell Bug #389658
|
||||
+#
|
||||
+
|
||||
+SUBSYSTEM=="cpu", ACTION=="online", PROGRAM="/etc/init.d/kdump try-restart"
|
||||
+SUBSYSTEM=="cpu", ACTION=="offline", PROGRAM="/etc/init.d/kdump try-restart"
|
||||
+SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/etc/init.d/kdump try-restart"
|
||||
+SUBSYSTEM=="memory", ACTION=="remove", PROGRAM="/etc/init.d/kdump try-restart"
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/udev/Makefile
|
||||
@@ -0,0 +1,9 @@
|
||||
+# Simple makefile to build kdump-helper
|
||||
+#
|
||||
+# (c) 2008, Bernhard Walle <bwalle@suse.de>, SUSE LINUX Products GmbH
|
||||
+
|
||||
+
|
||||
+install:
|
||||
+ mkdir -p $(DESTDIR)$(SYSCONFDIR)/udev/rules.d
|
||||
+ install -m 0644 70-kdump.rules $(DESTDIR)$(SYSCONFDIR)/udev/rules.d
|
||||
+
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon May 19 20:24:48 CEST 2008 - bwalle@suse.de
|
||||
|
||||
- implement "try-restart" command and use that implementation also
|
||||
for "condrestart"
|
||||
- add udev rules to reload kdump configuration on memory or CPU
|
||||
hotplug (bnc#389658)
|
||||
- set panic_on_unrecovered_nmi only when it exists
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 13 16:27:48 CEST 2008 - bwalle@suse.de
|
||||
|
||||
|
11
kdump.spec
11
kdump.spec
@ -15,7 +15,7 @@ Name: kdump
|
||||
License: GPL v2 or later
|
||||
BuildRequires: libelf0-devel zlib-devel
|
||||
Version: 0.3.3
|
||||
Release: 24
|
||||
Release: 26
|
||||
Requires: curl openssh
|
||||
Recommends: makedumpfile
|
||||
Summary: Script for kdump
|
||||
@ -28,6 +28,7 @@ Source: %{name}-%{version}.tar.bz2
|
||||
Source1: 02-keyboard-blink.sh
|
||||
Patch0: %{name}-clarify-README
|
||||
Patch1: kdump-default-nmi
|
||||
Patch2: kdump-reload-memory-hotplug
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
|
||||
Provides: kdump-helpers = 0.2.4
|
||||
@ -51,6 +52,7 @@ Authors:
|
||||
%setup
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
make CFLAGS="$RPM_OPT_FLAGS"
|
||||
@ -142,8 +144,15 @@ fi
|
||||
%endif
|
||||
/etc/init.d/kdump
|
||||
/var/adm/fillup-templates/sysconfig.kdump
|
||||
%{_sysconfdir}/udev/rules.d/70-kdump.rules
|
||||
|
||||
%changelog
|
||||
* Mon May 19 2008 bwalle@suse.de
|
||||
- implement "try-restart" command and use that implementation also
|
||||
for "condrestart"
|
||||
- add udev rules to reload kdump configuration on memory or CPU
|
||||
hotplug (bnc#389658)
|
||||
- set panic_on_unrecovered_nmi only when it exists
|
||||
* Tue May 13 2008 bwalle@suse.de
|
||||
- set panic_on_unrecovered_nmi as default (bnc#388736)
|
||||
* Fri Apr 18 2008 bwalle@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user