From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXh7P-0003wA-Bf for qemu-devel@nongnu.org; Tue, 08 Apr 2014 21:16:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXh7K-0000Os-PP for qemu-devel@nongnu.org; Tue, 08 Apr 2014 21:15:59 -0400 Received: from [59.151.112.132] (port=18859 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXh7K-0000KS-AF for qemu-devel@nongnu.org; Tue, 08 Apr 2014 21:15:54 -0400 Message-ID: <53449E79.9080405@cn.fujitsu.com> Date: Wed, 9 Apr 2014 09:12:25 +0800 From: qiaonuohan MIME-Version: 1.0 References: <1396341182-1805-1-git-send-email-qiaonuohan@cn.fujitsu.com> <533ABE41.2070306@de.ibm.com> <533D5112.3050303@de.ibm.com> In-Reply-To: <533D5112.3050303@de.ibm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] HMP: support specifying dump format for dump-guest-memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Christian Borntraeger ping... On 04/03/2014 08:16 PM, Christian Borntraeger wrote: > On 01/04/14 15:25, Christian Borntraeger wrote: >> On 01/04/14 10:33, Qiao Nuohan wrote: >>> Dumping guest memory is available to specify the dump format now. This patch >>> adds options '-z|-l|-s' to HMP command dump-guest-memory to specify dumping in >>> kdump-compression format, with zlib/lzo/snappy compression. And without these >>> options ELF format will be used. >>> >>> The discussion about this feature is here: >>> >>> http://lists.nongnu.org/archive/html/qemu-devel/2014-03/msg04235.html >>> >>> Signed-off-by: Qiao Nuohan >>> Suggested-by: Christian Borntraeger >> >> Looks good. I was able to take a zlib dump on s390. > > > In other words: > Acked-by: Christian Borntraeger > >> >> >>> --- >>> hmp-commands.hx | 11 +++++++---- >>> hmp.c | 25 ++++++++++++++++++++++++- >>> 2 files changed, 31 insertions(+), 5 deletions(-) >>> >>> diff --git a/hmp-commands.hx b/hmp-commands.hx >>> index f3fc514..4b9989f 100644 >>> --- a/hmp-commands.hx >>> +++ b/hmp-commands.hx >>> @@ -998,8 +998,8 @@ ETEXI >>> >>> { >>> .name = "dump-guest-memory", >>> - .args_type = "paging:-p,filename:F,begin:i?,length:i?", >>> - .params = "[-p] filename [begin] [length]", >>> + .args_type = "paging:-p,zlib:-z,lzo:-l,snappy:-s,filename:F,begin:i?,length:i?", >>> + .params = "[-p] [-z|-l|-s] filename [begin] [length]", >>> .help = "dump guest memory to file" >>> "\n\t\t\t begin(optional): the starting physical address" >>> "\n\t\t\t length(optional): the memory size, in bytes", >>> @@ -1008,12 +1008,15 @@ ETEXI >>> >>> >>> STEXI >>> -@item dump-guest-memory [-p] @var{protocol} @var{begin} @var{length} >>> +@item dump-guest-memory [-p] [-z|-l|-s] @var{protocol} @var{begin} @var{length} >>> @findex dump-guest-memory >>> Dump guest memory to @var{protocol}. The file can be processed with crash or >>> -gdb. >>> +gdb. Without -z|-l|-s, the dump format is ELF. >>> filename: dump file name >>> paging: do paging to get guest's memory mapping >>> + zlib: dump in kdump-compressed format, with zlib compression >>> + lzo: dump in kdump-compressed format, with lzo compression >>> + snappy: dump in kdump-compressed format, with snappy compression >>> begin: the starting physical address. It's optional, and should be >>> specified with length together. >>> length: the memory size, in bytes. It's optional, and should be specified >>> diff --git a/hmp.c b/hmp.c >>> index 2f279c4..37c3961 100644 >>> --- a/hmp.c >>> +++ b/hmp.c >>> @@ -1308,16 +1308,39 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) >>> { >>> Error *errp = NULL; >>> int paging = qdict_get_try_bool(qdict, "paging", 0); >>> + int zlib = qdict_get_try_bool(qdict, "zlib", 0); >>> + int lzo = qdict_get_try_bool(qdict, "lzo", 0); >>> + int snappy = qdict_get_try_bool(qdict, "snappy", 0); >>> const char *file = qdict_get_str(qdict, "filename"); >>> bool has_begin = qdict_haskey(qdict, "begin"); >>> bool has_length = qdict_haskey(qdict, "length"); >>> - /* kdump-compressed format is not supported for HMP */ >>> bool has_format = false; >>> int64_t begin = 0; >>> int64_t length = 0; >>> enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF; >>> char *prot; >>> >>> + if ((zlib + lzo + snappy)> 1) { >>> + error_setg(&errp, "only one of '-z|-l|-s' can be set"); >>> + hmp_handle_error(mon,&errp); >>> + return; >>> + } >>> + >>> + if (zlib) { >>> + has_format = true; >>> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB; >>> + } >>> + >>> + if (lzo) { >>> + has_format = true; >>> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO; >>> + } >>> + >>> + if (snappy) { >>> + has_format = true; >>> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY; >>> + } >>> + >>> if (has_begin) { >>> begin = qdict_get_int(qdict, "begin"); >>> } >>> >> >> > > . > -- Regards Qiao Nuohan