All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Christopher Covington <cov@codeaurora.org>,
	Petr Tesarik <ptesarik@suse.cz>
Cc: Wen Congyang <wency@cn.fujitsu.com>,
	Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>,
	kexec@lists.infradead.org,
	qemu devel list <qemu-devel@nongnu.org>,
	Qiao Nuohan <qiaonuohan@cn.fujitsu.com>,
	Dave Anderson <anderson@redhat.com>,
	kumagai-atsushi@mxc.nes.nec.co.jp, crash-utility@redhat.com
Subject: Re: [Qemu-devel] uniquely identifying KDUMP files that originate from QEMU
Date: Wed, 12 Nov 2014 15:40:00 +0100	[thread overview]
Message-ID: <54637140.9010605@redhat.com> (raw)
In-Reply-To: <54636096.6020500@codeaurora.org>

On 11/12/14 14:28, Christopher Covington wrote:
> On 11/12/2014 08:26 AM, Petr Tesarik wrote:
>> On Wed, 12 Nov 2014 08:18:04 -0500
>> Christopher Covington <cov@codeaurora.org> wrote:
>>
>>> On 11/12/2014 03:05 AM, Petr Tesarik wrote:
>>>> On Tue, 11 Nov 2014 12:27:44 -0500
>>>> Christopher Covington <cov@codeaurora.org> wrote:
>>>>
>>>>> On 11/11/2014 06:22 AM, Laszlo Ersek wrote:
>>>>>> (Note: I'm not subscribed to either qemu-devel or the kexec list; please
>>>>>> keep me CC'd.)
>>>>>>
>>>>>> QEMU is able to dump the guest's memory in KDUMP format (kdump-zlib,
>>>>>> kdump-lzo, kdump-snappy) with the "dump-guest-memory" QMP command.
>>>>>>
>>>>>> The resultant vmcore is usually analyzed with the "crash" utility.
>>>>>>
>>>>>> The original tool producing such files is kdump. Unlike the procedure
>>>>>> performed by QEMU, kdump runs from *within* the guest (under a kexec'd
>>>>>> kdump kernel), and has more information about the original guest kernel
>>>>>> state (which is being dumped) than QEMU. To QEMU, the guest kernel state
>>>>>> is opaque.
>>>>>>
>>>>>> For this reason, the kdump preparation logic in QEMU hardcodes a number
>>>>>> of fields in the kdump header. The direct issue is the "phys_base"
>>>>>> field. Refer to dump.c, functions create_header32(), create_header64(),
>>>>>> and "include/sysemu/dump.h", macro PHYS_BASE (with the replacement text
>>>>>> "0").
>>>>>>
>>>>>> http://git.qemu.org/?p=qemu.git;a=blob;f=dump.c;h=9c7dad8f865af3b778589dd0847e450ba9a75b9d;hb=HEAD
>>>>>>
>>>>>> http://git.qemu.org/?p=qemu.git;a=blob;f=include/sysemu/dump.h;h=7e4ec5c7d96fb39c943d970d1683aa2dc171c933;hb=HEAD
>>>>>>
>>>>>> This works in most cases, because the guest Linux kernel indeed tends to
>>>>>> be loaded at guest-phys address 0. However, when the guest Linux kernel
>>>>>> is booted on top of OVMF (which has a somewhat unusual UEFI memory map),
>>>>>> then the guest Linux kernel is loaded at 16MB, thereby getting out of
>>>>>> sync with the phys_base=0 setting visible in the KDUMP header.
>>>>>>
>>>>>> This trips up the "crash" utility.
>>>>>>
>>>>>> Dave worked around the issue in "crash" for ELF format dumps -- "crash"
>>>>>> can identify QEMU as the originator of the vmcore by finding the QEMU
>>>>>> notes in the ELF vmcore. If those are present, then "crash" employs a
>>>>>> heuristic, probing for a phys_base up to 32MB, in 1MB steps.
>>>>>
>>>>> What advantages does KDUMP have over ELF?
>>>>
>>>> It's smaller (data is compressed), and it contains a header with some
>>>> useful information (e.g. the crashed kernel's version and release).
>>>
>>> What if the ELF dumper used SHF_COMPRESSED or could dump an ELF.xz?
>>
>> Not the same thing. With KDUMP, each page is compressed separately, so
>> if a utility like crash needs a page from the middle, it can find it
>> and unpack it immediately. If we had an ELF.xz, then the whole file
>> must be unpacked before it can be used. And unpacking a few terabytes
>> takes ... a while. ;-)
> 
> Understood on the ELF.xz approach, but why couldn't each page (or maybe a
> configurable size) be a SHF_COMPRESSED section?

