From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVgZP-0005FF-Vn for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:16:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVgZJ-0006fs-63 for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:16:35 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:52634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVgZI-0006fO-TY for qemu-devel@nongnu.org; Thu, 03 Apr 2014 08:16:29 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Apr 2014 13:16:26 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B52BE2190063 for ; Thu, 3 Apr 2014 13:16:18 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s33CGDwM63438922 for ; Thu, 3 Apr 2014 12:16:13 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s33CGNjk025821 for ; Thu, 3 Apr 2014 06:16:23 -0600 Message-ID: <533D5112.3050303@de.ibm.com> Date: Thu, 03 Apr 2014 14:16:18 +0200 From: Christian Borntraeger MIME-Version: 1.0 References: <1396341182-1805-1-git-send-email-qiaonuohan@cn.fujitsu.com> <533ABE41.2070306@de.ibm.com> In-Reply-To: <533ABE41.2070306@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 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: Qiao Nuohan , qemu-devel@nongnu.org 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"); >> } >> > >