From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: "Juan Quintela" <quintela@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Alexander Graf" <agraf@suse.de>,
"\\\"Dr. David Alan Gilbert\\\"" <dgilbert@redhat.com>,
"Amit Shah" <amit.shah@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 00/18] migration: add static analysis tool to check vmstate compat between versions
Date: Mon, 12 May 2014 16:46:00 +0530 [thread overview]
Message-ID: <cover.1399892389.git.amit.shah@redhat.com> (raw)
Hello,
This series adds a static vmstate checker to check for breakage of
live migration by analyzing the vmstate information between different
QEMU versions.
QEMU is modified to add a -dump-vmstate commandline option, which
takes a filename as the argument. When invoked, QEMU dumps the
vmstate info in JSON format for the current machine type to the file.
This file is then fed into the python script introduced in patch 2.
The script takes 'src' and 'dest' arguments, indicating the direction
of migration. The script then performs a series of checks and spews
out information on inconsistencies it finds in the data.
Two stripped-down versions of JSON dumps are included in this
patchset (patch 3).
Patches 4 - 18 contain modifications to those dumps, to show the
checks that are carried out by the script. The result of running the
script against the final version of those files is appended at the end.
The checks are to be performed for a particular machine type, and
comparing different machine types is bound to turn up false-positives:
e.g.
(in a qemu 2.0 tree):
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json
(in a qemu 2.2 tree:)
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-2.0 qemu-2.2-m2.0.json
./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json
should not show any output.
The idea is to include this script in 'make check', ensuring new
commits don't break migration.
Later, this script can also be baked into the release process: vmstate
dumps for released versions of qemu for various machine types can be
stored in a directory in the tree. At the time of freezing the tree
for releases, (like -rc2), the dump for the current release can be
updated. A policy that says "No more live migration-breaking changes
can be accepted post -rc2" can be put in place. Also, for checks for
older machine types on the current tree with the saved dumps should
not indicate any regressions.
I expect there to be a few false positives at the start (though there
aren't any right now). The script will keep evolving, though, to
include new scenarios, to make it more helpful.
A later project would be to also store other guest-visible information
and use that output for more checks (including lspci output from
inside guests).
As mentioned earlier, this is the result of running the script against
the sample json data included in this patchset:
$ ./scripts/vmstate-static-checker.py --src ./tests/vmstate-static-checker-data/dump1.json --dest ./tests/vmstate-static-checker-data/dump2.json
Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
Section "PIIX3-xen" Description "PIIX3": minimum version error: 1 < 2
Section "PIIX3-xen" Description "PIIX3": Entry "Subsections" missing
Section "tpci200": Description "tpci200" missing, got "tpci2002" instead; skipping
Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
Section "SUNW,fdtwo" Description "fdc": version error: 2 > 1
Section "SUNW,fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
Section "fusbh200-ehci-usb" version error: 2 > 1
Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
Section "cfi.pflash01": Entry "Description" missing
Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
Section "fw_cfg" does not exist in dest
Amit Shah (18):
migration: dump vmstate info as a json file for static analysis
vmstate-static-checker: script to validate vmstate changes
tests: vmstate static checker: add dump1 and dump2 files
tests: vmstate static checker: incompat machine types
tests: vmstate static checker: add version error in main section
tests: vmstate static checker: version mismatch inside a Description
tests: vmstate static checker: minimum_version_id check
tests: vmstate static checker: remove a section
tests: vmstate static checker: remove a field
tests: vmstate static checker: remove last field in a struct
tests: vmstate static checker: change description name
tests: vmstate static checker: remove Fields
tests: vmstate static checker: remove Description
tests: vmstate static checker: remove Description inside Fields
tests: vmstate static checker: remove a subsection
tests: vmstate static checker: remove Subsections
tests: vmstate static checker: add substructure for usb-kbd for hid
section
tests: vmstate static checker: add size mismatch inside substructure
include/migration/vmstate.h | 2 +
qemu-options.hx | 9 +
savevm.c | 134 +++
scripts/vmstate-static-checker.py | 336 ++++++++
tests/vmstate-static-checker-data/dump1.json | 1163 ++++++++++++++++++++++++++
tests/vmstate-static-checker-data/dump2.json | 968 +++++++++++++++++++++
vl.c | 14 +
7 files changed, 2626 insertions(+)
create mode 100755 scripts/vmstate-static-checker.py
create mode 100644 tests/vmstate-static-checker-data/dump1.json
create mode 100644 tests/vmstate-static-checker-data/dump2.json
--
1.9.0
next reply other threads:[~2014-05-12 11:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-12 11:16 Amit Shah [this message]
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
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=cover.1399892389.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=dgilbert@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).