ia64/linux-2.6.18-xen.hg

changeset 23:9d24e876046f

Imported patch allow-i386-crash-kernels-to-handle-x86_64-dumps.patch from xen-unstable.hg 15200:bd3d6b4c52ec

The specific case I am encountering is kdump under Xen with a 64 bit
hypervisor and 32 bit kernel/userspace. The dump created is 64 bit due to
the hypervisor but the dump kernel is 32 bit for maximum compatibility.

It's possibly less likely to be useful in a purely native scenario but I
see no reason to disallow it.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Acked-by: Vivek Goyal <vgoyal@in.ibm.com>
Cc: Horms <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

fs/proc/vmcore.c | 2 +-
include/asm-i386/kexec.h | 3 +++
include/linux/crash_dump.h | 8 ++++++++
3 files changed, 12 insertions(+), 1 deletion(-)
author Ian Campbell <ian.campbell@xensource.com>
date Mon Jun 04 10:05:24 2007 +0100 (2007-06-04)
parents 61ed8662b69c
children 9686234c9d46
files fs/proc/vmcore.c include/asm-i386/kexec.h include/linux/crash_dump.h
line diff
     1.1 --- a/fs/proc/vmcore.c	Mon Jun 04 10:05:24 2007 +0100
     1.2 +++ b/fs/proc/vmcore.c	Mon Jun 04 10:05:24 2007 +0100
     1.3 @@ -514,7 +514,7 @@ static int __init parse_crash_elf64_head
     1.4  	/* Do some basic Verification. */
     1.5  	if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 ||
     1.6  		(ehdr.e_type != ET_CORE) ||
     1.7 -		!elf_check_arch(&ehdr) ||
     1.8 +		!vmcore_elf_check_arch(&ehdr) ||
     1.9  		ehdr.e_ident[EI_CLASS] != ELFCLASS64 ||
    1.10  		ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
    1.11  		ehdr.e_version != EV_CURRENT ||
     2.1 --- a/include/asm-i386/kexec.h	Mon Jun 04 10:05:24 2007 +0100
     2.2 +++ b/include/asm-i386/kexec.h	Mon Jun 04 10:05:24 2007 +0100
     2.3 @@ -47,6 +47,9 @@
     2.4  /* The native architecture */
     2.5  #define KEXEC_ARCH KEXEC_ARCH_386
     2.6  
     2.7 +/* We can also handle crash dumps from 64 bit kernel. */
     2.8 +#define vmcore_elf_check_arch_cross(x) ((x)->e_machine == EM_X86_64)
     2.9 +
    2.10  #define MAX_NOTE_BYTES 1024
    2.11  
    2.12  /* CPU does not save ss and esp on stack if execution is already
     3.1 --- a/include/linux/crash_dump.h	Mon Jun 04 10:05:24 2007 +0100
     3.2 +++ b/include/linux/crash_dump.h	Mon Jun 04 10:05:24 2007 +0100
     3.3 @@ -14,5 +14,13 @@ extern ssize_t copy_oldmem_page(unsigned
     3.4  extern const struct file_operations proc_vmcore_operations;
     3.5  extern struct proc_dir_entry *proc_vmcore;
     3.6  
     3.7 +/* Architecture code defines this if there are other possible ELF
     3.8 + * machine types, e.g. on bi-arch capable hardware. */
     3.9 +#ifndef vmcore_elf_check_arch_cross(x)
    3.10 +#define vmcore_elf_check_arch_cross(x) 0
    3.11 +#endif
    3.12 +
    3.13 +#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
    3.14 +
    3.15  #endif /* CONFIG_CRASH_DUMP */
    3.16  #endif /* LINUX_CRASHDUMP_H */