Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] Add emergency_restart()

When the kernel is working well and we want to restart cleanly
kernel_restart is the function to use. But in many instances
the kernel wants to reboot when thing are expected to be working
very badly such as from panic or a software watchdog handler.

This patch adds the function emergency_restart() so that
callers can be clear what semantics they expect when calling
restart. emergency_restart() is expected to be callable
from interrupt context and possibly reliable in even more
trying circumstances.

This is an initial generic implementation for all architectures.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Eric W. Biederman and committed by
Linus Torvalds
7c903473 abcd9e51

+166
+6
include/asm-alpha/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-arm/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-arm26/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-cris/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-frv/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+9
include/asm-generic/emergency-restart.h
··· 1 + #ifndef _ASM_GENERIC_EMERGENCY_RESTART_H 2 + #define _ASM_GENERIC_EMERGENCY_RESTART_H 3 + 4 + static inline void machine_emergency_restart(void) 5 + { 6 + machine_restart(NULL); 7 + } 8 + 9 + #endif /* _ASM_GENERIC_EMERGENCY_RESTART_H */
+6
include/asm-h8300/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-i386/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-ia64/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-m32r/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-m68k/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-m68knommu/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-mips/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-parisc/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-ppc/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-ppc64/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-s390/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-sh/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-sh64/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-sparc/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-sparc64/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-um/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-v850/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-x86_64/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+6
include/asm-xtensa/emergency-restart.h
··· 1 + #ifndef _ASM_EMERGENCY_RESTART_H 2 + #define _ASM_EMERGENCY_RESTART_H 3 + 4 + #include <asm-generic/emergency-restart.h> 5 + 6 + #endif /* _ASM_EMERGENCY_RESTART_H */
+7
include/linux/reboot.h
··· 64 64 extern void kernel_power_off(void); 65 65 extern void kernel_kexec(void); 66 66 67 + /* 68 + * Emergency restart, callable from an interrupt handler. 69 + */ 70 + 71 + extern void emergency_restart(void); 72 + #include <asm/emergency-restart.h> 73 + 67 74 #endif 68 75 69 76 #endif /* _LINUX_REBOOT_H */
+6
kernel/sys.c
··· 361 361 return retval; 362 362 } 363 363 364 + void emergency_restart(void) 365 + { 366 + machine_emergency_restart(); 367 + } 368 + EXPORT_SYMBOL_GPL(emergency_restart); 369 + 364 370 void kernel_restart(char *cmd) 365 371 { 366 372 notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);