blob: 7a35e687611585a88d4ab7677072cb6beb62e243 [file] [log] [blame]
From b056c23ea69a28dac3b97e9296cac895e0fcc386 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@elte.hu>
Date: Fri, 3 Jul 2009 08:44:00 -0500
Subject: [PATCH] rt: call reboot notifier list when doing an emergency reboot
commit b056c23ea69a28dac3b97e9296cac895e0fcc386 in tip.
my laptop does not reboot unless the shutdown notifiers are called
first. So the following command, which i use as a fast way to reboot
into a new kernel:
echo b > /proc/sysrq-trigger
just hangs indefinitely after the kernel prints "System rebooting".
the thing is, that the kernel is actually reschedulable in this stage,
so we could as well process the reboot_notifier_list. (furthermore,
on -rt kernels this place is preemptable even during SysRq-b)
So just process the reboot notifier list if we are preemptable. This
will shut disk caches and chipsets off.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/kernel/sys.c b/kernel/sys.c
index b3f1097..eb040a4 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -33,6 +33,7 @@
#include <linux/getcpu.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/seccomp.h>
+#include <linux/hardirq.h>
#include <linux/cpu.h>
#include <linux/ptrace.h>
#include <linux/fs_struct.h>
@@ -280,6 +281,15 @@ out_unlock:
*/
void emergency_restart(void)
{
+ /*
+ * Call the notifier chain if we are not in an
+ * atomic context:
+ */
+#ifdef CONFIG_PREEMPT
+ if (!in_atomic() && !irqs_disabled())
+ blocking_notifier_call_chain(&reboot_notifier_list,
+ SYS_RESTART, NULL);
+#endif
machine_emergency_restart();
}
EXPORT_SYMBOL_GPL(emergency_restart);
--
1.7.1.1