qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Cc: Zhang Xiaohe <zhangxh@cn.fujitsu.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 9/9] Make monitor command 'dump-guest-memory' dump in kdump-compressed format
Date: Tue, 07 May 2013 11:13:18 -0600	[thread overview]
Message-ID: <5189362E.3030707@redhat.com> (raw)
In-Reply-To: <1367911007-13990-10-git-send-email-qiaonuohan@cn.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 3715 bytes --]

On 05/07/2013 01:16 AM, Qiao Nuohan wrote:
> Make monitor command 'dump-guest-memory' dump in kdump-compressed format.
> The command's usage:
>   dump [-p] protocol [flags] [begin] [length]
> With 'flags' set, the core file will be in kdump-compress format, and without
> it, the format is ELF. 'flags' can be:
> 1. FLAG_DUMP_COMPRESS_ZLIB(0x1), compress vmcore with zlib
> 2. FLAG_DUMP_COMPRESS_LZO(0x2), compress vmcore with lzo
> 3. FLAG_DUMP_COMPRESS_SNAPPY(0x4), compress vmcore with snappy
> 
> Note:
>   1. The kdump-compressed format is readable only with the crash utility, and it
>      can be smaller than the ELF format because of the compression support.
>   2. The kdump-compressed format is the 5th edition.
> 
> Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
> Signed-off-by: Zhang Xiaohe <zhangxh@cn.fujitsu.com>

> +++ b/hmp-commands.hx
> @@ -992,9 +992,10 @@ ETEXI
>  #if defined(CONFIG_HAVE_CORE_DUMP)
>      {
>          .name       = "dump-guest-memory",
> -        .args_type  = "paging:-p,filename:F,begin:i?,length:i?",
> -        .params     = "[-p] filename [begin] [length]",
> +        .args_type  = "paging:-p,filename:F,flags:i?,begin:i?,length:i?",

This is a backwards-incompatible change to HMP ('dump-guest-memory file
0' used to treat 0 as begin, now it treats it as flags), but I don't
care (we've already declared that HMP is unstable).  If you want
back-compat, then stick flags last, not in the middle.

See below about the naming and semantics (I hate the name "flags" for a
non-flags item, and making a human user learn flag bit values is a lousy
interface).  If you fix QMP to have a sane interface, then HMP should
probably have a similar change.

> +        .params     = "[-p] filename [flags] [begin] [length]",
>          .help       = "dump guest memory to file"
> +                      "\n\t\t\t flags: the type of compression"

That documentation does nothing for me.  What types are valid?

> +++ b/qapi-schema.json
> @@ -2410,6 +2410,8 @@
>  #            2. fd: the protocol starts with "fd:", and the following string
>  #               is the fd's name.
>  #
> +# @flags: #optional if specified, the format of dump file.
> +#

Missing a "(since 1.6)" tag to declare that it was added after the fact.
 We probably also ought to solve the introspection issue before adding
this feature, so that QMP clients like libvirt know when this optional
parameter is available for use.

>  # @begin: #optional if specified, the starting physical address.
>  #
>  # @length: #optional if specified, the memory size, in bytes. If you don't
> @@ -2421,8 +2423,8 @@
>  # Since: 1.2
>  ##
>  { 'command': 'dump-guest-memory',
> -  'data': { 'paging': 'bool', 'protocol': 'str', '*begin': 'int',
> -            '*length': 'int' } }
> +  'data': { 'paging': 'bool', 'protocol': 'str', '*flags': 'int',
> +            '*begin': 'int', '*length': 'int' } }

EWWWWW - this is a LOUSY interface. Don't make '*flags' an 'int', and
for that matter, don't name it 'flags' (that implies that we can
bitwise-or multiple compressions together, but it really doesn't make
sense to do both lzo and snappy at the same time - compression really
only makes sense as a single format at a time).  Name it for what it
represents (compression type), and provide an enum that lists the valid
types.  Something like:

{ 'enum': 'DumpGuestMemoryFormat',
  'data': [ 'uncompressed', 'zlib', 'lzo', 'snappy' ] }

{ 'command': 'dump-guest-memory',
  'data': { '*format': 'DumpGuestMemoryFormat', ... }}

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-05-07 17:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07  7:16 [Qemu-devel] [PATCH 0/9] Make monitor command 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 1/9] Add API to manipulate dump_bitmap Qiao Nuohan
2013-05-07 16:14   ` Eric Blake
2013-05-07 16:23     ` Daniel P. Berrange
2013-05-08  8:39     ` qiaonuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 2/9] Add API to manipulate cache_data Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 3/9] Move include and struct definition to dump.h Qiao Nuohan
2013-05-11 13:36   ` Andreas Färber
2013-05-07  7:16 ` [Qemu-devel] [PATCH 4/9] Add API to create header of vmcore Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 5/9] Add API to create data of dump bitmap Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 6/9] Add API to create page Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 7/9] Add API to free buf used by creating header, bitmap and page Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 8/9] Add API to write header, bitmap and page into vmcore Qiao Nuohan
2013-05-07  7:16 ` [Qemu-devel] [PATCH 9/9] Make monitor command 'dump-guest-memory' dump in kdump-compressed format Qiao Nuohan
2013-05-07 17:13   ` Eric Blake [this message]
2013-05-08  8:50     ` qiaonuohan
2013-05-08 17:16       ` Eric Blake
2013-05-09  5:27         ` Zhang Xiaohe
2013-05-09 14:51           ` Eric Blake
2013-05-10  1:21             ` Zhang Xiaohe
2013-05-08  9:03 ` [Qemu-devel] [PATCH 0/9] " HATAYAMA Daisuke

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=5189362E.3030707@redhat.com \
    --to=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qiaonuohan@cn.fujitsu.com \
    --cc=zhangxh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).