qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 00/18] migration: add static analysis tool to check


From: Amit Shah
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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]