From 1baf7a9ee16bf7fe91b1c13ad5cb5852f28ecd1d Mon Sep 17 00:00:00 2001 From: Ingo Molnar 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 Signed-off-by: Thomas Gleixner Signed-off-by: Paul Gortmaker --- kernel/sys.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/kernel/sys.c b/kernel/sys.c index 7cb426a..0d2f6d2 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -285,6 +286,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.0.4