From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Alexander Graf <agraf@suse.de>, qemu list <qemu-devel@nongnu.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Andreas F?rber <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 01/18] migration: dump vmstate info as a json file for static analysis
Date: Wed, 21 May 2014 10:44:07 +0100 [thread overview]
Message-ID: <20140521094407.GC2589@work-vm> (raw)
In-Reply-To: <f75cb6f1f65dc9fb91e63db3fbe49711dea35060.1399892389.git.amit.shah@redhat.com>
* Amit Shah (amit.shah@redhat.com) wrote:
> This commit adds a new command, '-dump-vmstate', that takes a filename
> as a parameter. When executed, QEMU will dump the vmstate information
> for the machine type it's invoked with to the file, and quit.
>
> The JSON-format output can then be used to compare the vmstate info for
> different QEMU versions, specifically to test whether live migration
> would break due to changes in the vmstate data.
>
> This is based on a version from Andreas Färber posted here:
> https://lists.gnu.org/archive/html/qemu-devel/2013-10/msg03095.html
>
> A Python script that compares the output of such JSON dumps is included
> in the following commit.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> include/migration/vmstate.h | 2 +
> qemu-options.hx | 9 +++
> savevm.c | 134 ++++++++++++++++++++++++++++++++++++++++++++
> vl.c | 14 +++++
> 4 files changed, 159 insertions(+)
>
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index 7e45048..9829c0e 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -778,4 +778,6 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
> void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
> void vmstate_register_ram_global(struct MemoryRegion *memory);
>
> +void dump_vmstate_json_to_file(FILE *out_fp);
> +
> #endif
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 781af14..d376227 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -3146,6 +3146,15 @@ STEXI
> prepend a timestamp to each log message.(default:on)
> ETEXI
>
> +DEF("dump-vmstate", HAS_ARG, QEMU_OPTION_dump_vmstate,
> + "-dump-vmstate <file>\n" "", QEMU_ARCH_ALL)
> +STEXI
> +@item -dump-vmstate @var{file}
> +@findex -dump-vmstate
> +Dump json-encoded vmstate information for current machine type to file
> +in @var{file}
> +ETEXI
> +
> HXCOMM This is the last statement. Insert new options before this line!
> STEXI
> @end table
> diff --git a/savevm.c b/savevm.c
> index da8aa24..a4ce279 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -24,6 +24,7 @@
>
> #include "config-host.h"
> #include "qemu-common.h"
> +#include "hw/boards.h"
> #include "hw/hw.h"
> #include "hw/qdev.h"
> #include "net/net.h"
> @@ -241,6 +242,139 @@ static QTAILQ_HEAD(savevm_handlers, SaveStateEntry) savevm_handlers =
> QTAILQ_HEAD_INITIALIZER(savevm_handlers);
> static int global_section_id;
>
> +static void dump_vmstate_vmsd(FILE *out_file,
> + const VMStateDescription *vmsd, int indent,
> + bool is_subsection);
> +
> +static void dump_vmstate_vmsf(FILE *out_file, const VMStateField *field,
> + int indent)
checkpatch points out that some tabs managed to get into that indent line.
Generally I think this patch is OK and quite useful; two thoughts:
1) I was surprised it dumped every object type, rather than just those
that are instantiated; I think the latter would be more use in some
circumstances, since there's a load of weird and wonderful objects
that exist and are very rarely used.
2) 'fields_exists' is a weird naming to put in the json file - it's
a function pointer for determining if the field is going to be present;
maybe renaming as 'conditional' would make sense.
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2014-05-21 9:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 11:16 [Qemu-devel] [PATCH 00/18] migration: add static analysis tool to check vmstate compat between versions Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 01/18] migration: dump vmstate info as a json file for static analysis Amit Shah
2014-05-12 12:51 ` Eric Blake
2014-05-13 4:12 ` Amit Shah
2014-05-21 11:45 ` Eric Blake
2014-05-21 9:44 ` Dr. David Alan Gilbert [this message]
2014-05-21 9:55 ` Amit Shah
2014-05-21 10:03 ` Dr. David Alan Gilbert
2014-05-21 10:12 ` Amit Shah
2014-05-21 11:47 ` Markus Armbruster
2014-05-21 11:45 ` Markus Armbruster
2014-05-12 11:16 ` [Qemu-devel] [PATCH 02/18] vmstate-static-checker: script to validate vmstate changes Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 03/18] tests: vmstate static checker: add dump1 and dump2 files Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 04/18] tests: vmstate static checker: incompat machine types Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 05/18] tests: vmstate static checker: add version error in main section Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 06/18] tests: vmstate static checker: version mismatch inside a Description Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 07/18] tests: vmstate static checker: minimum_version_id check Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 08/18] tests: vmstate static checker: remove a section Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 09/18] tests: vmstate static checker: remove a field Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 10/18] tests: vmstate static checker: remove last field in a struct Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 11/18] tests: vmstate static checker: change description name Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 12/18] tests: vmstate static checker: remove Fields Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 13/18] tests: vmstate static checker: remove Description Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 14/18] tests: vmstate static checker: remove Description inside Fields Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 15/18] tests: vmstate static checker: remove a subsection Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 16/18] tests: vmstate static checker: remove Subsections Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 17/18] tests: vmstate static checker: add substructure for usb-kbd for hid section Amit Shah
2014-05-12 11:16 ` [Qemu-devel] [PATCH 18/18] tests: vmstate static checker: add size mismatch inside substructure Amit Shah
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=20140521094407.GC2589@work-vm \
--to=dgilbert@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).