aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHorms <horms@verge.net.au>2006-12-12 03:49:03 -0500
committerTony Luck <tony.luck@intel.com>2006-12-12 13:11:00 -0500
commit45a98fc622ae700eed34eb2be00743910d50dbe1 (patch)
treee5e5279c25582a7d26c37af189330318fe0f42dd
parentadf142e379bd20ad906a7e36f722eaabb3b44b0c (diff)
[IA64] CONFIG_KEXEC/CONFIG_CRASH_DUMP permutations
Actually, on reflection I think that there is a good case for keeping the options separate. I am thinking particularly of people who want a very small crashdump kernel and thus don't want to compile in kexec. The patch below should fix things up so that all valid combinations of KEXEC, CRASH_DUMP and VMCORE compile cleanly - VMCORE depends on CRASH_DUMP which is why I said valid combinations. In a nutshell it just untangles unrelated code and switches around a few defines. Please note that it creats a new file, arch/ia64/kernel/crash_dump.c This is in keeping with the i386 implementation. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/kernel/Makefile1
-rw-r--r--arch/ia64/kernel/crash.c22
-rw-r--r--arch/ia64/kernel/crash_dump.c48
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/setup.c15
-rw-r--r--arch/ia64/kernel/smp.c4
-rw-r--r--arch/ia64/mm/contig.c6
7 files changed, 73 insertions, 25 deletions
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 8ae384eb5357..098ee605bf5e 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq/
29obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o 29obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o 30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o
31obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 31obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
32obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
32obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o 33obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o
33obj-$(CONFIG_AUDIT) += audit.o 34obj-$(CONFIG_AUDIT) += audit.o
34obj-$(CONFIG_PCI_MSI) += msi_ia64.o 35obj-$(CONFIG_PCI_MSI) += msi_ia64.o
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 0aabedf95dad..bc2f64d72244 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -19,29 +19,11 @@
19 19
20#include <asm/kdebug.h> 20#include <asm/kdebug.h>
21#include <asm/mca.h> 21#include <asm/mca.h>
22#include <asm/uaccess.h>
23 22
24int kdump_status[NR_CPUS]; 23int kdump_status[NR_CPUS];
25atomic_t kdump_cpu_freezed; 24atomic_t kdump_cpu_freezed;
26atomic_t kdump_in_progress; 25atomic_t kdump_in_progress;
27int kdump_on_init = 1; 26int kdump_on_init = 1;
28ssize_t
29copy_oldmem_page(unsigned long pfn, char *buf,
30 size_t csize, unsigned long offset, int userbuf)
31{
32 void *vaddr;
33
34 if (!csize)
35 return 0;
36 vaddr = __va(pfn<<PAGE_SHIFT);
37 if (userbuf) {
38 if (copy_to_user(buf, (vaddr + offset), csize)) {
39 return -EFAULT;
40 }
41 } else
42 memcpy(buf, (vaddr + offset), csize);
43 return csize;
44}
45 27
46static inline Elf64_Word 28static inline Elf64_Word
47*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data, 29*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
@@ -225,14 +207,10 @@ static ctl_table sys_table[] = {
225static int 207static int
226machine_crash_setup(void) 208machine_crash_setup(void)
227{ 209{
228 char *from = strstr(saved_command_line, "elfcorehdr=");
229 static struct notifier_block kdump_init_notifier_nb = { 210 static struct notifier_block kdump_init_notifier_nb = {
230 .notifier_call = kdump_init_notifier, 211 .notifier_call = kdump_init_notifier,
231 }; 212 };
232 int ret; 213 int ret;
233 if (from)
234 elfcorehdr_addr = memparse(from+11, &from);
235 saved_max_pfn = (unsigned long)-1;
236 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0) 214 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0)
237 return ret; 215 return ret;
238#ifdef CONFIG_SYSCTL 216#ifdef CONFIG_SYSCTL
diff --git a/arch/ia64/kernel/crash_dump.c b/arch/ia64/kernel/crash_dump.c
new file mode 100644
index 000000000000..83b8c91c1408
--- /dev/null
+++ b/arch/ia64/kernel/crash_dump.c
@@ -0,0 +1,48 @@
1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code.
3 *
4 * Created by: Simon Horman <horms@verge.net.au>
5 * Original code moved from kernel/crash.c
6 * Original code comment copied from the i386 version of this file
7 */
8
9#include <linux/errno.h>
10#include <linux/types.h>
11
12#include <linux/uaccess.h>
13
14/**
15 * copy_oldmem_page - copy one page from "oldmem"
16 * @pfn: page frame number to be copied
17 * @buf: target memory address for the copy; this can be in kernel address
18 * space or user address space (see @userbuf)
19 * @csize: number of bytes to copy
20 * @offset: offset in bytes into the page (based on pfn) to begin the copy
21 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
22 * otherwise @buf is in kernel address space, use memcpy().
23 *
24 * Copy a page from "oldmem". For this page, there is no pte mapped
25 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
26 *
27 * Calling copy_to_user() in atomic context is not desirable. Hence first
28 * copying the data to a pre-allocated kernel page and then copying to user
29 * space in non-atomic context.
30 */
31ssize_t
32copy_oldmem_page(unsigned long pfn, char *buf,
33 size_t csize, unsigned long offset, int userbuf)
34{
35 void *vaddr;
36
37 if (!csize)
38 return 0;
39 vaddr = __va(pfn<<PAGE_SHIFT);
40 if (userbuf) {
41 if (copy_to_user(buf, (vaddr + offset), csize)) {
42 return -EFAULT;
43 }
44 } else
45 memcpy(buf, (vaddr + offset), csize);
46 return csize;
47}
48
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 87c1c4f42872..a76add3e76a2 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1239,7 +1239,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1239 } else { 1239 } else {
1240 /* Dump buffered message to console */ 1240 /* Dump buffered message to console */
1241 ia64_mlogbuf_finish(1); 1241 ia64_mlogbuf_finish(1);
1242#ifdef CONFIG_CRASH_DUMP 1242#ifdef CONFIG_KEXEC
1243 atomic_set(&kdump_in_progress, 1); 1243 atomic_set(&kdump_in_progress, 1);
1244 monarch_cpu = -1; 1244 monarch_cpu = -1;
1245#endif 1245#endif
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 14e1200376a9..66377baea6a5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -434,6 +434,21 @@ static __init int setup_nomca(char *s)
434} 434}
435early_param("nomca", setup_nomca); 435early_param("nomca", setup_nomca);
436 436
437#ifdef CONFIG_PROC_VMCORE
438/* elfcorehdr= specifies the location of elf core header
439 * stored by the crashed kernel.
440 */
441static int __init parse_elfcorehdr(char *arg)
442{
443 if (!arg)
444 return -EINVAL;
445
446 elfcorehdr_addr = memparse(arg, &arg);
447 return 0;
448}
449early_param("elfcorehdr", parse_elfcorehdr);
450#endif /* CONFIG_PROC_VMCORE */
451
437void __init 452void __init
438setup_arch (char **cmdline_p) 453setup_arch (char **cmdline_p)
439{ 454{
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index b1b9aa4364b9..f4c7f7769cf7 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -157,7 +157,7 @@ handle_IPI (int irq, void *dev_id)
157 case IPI_CPU_STOP: 157 case IPI_CPU_STOP:
158 stop_this_cpu(); 158 stop_this_cpu();
159 break; 159 break;
160#ifdef CONFIG_CRASH_DUMP 160#ifdef CONFIG_KEXEC
161 case IPI_KDUMP_CPU_STOP: 161 case IPI_KDUMP_CPU_STOP:
162 unw_init_running(kdump_cpu_freeze, NULL); 162 unw_init_running(kdump_cpu_freeze, NULL);
163 break; 163 break;
@@ -219,7 +219,7 @@ send_IPI_self (int op)
219 send_IPI_single(smp_processor_id(), op); 219 send_IPI_single(smp_processor_id(), op);
220} 220}
221 221
222#ifdef CONFIG_CRASH_DUMP 222#ifdef CONFIG_KEXEC
223void 223void
224kdump_smp_send_stop() 224kdump_smp_send_stop()
225{ 225{
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 82deaa3a7c48..fd103886bb0a 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -174,6 +174,12 @@ find_memory (void)
174 reserve_bootmem(bootmap_start, bootmap_size); 174 reserve_bootmem(bootmap_start, bootmap_size);
175 175
176 find_initrd(); 176 find_initrd();
177
178#ifdef CONFIG_CRASH_DUMP
179 /* If we are doing a crash dump, we still need to know the real mem
180 * size before original memory map is * reset. */
181 saved_max_pfn = max_pfn;
182#endif
177} 183}
178 184
179#ifdef CONFIG_SMP 185#ifdef CONFIG_SMP