[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen: add support for crash dump analysis with xen.efi


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Apr 2023 14:01:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n9hNCXuO0OnaZb3uPDhdrOiAnK2CzORCGdLFN0p9Z5U=; b=bQhlbhd9bEVl5PHDL/Q/m5MsB+J+1tnXIWLsKQY2LqS068kH7zPd/FSfduuLCgTSK4fZ3y4ojbWQ8bgLD7vmhXrzSMYhUdh28FBnQI6JGULss+E0M+TPBh83/nOn8/9FRpwM5hmJuZDXEofB9zGQ3o5JUkdfUIBvRPusCL6226Mnu+3G2r0zGFesRS5JFCXI8FemvZ+N95LMPeCgf+VfE9EL6c9xemSRm8KWbKts6WhnS1b7kRpNfScgRbzCMFcNc1aMQyZbbE5PjEqgaLnmRmbbb5EBi2dX+meHBKuTYexZATl9snMYwcOiWODuu5/xwLiKCfHA3XGOiXIaj7NdnQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bfzK61v1rYdPhquKWKAhUS9Bo4VRlf9fLV6SQKFWRXM7bnoNnHfy2ag9brcrLtig9Q570OAQwpZg7VGGObY1K7g1UXIClkfNiaVxXPqPFGHp8N63oWIUXM4lOp0qOlIOqxDH57mB0YtrTRr6TZ1ZMHUrrFTebsPWn9YJ4MKdESGnl4x2mj0Kj4391uocLgsbk/xBkLKqRJZQ2Z8fLMNhFbznDBx9F7igFerCcEwMl4aRaYxSa2Y4ZaYiKmB/iH9K9DiScxsbEgs3TTXs5Npz/1ORl9rS4UgUeBvSZipeGOnW193VFP6ajsl7uUvW53CB6U5nUF1VJJzYJmalYW2yQw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 24 Apr 2023 12:01:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.04.2023 15:59, Juergen Gross wrote:
> Today it is not possible to analyse crash dumps of a system in
> hypervisor mode when it had been booted via EFI, as the crash utility
> doesn't understand the file format of xen.efi.
> 
> This can easily be solved by creating an ELF file from xen.efi via
> objcopy. Using that file as name list for crash enables the user to
> analyse the dump in hypervisor mode.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
>  xen/Kconfig.debug     | 5 ++++-
>  xen/Makefile          | 4 ++++
>  xen/arch/x86/Makefile | 3 +++
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
> index 94e818ee09..4aec0fd3aa 100644
> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -138,6 +138,9 @@ config DEBUG_INFO
>         the EFI boot partition (look for "INSTALL_EFI_STRIP" in
>         docs/misc/efi.pandoc for more information - when not using
>         "make install-xen" for installing xen.efi, stripping needs to be
> -       done outside the Xen build environment).
> +       done outside the Xen build environment). Note that stripping
> +       xen.efi using "INSTALL_EFI_STRIP" will disable the building of
> +       xen.efi.elf, which is needed for "crash" dump analysis of systems
> +       booted via EFI.

I'm afraid I don't understand this: INSTALL_EFI_STRIP only affects what
may (optionally) be placed on the EFI partition. The normally installed
xen.efi should be unaffected by this; an intermediate xen.efi.stripped
is created instead.

> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -505,6 +505,9 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX)
>               if [ -e $(TARGET).efi.map ]; then \
>                       $(INSTALL_DATA) $(TARGET).efi.map 
> $(D)$(DEBUG_DIR)/$(T)-$(XEN_FULLVERSION).efi.map; \
>               fi; \
> +             if [ -e $(TARGET).efi.elf ]; then \
> +                     $(INSTALL_DATA) $(TARGET).efi.elf 
> $(D)$(DEBUG_DIR)/$(T)-$(XEN_FULLVERSION).efi.elf; \
> +             fi; \

To avoid the risk of the two going out of sync (as also to limit
redundancy), could you wrap the earlier "if" in a "for x in map elf;
do ...; done" loop?

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -224,6 +224,9 @@ endif
>       $(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o
>       $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
>             $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(orphan-handling-y) 
> $(note_file_option) -o $@
> +ifeq ($(CONFIG_DEBUG_INFO),y)
> +     $(if $(filter --strip-debug,$(EFI_LDFLAGS)),,$(OBJCOPY) -O elf64-x86-64 
> $@ $@.elf)
> +endif
>       $(NM) -pa --format=sysv $(@D)/$(@F) \
>               | $(objtree)/tools/symbols --all-symbols --xensyms --sysv 
> --sort >$(@D)/$(@F).map
>       rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*

Personally I think that - in case of build problems - having the map file
created is more important (and less likely to fail) than the ELF one, so
I'd prefer if the two steps could be ordered the other way around.

Further I vaguely recall possible issues with entirely blank make rule
lines. Plus having some trace of the command in a verbose log perhaps
also wouldn't hurt. IOW maybe better add another use of the colon command
here (we already have some, at least through $(MKRELOC)):

ifeq ($(CONFIG_DEBUG_INFO),y)
        $(if $(filter --strip-debug,$(EFI_LDFLAGS)),:)$(OBJCOPY) -O 
elf64-x86-64 $@ $@.elf
endif

?

Finally - do you really need to copy all the non-debug sections as well?
Might --only-keep-debug be helpful here (provided it works for a PE/COFF
-> ELF copy operation; it looks to do so in my simple experiments)?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.