| From eecbd6ef9eda9bf59c93550c7f022b1a6a23e77a 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 8298878..6a2e032 100644 |
| --- a/kernel/sys.c |
| +++ b/kernel/sys.c |
| @@ -32,6 +32,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/personality.h> |
| #include <linux/ptrace.h> |
| @@ -284,6 +285,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 |
| |