* [PATCH 0/8] Initial implementation of kdump for ARM
@ 2010-04-20 8:50 Mika Westerberg
2010-04-20 8:50 ` [PATCH 1/8] arm: kdump: reserve memory for crashkernel Mika Westerberg
` (9 more replies)
0 siblings, 10 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
This is revised series of kdump code, now without "RFC"-prefix. Original
series can be found here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/012353.html
Changes to previous version:
- crash_setup_regs() uses Russell's suggestion for saving registers
- copy_oldmem_page() code is changed to use ioremap()
- there is no need for special 'mem=' parameters
I've been testing this on my N900.
I have patches for kexec-tools ready and send them once this kernel part is
accepted.
As a sidenote: I got crashkernel booting correctly just by modifying PHYS_OFFSET
and mach/Makefile.boot for my platform. So it is enough just to pass 'mem=size'
to dump capture kernel. This is documented in Kconfig CONFIG_CRASH_DUMP.
Regards,
MW
Mika Westerberg (8):
arm: kdump: reserve memory for crashkernel
arm: kdump: implement crash_setup_regs()
arm: kdump: implement machine_crash_shutdown()
arm: kdump: skip indirection page when crashing
arm: kdump: implement copy_oldmem_page()
arm: allow passing an ELF64 header to elf_check_arch()
arm: kdump: add support for elfcorehdr= parameter
arm: kdump: add CONFIG_CRASH_DUMP Kconfig option
arch/arm/Kconfig | 12 ++++++
arch/arm/include/asm/elf.h | 4 +-
arch/arm/include/asm/kexec.h | 22 +++++++++-
arch/arm/kernel/Makefile | 1 +
arch/arm/kernel/crash_dump.c | 58 ++++++++++++++++++++++++++++
arch/arm/kernel/elf.c | 6 ++-
arch/arm/kernel/machine_kexec.c | 4 ++
arch/arm/kernel/relocate_kernel.S | 6 +++
arch/arm/kernel/setup.c | 76 +++++++++++++++++++++++++++++++++++++
9 files changed, 182 insertions(+), 7 deletions(-)
create mode 100644 arch/arm/kernel/crash_dump.c
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/8] arm: kdump: reserve memory for crashkernel
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 2/8] arm: kdump: implement crash_setup_regs() Mika Westerberg
` (8 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Implemented ARM support for command line option "crashkernel=size at start" which
allows user to reserve some memory for a dump capture kernel.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/kernel/setup.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index c91c77b..076454f 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -19,6 +19,7 @@
#include <linux/seq_file.h>
#include <linux/screen_info.h>
#include <linux/init.h>
+#include <linux/kexec.h>
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
@@ -661,6 +662,55 @@ static int __init customize_machine(void)
}
arch_initcall(customize_machine);
+#ifdef CONFIG_KEXEC
+static inline unsigned long long get_total_mem(void)
+{
+ unsigned long total;
+
+ total = max_low_pfn - min_low_pfn;
+ return total << PAGE_SHIFT;
+}
+
+/**
+ * reserve_crashkernel() - reserves memory are for crash kernel
+ *
+ * This function reserves memory area given in "crashkernel=" kernel command
+ * line parameter. The memory reserved is used by a dump capture kernel when
+ * primary kernel is crashing.
+ */
+static void __init reserve_crashkernel(void)
+{
+ unsigned long long crash_size, crash_base;
+ unsigned long long total_mem;
+ int ret;
+
+ total_mem = get_total_mem();
+ ret = parse_crashkernel(boot_command_line, total_mem,
+ &crash_size, &crash_base);
+ if (ret)
+ return;
+
+ ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
+ if (ret < 0) {
+ printk(KERN_WARNING "crashkernel reservation failed - "
+ "memory is in use (0x%lx)\n", (unsigned long)crash_base);
+ return;
+ }
+
+ printk(KERN_INFO "Reserving %ldMB of memory@%ldMB "
+ "for crashkernel (System RAM: %ldMB)\n",
+ (unsigned long)(crash_size >> 20),
+ (unsigned long)(crash_base >> 20),
+ (unsigned long)(total_mem >> 20));
+
+ crashk_res.start = crash_base;
+ crashk_res.end = crash_base + crash_size - 1;
+ insert_resource(&iomem_resource, &crashk_res);
+}
+#else
+static inline void reserve_crashkernel(void) {}
+#endif /* CONFIG_KEXEC */
+
void __init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag *)&init_tags;
@@ -720,6 +770,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_SMP
smp_init_cpus();
#endif
+ reserve_crashkernel();
cpu_init();
tcm_init();
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/8] arm: kdump: implement crash_setup_regs()
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
2010-04-20 8:50 ` [PATCH 1/8] arm: kdump: reserve memory for crashkernel Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 3/8] arm: kdump: implement machine_crash_shutdown() Mika Westerberg
` (7 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Implement machine specific function crash_setup_regs() which is responsible for
storing machine state when crash occured.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/include/asm/kexec.h | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index df15a0d..8df7e5f 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -19,10 +19,26 @@
#ifndef __ASSEMBLY__
-struct kimage;
-/* Provide a dummy definition to avoid build failures. */
+/*
+ * crash_setup_regs() - save registers for the panic kernel
+ * @newregs: registers are saved here
+ * @oldregs: registers to be saved (may be %NULL)
+ *
+ * Function copies machine registers from @oldregs to @newregs. If @oldregs is
+ * %NULL then current registers are stored there.
+ */
static inline void crash_setup_regs(struct pt_regs *newregs,
- struct pt_regs *oldregs) { }
+ struct pt_regs *oldregs)
+{
+ if (oldregs) {
+ memcpy(newregs, oldregs, sizeof(*newregs));
+ } else {
+ __asm__ __volatile__ ("stmia %0, {r0 - r15}"
+ : : "r" (&newregs->ARM_r0));
+ __asm__ __volatile__ ("mrs %0, cpsr"
+ : "=r" (newregs->ARM_cpsr));
+ }
+}
#endif /* __ASSEMBLY__ */
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/8] arm: kdump: implement machine_crash_shutdown()
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
2010-04-20 8:50 ` [PATCH 1/8] arm: kdump: reserve memory for crashkernel Mika Westerberg
2010-04-20 8:50 ` [PATCH 2/8] arm: kdump: implement crash_setup_regs() Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 4/8] arm: kdump: skip indirection page when crashing Mika Westerberg
` (6 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Implement function machine_crash_shutdown() which disables IRQs and saves
machine state to ELF notes structure.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/kernel/machine_kexec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 598ca61..81e9898 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -43,6 +43,10 @@ void machine_shutdown(void)
void machine_crash_shutdown(struct pt_regs *regs)
{
+ local_irq_disable();
+ crash_save_cpu(regs, smp_processor_id());
+
+ printk(KERN_INFO "Loading crashdump kernel...\n");
}
void machine_kexec(struct kimage *image)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/8] arm: kdump: skip indirection page when crashing
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (2 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 3/8] arm: kdump: implement machine_crash_shutdown() Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 5/8] arm: kdump: implement copy_oldmem_page() Mika Westerberg
` (5 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
When we are crashing there is no indirection page in place. Only control page is
present.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/kernel/relocate_kernel.S | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 61930eb..fd26f8d 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -10,6 +10,12 @@ relocate_new_kernel:
ldr r0,kexec_indirection_page
ldr r1,kexec_start_address
+ /*
+ * If there is no indirection page (we are doing crashdumps)
+ * skip any relocation.
+ */
+ cmp r0, #0
+ beq 2f
0: /* top, read another word for the indirection page */
ldr r3, [r0],#4
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/8] arm: kdump: implement copy_oldmem_page()
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (3 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 4/8] arm: kdump: skip indirection page when crashing Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 6/8] arm: allow passing an ELF64 header to elf_check_arch() Mika Westerberg
` (4 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
This function is used by vmcore code to read a page from the old kernel memory.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/kernel/Makefile | 1 +
arch/arm/kernel/crash_dump.c | 58 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/kernel/crash_dump.c
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 26d302c..ea023c6 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
obj-$(CONFIG_KGDB) += kgdb.o
obj-$(CONFIG_ARM_UNWIND) += unwind.o
obj-$(CONFIG_HAVE_TCM) += tcm.o
+obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c
new file mode 100644
index 0000000..facf852
--- /dev/null
+++ b/arch/arm/kernel/crash_dump.c
@@ -0,0 +1,58 @@
+/*
+ * arch/arm/kernel/crash_dump.c
+ *
+ * Copyright (C) 2010 Nokia Corporation.
+ * Author: Mika Westerberg
+ *
+ * This code is taken from arch/x86/kernel/crash_dump_64.c
+ * Created by: Hariprasad Nellitheertha (hari at in.ibm.com)
+ * Copyright (C) IBM Corporation, 2004. All rights reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/errno.h>
+#include <linux/crash_dump.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+
+/* stores the physical address of elf header of crash image */
+unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
+
+/**
+ * copy_oldmem_page() - copy one page from old kernel memory
+ * @pfn: page frame number to be copied
+ * @buf: buffer where the copied page is placed
+ * @csize: number of bytes to copy
+ * @offset: offset in bytes into the page
+ * @userbuf: if set, @buf is int he user address space
+ *
+ * This function copies one page from old kernel memory into buffer pointed by
+ * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes
+ * copied or negative error in case of failure.
+ */
+ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
+ size_t csize, unsigned long offset,
+ int userbuf)
+{
+ void *vaddr;
+
+ if (!csize)
+ return 0;
+
+ vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+
+ if (userbuf) {
+ if (copy_to_user(buf, vaddr + offset, csize)) {
+ iounmap(vaddr);
+ return -EFAULT;
+ }
+ } else {
+ memcpy(buf, vaddr + offset, csize);
+ }
+
+ iounmap(vaddr);
+ return csize;
+}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/8] arm: allow passing an ELF64 header to elf_check_arch()
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (4 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 5/8] arm: kdump: implement copy_oldmem_page() Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 7/8] arm: kdump: add support for elfcorehdr= parameter Mika Westerberg
` (3 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
This is needed to shut following compiler warning when CONFIG_PROC_VMCORE is
enabled:
fs/proc/vmcore.c: In function 'parse_crash_elf64_headers':
fs/proc/vmcore.c:500: warning: passing argument 1 of 'elf_check_arch' from
incompatible pointer type
ELF32 and ELF64 headers have common fields of same size (namely e_ident and
e_machine) which are checked in arm_elf_check_arch().
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/include/asm/elf.h | 4 ++--
arch/arm/kernel/elf.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index bff0564..aa71815 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -92,8 +92,8 @@ struct elf32_hdr;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
-extern int elf_check_arch(const struct elf32_hdr *);
-#define elf_check_arch elf_check_arch
+extern int arm_elf_check_arch(const struct elf32_hdr *);
+#define elf_check_arch(x) arm_elf_check_arch((const struct elf32_hdr *)(x))
extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int);
#define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(&(ex), stk)
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index d4a0da1..14e501b 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -4,11 +4,13 @@
#include <linux/binfmts.h>
#include <linux/elf.h>
-int elf_check_arch(const struct elf32_hdr *x)
+int arm_elf_check_arch(const struct elf32_hdr *x)
{
unsigned int eflags;
/* Make sure it's an ARM executable */
+ if (x->e_ident[EI_CLASS] != ELF_CLASS)
+ return 0;
if (x->e_machine != EM_ARM)
return 0;
@@ -35,7 +37,7 @@ int elf_check_arch(const struct elf32_hdr *x)
}
return 1;
}
-EXPORT_SYMBOL(elf_check_arch);
+EXPORT_SYMBOL(arm_elf_check_arch);
void elf_set_personality(const struct elf32_hdr *x)
{
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/8] arm: kdump: add support for elfcorehdr= parameter
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (5 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 6/8] arm: allow passing an ELF64 header to elf_check_arch() Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-20 8:50 ` [PATCH 8/8] arm: kdump: add CONFIG_CRASH_DUMP Kconfig option Mika Westerberg
` (2 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
This parameter is used by primary kernel to pass address of vmcore header to the
dump capture kernel.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/kernel/setup.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 076454f..25a1664 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -20,6 +20,7 @@
#include <linux/screen_info.h>
#include <linux/init.h>
#include <linux/kexec.h>
+#include <linux/crash_dump.h>
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
@@ -711,6 +712,30 @@ static void __init reserve_crashkernel(void)
static inline void reserve_crashkernel(void) {}
#endif /* CONFIG_KEXEC */
+/*
+ * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
+ * is_kdump_kernel() to determine if we are booting after a panic. Hence
+ * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
+ */
+
+#ifdef CONFIG_CRASH_DUMP
+/*
+ * elfcorehdr= specifies the location of elf core header stored by the crashed
+ * kernel. This option will be passed by kexec loader to the capture kernel.
+ */
+static int __init setup_elfcorehdr(char *arg)
+{
+ char *end;
+
+ if (!arg)
+ return -EINVAL;
+
+ elfcorehdr_addr = memparse(arg, &end);
+ return end > arg ? 0 : -EINVAL;
+}
+early_param("elfcorehdr", setup_elfcorehdr);
+#endif /* CONFIG_CRASH_DUMP */
+
void __init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag *)&init_tags;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/8] arm: kdump: add CONFIG_CRASH_DUMP Kconfig option
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (6 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 7/8] arm: kdump: add support for elfcorehdr= parameter Mika Westerberg
@ 2010-04-20 8:50 ` Mika Westerberg
2010-04-22 12:03 ` [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
2010-05-03 8:28 ` Mika Westerberg
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-20 8:50 UTC (permalink / raw)
To: linux-arm-kernel
Add CONFIG_CRASH_DUMP configuration option which is used by dump capture
kernels. Dump capture kernel must be loaded into different physical address
than the primary kernel. This means that PHYS_OFFSET must be different and
it also should match the 'crashkernel=size at start' value passed to primary
kernel command line.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
---
arch/arm/Kconfig | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c5408bf..b8c37dc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1466,6 +1466,18 @@ config ATAGS_PROC
Should the atags used to boot the kernel be exported in an "atags"
file in procfs. Useful with kexec.
+config CRASH_DUMP
+ bool "Build kdump crash kernel (EXPERIMENTAL)"
+ depends on EXPERIMENTAL
+ help
+ Build a kernel suitable for use as kdump capture kernel. This should
+ be set only on dump capture kernels. Note that dump capture kernel
+ must be loaded into different physical address than the primary kernel
+ (e.g set PHYS_OFFSET and related mach/Makefile.boot parameters
+ to match value given in 'crashkernel=size at start').
+
+ For more details see Documentation/kdump/kdump.txt
+
endmenu
menu "CPU Power Management"
--
1.5.6.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (7 preceding siblings ...)
2010-04-20 8:50 ` [PATCH 8/8] arm: kdump: add CONFIG_CRASH_DUMP Kconfig option Mika Westerberg
@ 2010-04-22 12:03 ` Mika Westerberg
2010-04-23 3:05 ` Janboe Ye
2010-05-03 8:28 ` Mika Westerberg
9 siblings, 1 reply; 18+ messages in thread
From: Mika Westerberg @ 2010-04-22 12:03 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 20, 2010 at 11:50:46AM +0300, Mika Westerberg wrote:
> Hello,
>
> This is revised series of kdump code, now without "RFC"-prefix. Original
> series can be found here:
>
> http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/012353.html
>
> Changes to previous version:
> - crash_setup_regs() uses Russell's suggestion for saving registers
> - copy_oldmem_page() code is changed to use ioremap()
> - there is no need for special 'mem=' parameters
>
> I've been testing this on my N900.
>
> I have patches for kexec-tools ready and send them once this kernel part is
> accepted.
Hi,
Any comments on this?
Thanks,
MW
>
> As a sidenote: I got crashkernel booting correctly just by modifying PHYS_OFFSET
> and mach/Makefile.boot for my platform. So it is enough just to pass 'mem=size'
> to dump capture kernel. This is documented in Kconfig CONFIG_CRASH_DUMP.
>
> Regards,
> MW
>
> Mika Westerberg (8):
> arm: kdump: reserve memory for crashkernel
> arm: kdump: implement crash_setup_regs()
> arm: kdump: implement machine_crash_shutdown()
> arm: kdump: skip indirection page when crashing
> arm: kdump: implement copy_oldmem_page()
> arm: allow passing an ELF64 header to elf_check_arch()
> arm: kdump: add support for elfcorehdr= parameter
> arm: kdump: add CONFIG_CRASH_DUMP Kconfig option
>
> arch/arm/Kconfig | 12 ++++++
> arch/arm/include/asm/elf.h | 4 +-
> arch/arm/include/asm/kexec.h | 22 +++++++++-
> arch/arm/kernel/Makefile | 1 +
> arch/arm/kernel/crash_dump.c | 58 ++++++++++++++++++++++++++++
> arch/arm/kernel/elf.c | 6 ++-
> arch/arm/kernel/machine_kexec.c | 4 ++
> arch/arm/kernel/relocate_kernel.S | 6 +++
> arch/arm/kernel/setup.c | 76 +++++++++++++++++++++++++++++++++++++
> 9 files changed, 182 insertions(+), 7 deletions(-)
> create mode 100644 arch/arm/kernel/crash_dump.c
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-22 12:03 ` [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
@ 2010-04-23 3:05 ` Janboe Ye
2010-04-23 4:11 ` Mika Westerberg
0 siblings, 1 reply; 18+ messages in thread
From: Janboe Ye @ 2010-04-23 3:05 UTC (permalink / raw)
To: linux-arm-kernel
I am trying this. But it seems need to do a lot work to make kdump
to work on other omap3 board.
Janboe
On Thu, Apr 22, 2010 at 03:03:08PM +0300, Mika Westerberg wrote:
> On Tue, Apr 20, 2010 at 11:50:46AM +0300, Mika Westerberg wrote:
> > Hello,
> >
> > This is revised series of kdump code, now without "RFC"-prefix. Original
> > series can be found here:
> >
> > http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/012353.html
> >
> > Changes to previous version:
> > - crash_setup_regs() uses Russell's suggestion for saving registers
> > - copy_oldmem_page() code is changed to use ioremap()
> > - there is no need for special 'mem=' parameters
> >
> > I've been testing this on my N900.
> >
> > I have patches for kexec-tools ready and send them once this kernel part is
> > accepted.
>
> Hi,
>
> Any comments on this?
>
> Thanks,
> MW
>
> >
> > As a sidenote: I got crashkernel booting correctly just by modifying PHYS_OFFSET
> > and mach/Makefile.boot for my platform. So it is enough just to pass 'mem=size'
> > to dump capture kernel. This is documented in Kconfig CONFIG_CRASH_DUMP.
> >
> > Regards,
> > MW
> >
> > Mika Westerberg (8):
> > arm: kdump: reserve memory for crashkernel
> > arm: kdump: implement crash_setup_regs()
> > arm: kdump: implement machine_crash_shutdown()
> > arm: kdump: skip indirection page when crashing
> > arm: kdump: implement copy_oldmem_page()
> > arm: allow passing an ELF64 header to elf_check_arch()
> > arm: kdump: add support for elfcorehdr= parameter
> > arm: kdump: add CONFIG_CRASH_DUMP Kconfig option
> >
> > arch/arm/Kconfig | 12 ++++++
> > arch/arm/include/asm/elf.h | 4 +-
> > arch/arm/include/asm/kexec.h | 22 +++++++++-
> > arch/arm/kernel/Makefile | 1 +
> > arch/arm/kernel/crash_dump.c | 58 ++++++++++++++++++++++++++++
> > arch/arm/kernel/elf.c | 6 ++-
> > arch/arm/kernel/machine_kexec.c | 4 ++
> > arch/arm/kernel/relocate_kernel.S | 6 +++
> > arch/arm/kernel/setup.c | 76 +++++++++++++++++++++++++++++++++++++
> > 9 files changed, 182 insertions(+), 7 deletions(-)
> > create mode 100644 arch/arm/kernel/crash_dump.c
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-23 3:05 ` Janboe Ye
@ 2010-04-23 4:11 ` Mika Westerberg
2010-04-23 4:26 ` Janboe Ye
2010-04-26 1:26 ` Joonyoung Shim
0 siblings, 2 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-23 4:11 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 23, 2010 at 05:05:56AM +0200, ext Janboe Ye wrote:
> I am trying this. But it seems need to do a lot work to make kdump
> to work on other omap3 board.
You need to have userspace tools (in this case kexec-tools) which load the
crashkernel into the running kernel. I'm planning to send my kexec-tools
patches to upstream after the kernel part is accepted (so that they can be
in sync) but I can provide you the patches if needed.
For kernel part, I believe only thing that needs to be done is to make sure
that PHYS_OFFSET of the crashkernel is configured correctly.
For example in my platform (and I guess all OMAP3s) physical memory starts
at 0x80000000 and this is the PHYS_OFFSET used by the primary kernel. I decided
to load crashkernel at physical address 0x84000000.
So I boot the primary kernel with 'crashkernel=32M at 0x84000000'. Now memory for
crashkernel is reserved.
Only thing left is to load the craskernel itself which is done like (with patched
kexec-tools):
# kexec -p /boot/zImage.crash --command-line="..."
What kind of problems you are having?
Thanks,
MW
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-23 4:11 ` Mika Westerberg
@ 2010-04-23 4:26 ` Janboe Ye
2010-04-23 4:53 ` Mika Westerberg
2010-04-27 10:05 ` Mika Westerberg
2010-04-26 1:26 ` Joonyoung Shim
1 sibling, 2 replies; 18+ messages in thread
From: Janboe Ye @ 2010-04-23 4:26 UTC (permalink / raw)
To: linux-arm-kernel
These are some other hard code address in some boards.
For example, beagle board boot_params is 0x80000100.
I guest nokia's Nseris does not use atags for transfering params.
When I test my relocated kernel, it blocks at machinee initialization.
Maybe there is other address mapping issue. I will look it tomorrow.
Janboe
On Fri, Apr 23, 2010 at 07:11:06AM +0300, Mika Westerberg wrote:
> On Fri, Apr 23, 2010 at 05:05:56AM +0200, ext Janboe Ye wrote:
> > I am trying this. But it seems need to do a lot work to make kdump
> > to work on other omap3 board.
>
> You need to have userspace tools (in this case kexec-tools) which load the
> crashkernel into the running kernel. I'm planning to send my kexec-tools
> patches to upstream after the kernel part is accepted (so that they can be
> in sync) but I can provide you the patches if needed.
>
> For kernel part, I believe only thing that needs to be done is to make sure
> that PHYS_OFFSET of the crashkernel is configured correctly.
>
> For example in my platform (and I guess all OMAP3s) physical memory starts
> at 0x80000000 and this is the PHYS_OFFSET used by the primary kernel. I decided
> to load crashkernel at physical address 0x84000000.
>
> So I boot the primary kernel with 'crashkernel=32M at 0x84000000'. Now memory for
> crashkernel is reserved.
>
> Only thing left is to load the craskernel itself which is done like (with patched
> kexec-tools):
>
> # kexec -p /boot/zImage.crash --command-line="..."
>
> What kind of problems you are having?
>
> Thanks,
> MW
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-23 4:26 ` Janboe Ye
@ 2010-04-23 4:53 ` Mika Westerberg
2010-04-27 10:05 ` Mika Westerberg
1 sibling, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-23 4:53 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 23, 2010 at 06:26:26AM +0200, ext Janboe Ye wrote:
> These are some other hard code address in some boards.
>
> For example, beagle board boot_params is 0x80000100.
>
> I guest nokia's Nseris does not use atags for transfering params.
>
> When I test my relocated kernel, it blocks at machinee initialization.
>
> Maybe there is other address mapping issue. I will look it tomorrow.
Yes, we use atags.
I have following changes on top of these patches. Note that you should also
change beagles board file so that it works with different PHYS_OFFSET (if you
are going to pass initrd, then that will need to be changed also).
I actually have beagleboard in home and I can try it there as well but I'll be
away weekend so it is going to happen earliest on monday.
Thanks,
MW
diff --git a/arch/arm/mach-omap2/Makefile.boot b/arch/arm/mach-omap2/Makefile.boot
index 565aff7..b958007 100644
--- a/arch/arm/mach-omap2/Makefile.boot
+++ b/arch/arm/mach-omap2/Makefile.boot
@@ -1,3 +1,8 @@
- zreladdr-y := 0x80008000
+ifeq ($(CONFIG_CRASH_DUMP),y)
+zreladdr-y := 0x84008000
+params_phys-y := 0x84000100
+else
+zreladdr-y := 0x80008000
params_phys-y := 0x80000100
+endif
initrd_phys-y := 0x80800000
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h
index 9ad41dc..596a130 100644
--- a/arch/arm/plat-omap/include/plat/memory.h
+++ b/arch/arm/plat-omap/include/plat/memory.h
@@ -40,7 +40,15 @@
#define PHYS_OFFSET UL(0x10000000)
#elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
defined(CONFIG_ARCH_OMAP4)
+/*
+ * We want crashdump kernels to be in different physical address than
+ * the primary kernel.
+ */
+#ifdef CONFIG_CRASH_DUMP
+#define PHYS_OFFSET UL(0x84000000)
+#else
#define PHYS_OFFSET UL(0x80000000)
+#endif /* CONFIG_CRASH_DUMP */
#endif
/*
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index df5c918..a023f62 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -459,7 +459,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
/* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
.phys_io = 0x48000000,
.io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
- .boot_params = 0x80000100,
+ .boot_params = PHYS_OFFSET + 0x100,
.map_io = omap3_beagle_map_io,
.init_irq = omap3_beagle_init_irq,
.init_machine = omap3_beagle_init,
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-23 4:11 ` Mika Westerberg
2010-04-23 4:26 ` Janboe Ye
@ 2010-04-26 1:26 ` Joonyoung Shim
2010-04-26 9:16 ` Mika Westerberg
1 sibling, 1 reply; 18+ messages in thread
From: Joonyoung Shim @ 2010-04-26 1:26 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 4/23/2010 1:11 PM, Mika Westerberg wrote:
> On Fri, Apr 23, 2010 at 05:05:56AM +0200, ext Janboe Ye wrote:
>> I am trying this. But it seems need to do a lot work to make kdump
>> to work on other omap3 board.
>
> You need to have userspace tools (in this case kexec-tools) which load the
> crashkernel into the running kernel. I'm planning to send my kexec-tools
> patches to upstream after the kernel part is accepted (so that they can be
> in sync) but I can provide you the patches if needed.
>
I want to test your patches too. Can you send me the kexec-tools patches?
Thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-26 1:26 ` Joonyoung Shim
@ 2010-04-26 9:16 ` Mika Westerberg
0 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-26 9:16 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Apr 26, 2010 at 03:26:51AM +0200, ext Joonyoung Shim wrote:
> On 4/23/2010 1:11 PM, Mika Westerberg wrote:
> > You need to have userspace tools (in this case kexec-tools) which load the
> > crashkernel into the running kernel. I'm planning to send my kexec-tools
> > patches to upstream after the kernel part is accepted (so that they can be
> > in sync) but I can provide you the patches if needed.
>
> I want to test your patches too. Can you send me the kexec-tools patches?
I sent those patches to LAKML and kexec list. You can pick them up from here:
http://lists.infradead.org/pipermail/kexec/2010-April/004029.html
Regards,
MW
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-23 4:26 ` Janboe Ye
2010-04-23 4:53 ` Mika Westerberg
@ 2010-04-27 10:05 ` Mika Westerberg
1 sibling, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-04-27 10:05 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 23, 2010 at 06:26:26AM +0200, ext Janboe Ye wrote:
> These are some other hard code address in some boards.
>
> For example, beagle board boot_params is 0x80000100.
>
> I guest nokia's Nseris does not use atags for transfering params.
>
> When I test my relocated kernel, it blocks at machinee initialization.
>
> Maybe there is other address mapping issue. I will look it tomorrow.
Hi again,
I got it working on beagle with following patches. Hope it helps you.
Regards,
MW
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/8] Initial implementation of kdump for ARM
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
` (8 preceding siblings ...)
2010-04-22 12:03 ` [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
@ 2010-05-03 8:28 ` Mika Westerberg
9 siblings, 0 replies; 18+ messages in thread
From: Mika Westerberg @ 2010-05-03 8:28 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 20, 2010 at 11:50:46AM +0300, Mika Westerberg wrote:
>
> This is revised series of kdump code, now without "RFC"-prefix. Original
> series can be found here:
>
> http://lists.infradead.org/pipermail/linux-arm-kernel/2010-March/012353.html
>
> Changes to previous version:
> - crash_setup_regs() uses Russell's suggestion for saving registers
> - copy_oldmem_page() code is changed to use ioremap()
> - there is no need for special 'mem=' parameters
>
> I've been testing this on my N900.
Hi Russell,
Do have any comments on these patches? Any objections for sending
these to your patch tracking system?
I've also tested these on beagleboard and it works there as well.
Thanks,
MW
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2010-05-03 8:28 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 8:50 [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
2010-04-20 8:50 ` [PATCH 1/8] arm: kdump: reserve memory for crashkernel Mika Westerberg
2010-04-20 8:50 ` [PATCH 2/8] arm: kdump: implement crash_setup_regs() Mika Westerberg
2010-04-20 8:50 ` [PATCH 3/8] arm: kdump: implement machine_crash_shutdown() Mika Westerberg
2010-04-20 8:50 ` [PATCH 4/8] arm: kdump: skip indirection page when crashing Mika Westerberg
2010-04-20 8:50 ` [PATCH 5/8] arm: kdump: implement copy_oldmem_page() Mika Westerberg
2010-04-20 8:50 ` [PATCH 6/8] arm: allow passing an ELF64 header to elf_check_arch() Mika Westerberg
2010-04-20 8:50 ` [PATCH 7/8] arm: kdump: add support for elfcorehdr= parameter Mika Westerberg
2010-04-20 8:50 ` [PATCH 8/8] arm: kdump: add CONFIG_CRASH_DUMP Kconfig option Mika Westerberg
2010-04-22 12:03 ` [PATCH 0/8] Initial implementation of kdump for ARM Mika Westerberg
2010-04-23 3:05 ` Janboe Ye
2010-04-23 4:11 ` Mika Westerberg
2010-04-23 4:26 ` Janboe Ye
2010-04-23 4:53 ` Mika Westerberg
2010-04-27 10:05 ` Mika Westerberg
2010-04-26 1:26 ` Joonyoung Shim
2010-04-26 9:16 ` Mika Westerberg
2010-05-03 8:28 ` Mika Westerberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).