public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Michael Brown <mcb30@ipxe.org>
To: Konrad Rzeszutek Wilk <konrad@kernel.org>,
	edk2-devel@lists.01.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Laszlo Ersek <lersek@redhat.com>,
	alejandro.j.jimenez@oracle.com, aaron.young@oracle.com,
	ipxe-devel@lists.ipxe.org,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [ipxe-devel] Tips on how to debug EFI code (iPXE) from within KVM after ipxe.efi has crashed with #GP?
Date: Thu, 28 Sep 2017 19:04:43 +0100	[thread overview]
Message-ID: <7c5cafdc-67cc-5535-1385-6ed9dd491e7e@ipxe.org> (raw)
In-Reply-To: <CACJDEmqZMwk0k34yTnqeGrVU-5MEinWK5i3LW4XTAUkLiTyo_w@mail.gmail.com>

On 28/09/17 18:37, Konrad Rzeszutek Wilk wrote:
> !!! X64 Exception Type - 0D(#GP - General Protection)  CPU Apic ID -
> 00000000 !!!!
> ExceptionData - 0000000000000000
> RIP  - 00000000BEC2949C, CS  - 0000000000000038, RFLAGS - 0000000000210216
 > ....
> !!!! Find image 808610ed.efidrv (ImageBase=00000000BEC27000,
> EntryPoint=00000000BEC2E089) !!!!
> 
> And now I am trying to figure out how to troubleshoot this.
> (and yes I am thinking it was related to the Tivoli work-around, but
> disabling that didn't help).

The Tivoli workaround is for legacy BIOS only; it doesn't apply to the 
UEFI build of iPXE.

You have the RIP and ImageBase, so you know that the exception happens 
at offset +0x249c within your iPXE binary.  You can use this in 
conjunction with the corresponding map file from the iPXE build (which 
will probably be named bin-x86_64-efi/808610d3.efidrv.tmp.map, but see 
below) to figure out exactly where the crash is occurring.

> #crash ipxe/src/bin/ipxe.lkrn.tmp ./guest-memory

That's a completely different iPXE binary from the one you are using.

> - The 80810ed.efidrv is built using:
> 
> (cd ipxe/src;make bin-x86_64-efi/808610d3.efi  CONFIG=qemu
> DEBUG=iscsi:4,scsi:4 EMBED=/ipxe.config -j8)
> if [ $? -ne 0 ]; then exit 1; fi
> (cd ipxe/src;EfiRom -f 0x8086 -i 0x1528 --pci23 -ec
> bin-x86_64-efi/808610d3.efidrv -o ../../808610d3.rom)
> if [ $? -ne 0 ]; then exit 1; fi

You can build this much more simply in a single command:

   make bin-x86_64-efi/808610d3.efirom EMBED=/ipxe.config

Also note that:

- debug levels in iPXE are bitmasks, so DEBUG=....:4 generally doesn't 
make much sense.  You probably want DEBUG=iscsi,scsi for minimal debug 
(i.e. detailed error messages for any problems), or DEBUG=iscsi:3,scsi:3 
for much more verbose logging.  That said, you don't seem to be using 
iSCSI anyway, so .....?

- In your build chain (using EfiRom) I think you have a typo: you build 
the EFI _application_ bin-x86_64-efi/808610d3.efi but then use the EFI 
_driver_ bin-x86_64-efi/808610d3.efidrv, which you have not explicitly 
built.  Your final binary may therefore not match what you think you 
have just built.  You should probably not worry about any of this, and 
just use the single-command build given above instead.

Michael


  reply	other threads:[~2017-09-28 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 17:37 Tips on how to debug EFI code (iPXE) from within KVM after ipxe.efi has crashed with #GP? Konrad Rzeszutek Wilk
2017-09-28 18:04 ` Michael Brown [this message]
2017-09-28 18:19   ` [ipxe-devel] " Laszlo Ersek

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-list 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=7c5cafdc-67cc-5535-1385-6ed9dd491e7e@ipxe.org \
    --to=devel@edk2.groups.io \
    /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