[GIT PULL] Please pull x86 biarch crashdump support and misc devel

CAI Qian caiqian at redhat.com
Fri Sep 10 21:40:50 EDT 2010


----- "Eric W. Biederman" <ebiederm at xmission.com> wrote:

> caiqian at redhat.com writes:
> 
> > BTW, kexec commandline was like this if helps.
> >
> > /sbin/kexec -p '--command-line=ro
> root=/dev/mapper/vg_intels3e3601-lv_root
> rd_LVM_LV=vg_intels3e3601/lv_root rd_LVM_LV=vg_intels3e3601/lv_swap
> rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8
> SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us
> console=ttyS0,115200n81 irqpoll maxcpus=1 reset_devices
> cgroup_disable=memory sysrq_always_enabled '
> --initrd=/boot/initrd-2.6.36-rc2-mm1-fix+kdump.img
> /boot/vmlinuz-2.6.36-rc2-mm1-fix+
> >
> 
> Thanks for keeping me honest.  It looks like I did something foolish,
> and wound up putting 386 headers on the x86_64 crash dump.
> 
> I have rebased updated my kexec-tools-devel branch.  Could you try it
> now?  I haven't had a chance to test it yet but when I inspected the
> code it appeared very obvious what I had done wrong.
This failed to build for me.

kexec/arch/i386/crashdump-x86.c: In function ‘load_crashdump_segments’:
kexec/arch/i386/crashdump-x86.c:703: error: ‘KEXEC_ARCH_NATIVE’ undeclared (first use in this function)
kexec/arch/i386/crashdump-x86.c:703: error: (Each undeclared identifier is reported only once
kexec/arch/i386/crashdump-x86.c:703: error: for each function it appears in.)
make: *** [kexec/arch/i386/crashdump-x86.o] Error 1
> 
> The active part of the fix is below (I have an earlier patch that
> just
> defines KEXEC_ARCH_NATIVE).
> 
> Eric
> ---
> 
> From 0a9bffb31c3aee53f58c62dde349c2842060c760 Mon Sep 17 00:00:00
> 2001
> From: Eric W. Biederman <ebiederm at xmission.com>
> Date: Fri, 10 Sep 2010 11:57:36 -0700
> Subject: [PATCH] x86 crashdump: On x86_64 generate EM_X86_64 crashdump
> headers.
> 
> Paper bag time.  I forgot to double check my changes worked
> on x86_64.  So I wound up with x86_64 putting i386 crashdump headers
> on when it generated a crashdump header.  Ouch!
> 
> Fix it by using the new KEXEC_ARCH_NATIVE value so we can see what
> we are doing.
> 
> Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>
> ---
>  kexec/arch/i386/crashdump-x86.c |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/kexec/arch/i386/crashdump-x86.c
> b/kexec/arch/i386/crashdump-x86.c
> index 06e5ae9..e202e36 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -690,19 +690,32 @@ int load_crashdump_segments(struct kexec_info
> *info, char* mod_cmdline,
>  	int nr_ranges, align = 1024, i;
>  	struct memory_range *mem_range, *memmap_p;
>  	struct crash_elf_info elf_info;
> +	unsigned kexec_arch;
>  
>  	/* Constant parts of the elf_info */
>  	elf_info.data             = ELFDATA2LSB;
>  	elf_info.backup_src_start = BACKUP_SRC_START;
>  	elf_info.backup_src_end   = BACKUP_SRC_END;
>  
> +	/* Get the architecture of the running kernel */
> +	kexec_arch = elf_info.machine & KEXEC_ARCH_MASK;
> +	if (kexec_arch == KEXEC_ARCH_DEFAULT)
> +		kexec_arch = KEXEC_ARCH_NATIVE;
> +	
>          /* Get the elf architecture of the running kernel */
> -	if ((info->kexec_flags & KEXEC_ARCH_MASK) == KEXEC_ARCH_X86_64) {
> +	switch(kexec_arch) {
> +	case KEXEC_ARCH_X86_64:
>  		elf_info.machine = EM_X86_64;
> -	} else {
> +		break;
> +	case KEXEC_ARCH_386:
>  		elf_info.machine       = EM_386;
>  		elf_info.lowmem_limit  = X86_MAXMEM;
>  		elf_info.get_note_info = get_crash_notes;
> +		break;
> +	default:
> +		fprintf(stderr, "unsupported crashdump architecture: %04x\n",
> +			kexec_arch);
> +		return -1;
>  	}
>  
>  	if (get_crash_memory_ranges(&mem_range, &nr_ranges,
> -- 
> 1.6.5.2.143.g8cc62



More information about the kexec mailing list