diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2009-07-29 18:04:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-29 22:10:36 -0400 |
commit | cab8bd3410d448279e3bd0fbf96d31db0bf770fa (patch) | |
tree | 2ad9262b2c4d10cc705c8553015caff06a29de11 /drivers/char | |
parent | f5a55efa140f5e9c9dd0f398fef54f20cdb74ec9 (diff) |
sysrq, kdump: make sysrq-c consistent
commit d6580a9f15238b87e618310c862231ae3f352d2d ("kexec: sysrq: simplify
sysrq-c handler") changed the behavior of sysrq-c to unconditional
dereference of NULL pointer. So in cases with CONFIG_KEXEC, where
crash_kexec() was directly called from sysrq-c before, now it can be said
that a step of "real oops" was inserted before starting kdump.
However, in contrast to oops via SysRq-c from keyboard which results in
panic due to in_interrupt(), oops via "echo c > /proc/sysrq-trigger" will
not become panic unless panic_on_oops=1. It means that even if dump is
properly configured to be taken on panic, the sysrq-c from proc interface
might not start crashdump while the sysrq-c from keyboard can start
crashdump. This confuses traditional users of kdump, i.e. people who
expect sysrq-c to do common behavior in both of the keyboard and proc
interface.
This patch brings the keyboard and proc interface behavior of sysrq-c in
line, by forcing panic_on_oops=1 before oops in sysrq-c handler.
And some updates in documentation are included, to clarify that there is
no longer dependency with CONFIG_KEXEC, and that now the system can just
crash by sysrq-c if no dump mechanism is configured.
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Brayan Arraes <brayan@yack.com.br>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/sysrq.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 0db35857e4d8..5d7a02f63e1c 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -35,7 +35,6 @@ | |||
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> | ||
39 | #include <linux/hrtimer.h> | 38 | #include <linux/hrtimer.h> |
40 | #include <linux/oom.h> | 39 | #include <linux/oom.h> |
41 | 40 | ||
@@ -124,9 +123,12 @@ static struct sysrq_key_op sysrq_unraw_op = { | |||
124 | static void sysrq_handle_crash(int key, struct tty_struct *tty) | 123 | static void sysrq_handle_crash(int key, struct tty_struct *tty) |
125 | { | 124 | { |
126 | char *killer = NULL; | 125 | char *killer = NULL; |
126 | |||
127 | panic_on_oops = 1; /* force panic */ | ||
128 | wmb(); | ||
127 | *killer = 1; | 129 | *killer = 1; |
128 | } | 130 | } |
129 | static struct sysrq_key_op sysrq_crashdump_op = { | 131 | static struct sysrq_key_op sysrq_crash_op = { |
130 | .handler = sysrq_handle_crash, | 132 | .handler = sysrq_handle_crash, |
131 | .help_msg = "Crash", | 133 | .help_msg = "Crash", |
132 | .action_msg = "Trigger a crash", | 134 | .action_msg = "Trigger a crash", |
@@ -401,7 +403,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
401 | */ | 403 | */ |
402 | NULL, /* a */ | 404 | NULL, /* a */ |
403 | &sysrq_reboot_op, /* b */ | 405 | &sysrq_reboot_op, /* b */ |
404 | &sysrq_crashdump_op, /* c & ibm_emac driver debug */ | 406 | &sysrq_crash_op, /* c & ibm_emac driver debug */ |
405 | &sysrq_showlocks_op, /* d */ | 407 | &sysrq_showlocks_op, /* d */ |
406 | &sysrq_term_op, /* e */ | 408 | &sysrq_term_op, /* e */ |
407 | &sysrq_moom_op, /* f */ | 409 | &sysrq_moom_op, /* f */ |