Perhaps it could, technically -- it's just not how Qiao Nuohan
implemented the feature. I didn't research the background for this.

Thanks
Laszlo

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

WARNING: multiple messages have this Message-ID (diff)
From: Laszlo Ersek <lersek@redhat.com>
To: Christopher Covington <cov@codeaurora.org>,
	Petr Tesarik <ptesarik@suse.cz>
Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>,
	kexec@lists.infradead.org,
	qemu devel list <qemu-devel@nongnu.org>,
	Qiao Nuohan <qiaonuohan@cn.fujitsu.com>,
	Dave Anderson <anderson@redhat.com>,
	kumagai-atsushi@mxc.nes.nec.co.jp, crash-utility@redhat.com
Subject: Re: [Qemu-devel] uniquely identifying KDUMP files that originate from QEMU
Date: Wed, 12 Nov 2014 15:40:00 +0100	[thread overview]
Message-ID: <54637140.9010605@redhat.com> (raw)
In-Reply-To: <54636096.6020500@codeaurora.org>

On 11/12/14 14:28, Christopher Covington wrote:
> On 11/12/2014 08:26 AM, Petr Tesarik wrote:
>> On Wed, 12 Nov 2014 08:18:04 -0500
>> Christopher Covington <cov@codeaurora.org> wrote:
>>
>>> On 11/12/2014 03:05 AM, Petr Tesarik wrote:
>>>> On Tue, 11 Nov 2014 12:27:44 -0500
>>>> Christopher Covington <cov@codeaurora.org> wrote:
>>>>
>>>>> On 11/11/2014 06:22 AM, Laszlo Ersek wrote:
>>>>>> (Note: I'm not subscribed to either qemu-devel or the kexec list; please
>>>>>> keep me CC'd.)
>>>>>>
>>>>>> QEMU is able to dump the guest's memory in KDUMP format (kdump-zlib,
>>>>>> kdump-lzo, kdump-snappy) with the "dump-guest-memory" QMP command.
>>>>>>
>>>>>> The resultant vmcore is usually analyzed with the "crash" utility.
>>>>>>
>>>>>> The original tool producing such files is kdump. Unlike the procedure
>>>>>> performed by QEMU, kdump runs from *within* the guest (under a kexec'd
>>>>>> kdump kernel), and has more information about the original guest kernel
>>>>>> state (which is being dumped) than QEMU. To QEMU, the guest kernel state
>>>>>> is opaque.
>>>>>>
>>>>>> For this reason, the kdump preparation logic in QEMU hardcodes a number
>>>>>> of fields in the kdump header. The direct issue is the "phys_base"
>>>>>> field. Refer to dump.c, functions create_header32(), create_header64(),
>>>>>> and "include/sysemu/dump.h", macro PHYS_BASE (with the replacement text
>>>>>> "0").
>>>>>>
>>>>>> http://git.qemu.org/?p=qemu.git;a=blob;f=dump.c;h=9c7dad8f865af3b778589dd0847e450ba9a75b9d;hb=HEAD
>>>>>>
>>>>>> http://git.qemu.org/?p=qemu.git;a=blob;f=include/sysemu/dump.h;h=7e4ec5c7d96fb39c943d970d1683aa2dc171c933;hb=HEAD
>>>>>>
>>>>>> This works in most cases, because the guest Linux kernel indeed tends to
>>>>>> be loaded at guest-phys address 0. However, when the guest Linux kernel
>>>>>> is booted on top of OVMF (which has a somewhat unusual UEFI memory map),
>>>>>> then the guest Linux kernel is loaded at 16MB, thereby getting out of
>>>>>> sync with the phys_base=0 setting visible in the KDUMP header.
>>>>>>
>>>>>> This trips up the "crash" utility.
>>>>>>
>>>>>> Dave worked around the issue in "crash" for ELF format dumps -- "crash"
>>>>>> can identify QEMU as the originator of the vmcore by finding the QEMU
>>>>>> notes in the ELF vmcore. If those are present, then "crash" employs a
>>>>>> heuristic, probing for a phys_base up to 32MB, in 1MB steps.
>>>>>
>>>>> What advantages does KDUMP have over ELF?
>>>>
>>>> It's smaller (data is compressed), and it contains a header with some
>>>> useful information (e.g. the crashed kernel's version and release).
>>>
>>> What if the ELF dumper used SHF_COMPRESSED or could dump an ELF.xz?
>>
>> Not the same thing. With KDUMP, each page is compressed separately, so
>> if a utility like crash needs a page from the middle, it can find it
>> and unpack it immediately. If we had an ELF.xz, then the whole file
>> must be unpacked before it can be used. And unpacking a few terabytes
>> takes ... a while. ;-)
> 
> Understood on the ELF.xz approach, but why couldn't each page (or maybe a
> configurable size) be a SHF_COMPRESSED section?

Perhaps it could, technically -- it's just not how Qiao Nuohan
implemented the feature. I didn't research the background for this.

Thanks
Laszlo

  parent reply	other threads:[~2014-11-12 14:40 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 11:22 uniquely identifying KDUMP files that originate from QEMU Laszlo Ersek
2014-11-11 11:22 ` [Qemu-devel] " Laszlo Ersek
2014-11-11 11:46 ` Peter Maydell
2014-11-11 11:46   ` Peter Maydell
2014-11-11 12:09 ` Petr Tesarik
2014-11-12  3:08   ` HATAYAMA Daisuke
2014-11-12  8:04     ` Petr Tesarik
2014-11-12 14:50       ` Laszlo Ersek
2014-11-12 18:43         ` Petr Tesarik
2014-11-12 20:30           ` Laszlo Ersek
2014-11-12 20:30             ` [Qemu-devel] " Laszlo Ersek
2014-11-12 20:41             ` Dave Anderson
2014-11-12 20:41               ` [Qemu-devel] " Dave Anderson
2014-11-12 21:21               ` [Crash-utility] " Dave Anderson
2014-11-12 21:21                 ` [Qemu-devel] " Dave Anderson
2014-11-12 21:20             ` Petr Tesarik
2014-11-12 21:20               ` [Qemu-devel] " Petr Tesarik
2014-11-11 17:27 ` Christopher Covington
2014-11-11 17:27   ` Christopher Covington
2014-11-12  8:05   ` Petr Tesarik
2014-11-12  8:05     ` Petr Tesarik
2014-11-12 13:18     ` Christopher Covington
2014-11-12 13:18       ` Christopher Covington
2014-11-12 13:26       ` Petr Tesarik
2014-11-12 13:26         ` Petr Tesarik
2014-11-12 13:28         ` Christopher Covington
2014-11-12 13:28           ` Christopher Covington
2014-11-12 14:36           ` Petr Tesarik
2014-11-12 14:36             ` Petr Tesarik
2014-11-12 14:40           ` Laszlo Ersek [this message]
2014-11-12 14:40             ` Laszlo Ersek
2014-11-12 14:10         ` Laszlo Ersek
2014-11-12 14:10           ` Laszlo Ersek
2014-11-12 14:48           ` Christopher Covington
2014-11-12 14:48             ` Christopher Covington
2014-11-12 15:03             ` Laszlo Ersek
2014-11-12 15:03               ` Laszlo Ersek
2014-11-12 15:43               ` Christopher Covington
2014-11-12 15:43                 ` Christopher Covington
2014-11-12 21:10                 ` Petr Tesarik
2014-11-12 21:10                   ` Petr Tesarik
2014-11-12 14:37   ` Laszlo Ersek
2014-11-12 14:37     ` 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-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=54637140.9010605@redhat.com \
    --to=lersek@redhat.com \
    --cc=anderson@redhat.com \
    --cc=cov@codeaurora.org \
    --cc=crash-utility@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=kumagai-atsushi@mxc.nes.nec.co.jp \
    --cc=ptesarik@suse.cz \
    --cc=qemu-devel@nongnu.org \
    --cc=qiaonuohan@cn.fujitsu.com \
    --cc=tumanova@linux.vnet.ibm.com \
    --cc=wency@cn.fujitsu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.