aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sysrq.txt5
-rw-r--r--drivers/char/sysrq.c24
2 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index f98c2e31c143..136d817c01ba 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -72,6 +72,8 @@ On all - write a character to /proc/sysrq-trigger. eg:
72'b' - Will immediately reboot the system without syncing or unmounting 72'b' - Will immediately reboot the system without syncing or unmounting
73 your disks. 73 your disks.
74 74
75'c' - Will perform a kexec reboot in order to take a crashdump.
76
75'o' - Will shut your system off (if configured and supported). 77'o' - Will shut your system off (if configured and supported).
76 78
77's' - Will attempt to sync all mounted filesystems. 79's' - Will attempt to sync all mounted filesystems.
@@ -122,6 +124,9 @@ useful when you want to exit a program that will not let you switch consoles.
122re'B'oot is good when you're unable to shut down. But you should also 'S'ync 124re'B'oot is good when you're unable to shut down. But you should also 'S'ync
123and 'U'mount first. 125and 'U'mount first.
124 126
127'C'rashdump can be used to manually trigger a crashdump when the system is hung.
128The kernel needs to have been built with CONFIG_KEXEC enabled.
129
125'S'ync is great when your system is locked up, it allows you to sync your 130'S'ync is great when your system is locked up, it allows you to sync your
126disks and will certainly lessen the chance of data loss and fscking. Note 131disks and will certainly lessen the chance of data loss and fscking. Note
127that the sync hasn't taken place until you see the "OK" and "Done" appear 132that the sync hasn't taken place until you see the "OK" and "Done" appear
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index f59f7cbd525b..53b2c8fab00e 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -35,6 +35,7 @@
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/vt_kern.h> 36#include <linux/vt_kern.h>
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38#include <linux/kexec.h>
38 39
39#include <asm/ptrace.h> 40#include <asm/ptrace.h>
40 41
@@ -94,6 +95,21 @@ static struct sysrq_key_op sysrq_unraw_op = {
94}; 95};
95#endif /* CONFIG_VT */ 96#endif /* CONFIG_VT */
96 97
98#ifdef CONFIG_KEXEC
99/* crashdump sysrq handler */
100static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs,
101 struct tty_struct *tty)
102{
103 crash_kexec();
104}
105static struct sysrq_key_op sysrq_crashdump_op = {
106 .handler = sysrq_handle_crashdump,
107 .help_msg = "Crashdump",
108 .action_msg = "Trigger a crashdump",
109 .enable_mask = SYSRQ_ENABLE_DUMP,
110};
111#endif
112
97/* reboot sysrq handler */ 113/* reboot sysrq handler */
98static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, 114static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs,
99 struct tty_struct *tty) 115 struct tty_struct *tty)
@@ -273,8 +289,12 @@ static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = {
273 it is handled specially on the sparc 289 it is handled specially on the sparc
274 and will never arrive */ 290 and will never arrive */
275/* b */ &sysrq_reboot_op, 291/* b */ &sysrq_reboot_op,
276/* c */ NULL, 292#ifdef CONFIG_KEXEC
277/* d */ NULL, 293/* c */ &sysrq_crashdump_op,
294#else
295/* c */ NULL,
296#endif
297/* d */ NULL,
278/* e */ &sysrq_term_op, 298/* e */ &sysrq_term_op,
279/* f */ &sysrq_moom_op, 299/* f */ &sysrq_moom_op,
280/* g */ NULL, 300/* g */ NULL,