diff options
author | Alexander Nyberg <alexn@telia.com> | 2005-06-25 17:58:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:54 -0400 |
commit | 6e274d144302068a00794ec22e73520c0615cb6f (patch) | |
tree | f7ea59ea47d3c5676fbac8d39e8deaa1f94146ae /kernel | |
parent | 86b1ae38c0a62409dc862a28e3f08920f55f944b (diff) |
[PATCH] kdump: Use real pt_regs from exception
Makes kexec_crashdump() take a pt_regs * as an argument. This allows to
get exact register state at the point of the crash. If we come from direct
panic assertion NULL will be passed and the current registers saved before
crashdump.
This hooks into two places:
die(): check the conditions under which we will panic when calling
do_exit and go there directly with the pt_regs that caused the fatal
fault.
die_nmi(): If we receive an NMI lockup while in the kernel use the
pt_regs and go directly to crash_kexec(). We're probably nested up badly
at this point so this might be the only chance to escape with proper
information.
Signed-off-by: Alexander Nyberg <alexn@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kexec.c | 13 | ||||
-rw-r--r-- | kernel/panic.c | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index a0411b3bd54a..277f22afe74b 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
19 | #include <linux/syscalls.h> | 19 | #include <linux/syscalls.h> |
20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
21 | #include <linux/hardirq.h> | ||
22 | |||
21 | #include <asm/page.h> | 23 | #include <asm/page.h> |
22 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
23 | #include <asm/io.h> | 25 | #include <asm/io.h> |
@@ -32,6 +34,13 @@ struct resource crashk_res = { | |||
32 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM | 34 | .flags = IORESOURCE_BUSY | IORESOURCE_MEM |
33 | }; | 35 | }; |
34 | 36 | ||
37 | int kexec_should_crash(struct task_struct *p) | ||
38 | { | ||
39 | if (in_interrupt() || !p->pid || p->pid == 1 || panic_on_oops) | ||
40 | return 1; | ||
41 | return 0; | ||
42 | } | ||
43 | |||
35 | /* | 44 | /* |
36 | * When kexec transitions to the new kernel there is a one-to-one | 45 | * When kexec transitions to the new kernel there is a one-to-one |
37 | * mapping between physical and virtual addresses. On processors | 46 | * mapping between physical and virtual addresses. On processors |
@@ -1010,7 +1019,7 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, | |||
1010 | } | 1019 | } |
1011 | #endif | 1020 | #endif |
1012 | 1021 | ||
1013 | void crash_kexec(void) | 1022 | void crash_kexec(struct pt_regs *regs) |
1014 | { | 1023 | { |
1015 | struct kimage *image; | 1024 | struct kimage *image; |
1016 | int locked; | 1025 | int locked; |
@@ -1028,7 +1037,7 @@ void crash_kexec(void) | |||
1028 | if (!locked) { | 1037 | if (!locked) { |
1029 | image = xchg(&kexec_crash_image, NULL); | 1038 | image = xchg(&kexec_crash_image, NULL); |
1030 | if (image) { | 1039 | if (image) { |
1031 | machine_crash_shutdown(); | 1040 | machine_crash_shutdown(regs); |
1032 | machine_kexec(image); | 1041 | machine_kexec(image); |
1033 | } | 1042 | } |
1034 | xchg(&kexec_lock, 0); | 1043 | xchg(&kexec_lock, 0); |
diff --git a/kernel/panic.c b/kernel/panic.c index 66f43d33cd80..74ba5f3e46c7 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -83,7 +83,7 @@ NORET_TYPE void panic(const char * fmt, ...) | |||
83 | * everything else. | 83 | * everything else. |
84 | * Do we want to call this before we try to display a message? | 84 | * Do we want to call this before we try to display a message? |
85 | */ | 85 | */ |
86 | crash_kexec(); | 86 | crash_kexec(NULL); |
87 | 87 | ||
88 | #ifdef CONFIG_SMP | 88 | #ifdef CONFIG_SMP |
89 | /* | 89 | /* |