Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: caiqian@redhat.com
Cc: Simon Horman <horms@verge.net.au>,
	Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: [GIT PULL] Please pull x86 biarch crashdump support and misc devel
Date: Fri, 10 Sep 2010 12:19:06 -0700	[thread overview]
Message-ID: <m1aanpe79x.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <1616446052.695411284137699709.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (caiqian@redhat.com's message of "Fri, 10 Sep 2010 12:54:59 -0400 (EDT)")

caiqian@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.

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@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@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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2010-09-10 19:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <575742837.695351284137649163.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-10 16:54 ` [GIT PULL] Please pull x86 biarch crashdump support and misc devel caiqian
2010-09-10 19:15   ` Eric W. Biederman
2010-09-10 19:19   ` Eric W. Biederman [this message]
2010-09-11  1:40     ` CAI Qian
2010-09-11  2:05       ` CAI Qian
2010-09-11  4:00         ` Eric W. Biederman
     [not found] <1780019082.729911284179131961.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-11  4:25 ` caiqian
2010-09-11  4:53   ` Eric W. Biederman
2010-09-11  5:47     ` Eric W. Biederman
2010-09-11 13:48       ` CAI Qian
     [not found] <453826608.695091284137315385.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-10 16:49 ` caiqian
     [not found] <822803231.671471284126247290.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>
2010-09-10 13:45 ` caiqian
2010-09-08 19:44 Eric W. Biederman
2010-09-08 19:51 ` Eric W. Biederman
2010-09-09  1:35 ` Simon Horman
2010-09-09  1:46   ` Eric W. Biederman
2010-09-09  2:42     ` Simon Horman
2010-09-09  5:59       ` Eric W. Biederman
2010-09-09  8:14         ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1aanpe79x.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=caiqian@redhat.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox