All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Smith <xsmith@hp.com>
To: qemu-devel@nongnu.org, dave.anderson@redhat.com
Subject: [Qemu-devel] Kernel core dumps from qemu
Date: Tue, 24 Mar 2009 10:54:01 -0600	[thread overview]
Message-ID: <20090324165401.GA2999@ldl.fc.hp.com> (raw)

Hello.

I have been looking at adding a monitor command

    (qemu) dump <file>

to produce a snapshot kernel core dump similar to /proc/vmcore.

There is nothing wrong with kdump in the guest, but having 
a host dumper (in addition) would have some advantages:

 - saves 64 meg in each Linux guest (reserved for dump-capture kernel)

 - can write a snapshot dump and continue, kdump cannot
   (can automatically dump on OOPS as well as panic)

 - produces dump in the host filesystem, easier for management tools

 - Xen has this, virsh supports this

 - not limited to Linux guests

I'll outline some specific ideas and issues.  

My question is: might qemu/KVM be interested in adopting something like this?
In due course.

Ok... kdump vmcores are 64-bit ELF core files, even on 32-bit i386.
So too it should be with host dumps.

Linux-x64 maps physical memory twice, at 0xffff880000000000
and at 0xffffffff80000000.  An ELF dump that gives those addresses
both pointing to a copy of phys_ram[] is satisfactory to crash and gdb.

It would be unwholesome for qemu to know those constants (__PAGE_OFFSET
and __START_KERNEL_map).  Worse than unwholesome, __PAGE_OFFSET recently
changed.

So: qemu writes an ELF dump, but without providing virtual addresses.
Crash will be able to read this as is.  For others, a tool can examine
System.map or vmlinux and fix up the vmcore.  For ease of use, piping
the dump through the tool can have some easy syntax.

This also handles Windows dumps, Solaris dumps, DMX dumps, and so on.
qemu provides the info it has, and need not worry about the formatting.

Registers are needed too.  

vmcores have elf NT_PRSTATUS notes with the registers filled in and
the rest zero.  (Except current->pid which I hope isn't needed because
qemu can't do it.)

So, NT_PRSTATUS is reasonable.  Also, since it's inevitably 
machine dependent, CPUState plus a version number would allow access
to pretty much everything.  Or the standard thing would be pt_regs.
(It is easy to add new note types.)

Last, there should be a note giving the version number of the spec.

Comments appreciated.

             reply	other threads:[~2009-03-24 16:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 16:54 Chris Smith [this message]
2009-03-24 18:08 ` [Qemu-devel] Kernel core dumps from qemu Avi Kivity
2009-03-24 20:19   ` Chris Smith
2009-03-25  9:41     ` Avi Kivity
2009-03-25  0:32   ` Paul Brook
2009-03-25  9:28     ` Avi Kivity
2009-03-25 18:02       ` Chris Smith

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=20090324165401.GA2999@ldl.fc.hp.com \
    --to=xsmith@hp.com \
    --cc=dave.anderson@redhat.com \
    --cc=qemu-devel@nongnu.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 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.