Skip to contentSkip to conversation

tests/functional: Test with scripts/vmstate-static-checker.py

PATCH Superseded Thomas Huth 2 participants 13 messages May 22, 2025 – May 26, 2025

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover tests/functional: Test with scripts/vmstate-static-checker.py

This set of patches adds an automatic test of the vmstate via the scripts/vmstate-static-checker.py script. For this we need some reference files from an older version of QEMU. I chose to use QEMU 7.2 for the reference files since this is a long term support release that is still actively being maintained, so we certainly want to make sure that we don't break migration from that version to the latest one.

There are also some files available in tests/vmstate-static-checker-data/ which were used in the past to verify the functionality of the checker script. Move them to tests/data/vmstate-static-checker now and add an automated test for this task, too.

(I originally mentioned that I could also look into testing automatically with an older version of QEMU, but I currently lack the time to do so, so if somebody else wants to have a try that would be very welcome!)

v2:
- Dropped the patch that is already upstream
- Don't remove the old dump files, rather test for the expected output of the checker script with them

Thomas Huth (4):
tests: Move the old vmstate-static-checker files to tests/data/ tests/data/vmstate-static-checker: Add dump files from QEMU 7.2.17 tests/functional: Test with scripts/vmstate-static-checker.py tests/functional/test_vmstate: Test whether the checker script works
as expected

 MAINTAINERS                                   |    3 +-
 .../aarch64/virt-7.2.json                     | 2571 +++++++++++++
 .../vmstate-static-checker}/dump1.json        |    0
 .../vmstate-static-checker}/dump2.json        |    0
 .../vmstate-static-checker/m68k/virt-7.2.json | 2936 +++++++++++++++
 .../ppc64/pseries-7.2.json                    | 1068 ++++++
 .../s390x/s390-ccw-virtio-7.2.json            |  475 +++
 .../x86_64/pc-q35-7.2.json                    | 3297 +++++++++++++++++
 tests/functional/meson.build                  |   13 +-
 tests/functional/test_vmstate.py              |   96 +
 10 files changed, 10457 insertions(+), 2 deletions(-)
 create mode 100644 tests/data/vmstate-static-checker/aarch64/virt-7.2.json
 rename tests/{vmstate-static-checker-data => data/vmstate-static-checker}/dump1.json (100%)
 rename tests/{vmstate-static-checker-data => data/vmstate-static-checker}/dump2.json (100%)
 create mode 100644 tests/data/vmstate-static-checker/m68k/virt-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/ppc64/pseries-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/s390x/s390-ccw-virtio-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/x86_64/pc-q35-7.2.json
 create mode 100755 tests/functional/test_vmstate.py
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/4 tests: Move the old vmstate-static-checker files to tests/data/

From: Thomas Huth <[email protected]>

All other test data resides in tests/data/, so let's move the dump files here, too.

---
 MAINTAINERS                                                     | 2 +-
 .../vmstate-static-checker}/dump1.json                          | 0
 .../vmstate-static-checker}/dump2.json                          | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename tests/{vmstate-static-checker-data => data/vmstate-static-checker}/dump1.json (100%)
 rename tests/{vmstate-static-checker-data => data/vmstate-static-checker}/dump2.json (100%)
MAINTAINERS +1 -1
index 7060cf49b98..55735de4e4e 100644
@@ -3546,8 +3546,8 @@ F: include/migration/
 F: include/qemu/userfaultfd.h
 F: migration/
 F: scripts/vmstate-static-checker.py
+F: tests/data/vmstate-static-checker/
 F: tests/functional/test_migration.py
-F: tests/vmstate-static-checker-data/
 F: tests/qtest/migration/
 F: tests/qtest/migration-*
 F: docs/devel/migration/
tests/data/vmstate-static-checker/dump1.json renamed from tests/vmstate-static-checker-data/dump1.json +0 -0
similarity index 100%
rename from tests/vmstate-static-checker-data/dump1.json
rename to tests/data/vmstate-static-checker/dump1.json
tests/data/vmstate-static-checker/dump2.json renamed from tests/vmstate-static-checker-data/dump2.json +0 -0
similarity index 100%
rename from tests/vmstate-static-checker-data/dump2.json
rename to tests/data/vmstate-static-checker/dump2.json
Signature · 1 line
2.49.0
#3 lore raw

PATCH v2 2/4 tests/data/vmstate-static-checker: Add dump files from QEMU 7.2.17

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

For automatic tests, we need reference files from older QEMU versions. QEMU 7.2 is a long term stable release, so it's a good candidate for checking whether the migration could still work correctly. Let's add the files from that version that have been taken with the "-dump-vmstate" parameter of QEMU (compiled with single machines and the configure switch "--without-default-devices" to keep the json files reasonable small).

Some devices also have been removed manually from the json files, e.g. the "pci-bridge" (which can be disabled in later QEMU versions via Kconfig), and some Linux-related devices like "scsi-block" and "scsi-generic" and KVM-related devices. Without removing them, we might get errors otherwise if these devices have not been compiled into the destination QEMU build.

---
 .../aarch64/virt-7.2.json                     | 2571 +++++++++++++
 .../vmstate-static-checker/m68k/virt-7.2.json | 2936 +++++++++++++++
 .../ppc64/pseries-7.2.json                    | 1068 ++++++
 .../s390x/s390-ccw-virtio-7.2.json            |  475 +++
 .../x86_64/pc-q35-7.2.json                    | 3297 +++++++++++++++++
 5 files changed, 10347 insertions(+)
 create mode 100644 tests/data/vmstate-static-checker/aarch64/virt-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/m68k/virt-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/ppc64/pseries-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/s390x/s390-ccw-virtio-7.2.json
 create mode 100644 tests/data/vmstate-static-checker/x86_64/pc-q35-7.2.json
tests/data/vmstate-static-checker/aarch64/virt-7.2.json new file +2571 -0
new file mode 100644
index 00000000000..d7491be99cb
@@ -0,0 +1,2571 @@
+{
+  "vmschkmachine": {
+    "Name": "virt-7.2"
+  },
+  "gpex-pcihost": {
+    "Name": "gpex-pcihost",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "PCIHost",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "config_reg",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ]
+    }
+  },
+  "arm_gic": {
+    "Name": "arm_gic",
+    "version_id": 12,
+    "minimum_version_id": 12,
+    "Description": {
+      "name": "arm_gic",
+      "version_id": 12,
+      "minimum_version_id": 12,
+      "Fields": [
+        {
+          "field": "ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cpu_ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "irq_state",
+          "version_id": 1,
+          "field_exists": false,
+          "size": 7,
+          "Description": {
+            "name": "arm_gic_irq_state",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "enabled",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "pending",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "active",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "level",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "model",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "edge_trigger",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "group",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              }
+            ]
+          }
+        },
+        {
+          "field": "irq_target",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority1",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority2",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "sgi_pending",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority_mask",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "running_priority",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "current_pending",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "bpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "abpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "apr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "nsapr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "arm_gic_virt_state",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "h_hcr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_misr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_lr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_apr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "cpu_ctlr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "priority_mask",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "running_priority",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "current_pending",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "bpr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            },
+            {
+              "field": "abpr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "arm-gicv3-its-common": {
+    "Name": "arm-gicv3-its-common",
+    "version_id": 0,
+    "minimum_version_id": 0,
+    "Description": {
+      "name": "arm_gicv3_its",
+      "version_id": 0,
+      "minimum_version_id": 0,
+      "Fields": [
+        {
+          "field": "ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "iidr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cbaser",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "cwriter",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "creadr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "baser",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        }
+      ]
+    }
+  },
+  "arm-gicv3-common": {
+    "Name": "arm-gicv3-common",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "arm_gicv3",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "gicd_ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gicd_statusr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "group",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "grpmod",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "enabled",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "pending",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "active",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "level",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "edge_trigger",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gicd_ipriority",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "gicd_irouter",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "gicd_nsacr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cpu",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 664,
+          "Description": {
+            "name": "arm_gicv3_cpu",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "level",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_ctlr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_statusr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_waker",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_propbaser",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "gicr_pendbaser",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "gicr_igroupr0",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_ienabler0",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_ipendr0",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_iactiver0",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "edge_trigger",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_igrpmodr0",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_nsacr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "gicr_ipriorityr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "icc_ctlr_el1",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "icc_pmr_el1",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "icc_bpr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "icc_apr",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "icc_igrpen",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "icc_ctlr_el3",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ],
+            "Subsections": [
+              {
+                "name": "arm_gicv3_cpu/virt",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "ich_apr",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  },
+                  {
+                    "field": "ich_hcr_el2",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  },
+                  {
+                    "field": "ich_lr_el2",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  },
+                  {
+                    "field": "ich_vmcr_el2",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ]
+              },
+              {
+                "name": "arm_gicv3_cpu/sre_el1",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "icc_sre_el1",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ]
+              },
+              {
+                "name": "arm_gicv3_cpu/gicv4",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "gicr_vpropbaser",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  },
+                  {
+                    "field": "gicr_vpendbaser",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "arm_gicv3/gicd_no_migration_shift_bug",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "gicd_no_migration_shift_bug",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "fw_cfg": {
+    "Name": "fw_cfg",
+    "version_id": 2,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "fw_cfg",
+      "version_id": 2,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "cur_entry",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 0,
+          "field_exists": true,
+          "size": 4
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 2,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "fw_cfg/dma",
+          "version_id": 0,
+          "minimum_version_id": 0,
+          "Fields": [
+            {
+              "field": "dma_addr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        },
+        {
+          "name": "fw_cfg/acpi_mr",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "table_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "linker_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "rsdp_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "cfi.pflash01": {
+    "Name": "cfi.pflash01",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "pflash_cfi01",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "wcycle",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "cmd",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "status",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "counter",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "pflash_cfi01_blk_write",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "blk_bytes",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 0
+            },
+            {
+              "field": "blk_offset",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "pl061_luminary": {
+    "Name": "pl061_luminary",
+    "version_id": 4,
+    "minimum_version_id": 4,
+    "Description": {
+      "name": "pl061",
+      "version_id": 4,
+      "minimum_version_id": 4,
+      "Fields": [
+        {
+          "field": "locked",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "old_out_data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "old_in_data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dir",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "isense",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ibe",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "iev",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "im",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "istate",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "afsel",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr2r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr4r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr8r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "odr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "pur",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "pdr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "slr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "den",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "amsel",
+          "version_id": 2,
+          "field_exists": false,
+          "size": 4
+        }
+      ]
+    }
+  },
+  "pl011_luminary": {
+    "Name": "pl011_luminary",
+    "version_id": 2,
+    "minimum_version_id": 2,
+    "Description": {
+      "name": "pl011",
+      "version_id": 2,
+      "minimum_version_id": 2,
+      "Fields": [
+        {
+          "field": "readbuff",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "flags",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "lcr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "rsr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dmacr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "int_enabled",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "int_level",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_fifo",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ilpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ibrd",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "fbrd",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ifl",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_pos",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_count",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_trigger",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "pl011/clock",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "clk",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8,
+              "Description": {
+                "name": "clock",
+                "version_id": 0,
+                "minimum_version_id": 0,
+                "Fields": [
+                  {
+                    "field": "period",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ],
+                "Subsections": [
+                  {
+                    "name": "clock/muldiv",
+                    "version_id": 1,
+                    "minimum_version_id": 1,
+                    "Fields": [
+                      {
+                        "field": "multiplier",
+                        "version_id": 0,
+                        "field_exists": false,
+                        "size": 4
+                      },
+                      {
+                        "field": "divider",
+                        "version_id": 0,
+                        "field_exists": false,
+                        "size": 4
+                      }
+                    ]
+                  }
+                ]
+              }
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "pl061": {
+    "Name": "pl061",
+    "version_id": 4,
+    "minimum_version_id": 4,
+    "Description": {
+      "name": "pl061",
+      "version_id": 4,
+      "minimum_version_id": 4,
+      "Fields": [
+        {
+          "field": "locked",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "old_out_data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "old_in_data",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dir",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "isense",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ibe",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "iev",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "im",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "istate",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "afsel",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr2r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr4r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dr8r",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "odr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "pur",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "pdr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "slr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "den",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "amsel",
+          "version_id": 2,
+          "field_exists": false,
+          "size": 4
+        }
+      ]
+    }
+  },
+  "vmcoreinfo": {
+    "Name": "vmcoreinfo",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "vmcoreinfo",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "has_vmcoreinfo",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "vmcoreinfo.host_format",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "vmcoreinfo.guest_format",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "vmcoreinfo.size",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "vmcoreinfo.paddr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        }
+      ]
+    }
+  },
+  "arm_gic_common": {
+    "Name": "arm_gic_common",
+    "version_id": 12,
+    "minimum_version_id": 12,
+    "Description": {
+      "name": "arm_gic",
+      "version_id": 12,
+      "minimum_version_id": 12,
+      "Fields": [
+        {
+          "field": "ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cpu_ctlr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "irq_state",
+          "version_id": 1,
+          "field_exists": false,
+          "size": 7,
+          "Description": {
+            "name": "arm_gic_irq_state",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "enabled",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "pending",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "active",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "level",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "model",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "edge_trigger",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "group",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              }
+            ]
+          }
+        },
+        {
+          "field": "irq_target",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority1",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority2",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "sgi_pending",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "priority_mask",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "running_priority",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "current_pending",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "bpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "abpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "apr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "nsapr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "arm_gic_virt_state",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "h_hcr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_misr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_lr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "h_apr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "cpu_ctlr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "priority_mask",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "running_priority",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "current_pending",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 2
+            },
+            {
+              "field": "bpr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            },
+            {
+              "field": "abpr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "arm-smmuv3": {
+    "Name": "arm-smmuv3",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "smmuv3",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "features",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "sid_size",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "sid_split",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 1
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr0ack",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "statusr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "irq_ctrl",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gerror",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gerrorn",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gerror_irq_cfg0",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "gerror_irq_cfg1",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "gerror_irq_cfg2",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "strtab_base",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "strtab_base_cfg",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "eventq_irq_cfg0",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "eventq_irq_cfg1",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "eventq_irq_cfg2",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cmdq",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 24,
+          "Description": {
+            "name": "smmuv3_queue",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "base",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "prod",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "cons",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "log2size",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              }
+            ]
+          }
+        },
+        {
+          "field": "eventq",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 24,
+          "Description": {
+            "name": "smmuv3_queue",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "base",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "prod",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "cons",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "log2size",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              }
+            ]
+          }
+        }
+      ]
+    }
+  },
+  "pl011": {
+    "Name": "pl011",
+    "version_id": 2,
+    "minimum_version_id": 2,
+    "Description": {
+      "name": "pl011",
+      "version_id": 2,
+      "minimum_version_id": 2,
+      "Fields": [
+        {
+          "field": "readbuff",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "flags",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "lcr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "rsr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "dmacr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "int_enabled",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "int_level",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_fifo",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ilpr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ibrd",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "fbrd",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "ifl",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_pos",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_count",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "read_trigger",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "pl011/clock",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "clk",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8,
+              "Description": {
+                "name": "clock",
+                "version_id": 0,
+                "minimum_version_id": 0,
+                "Fields": [
+                  {
+                    "field": "period",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ],
+                "Subsections": [
+                  {
+                    "name": "clock/muldiv",
+                    "version_id": 1,
+                    "minimum_version_id": 1,
+                    "Fields": [
+                      {
+                        "field": "multiplier",
+                        "version_id": 0,
+                        "field_exists": false,
+                        "size": 4
+                      },
+                      {
+                        "field": "divider",
+                        "version_id": 0,
+                        "field_exists": false,
+                        "size": 4
+                      }
+                    ]
+                  }
+                ]
+              }
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "armv7m": {
+    "Name": "armv7m",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "armv7m",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "refclk",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8,
+          "Description": {
+            "name": "clock",
+            "version_id": 0,
+            "minimum_version_id": 0,
+            "Fields": [
+              {
+                "field": "period",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ],
+            "Subsections": [
+              {
+                "name": "clock/muldiv",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "multiplier",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  },
+                  {
+                    "field": "divider",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  }
+                ]
+              }
+            ]
+          }
+        },
+        {
+          "field": "cpuclk",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8,
+          "Description": {
+            "name": "clock",
+            "version_id": 0,
+            "minimum_version_id": 0,
+            "Fields": [
+              {
+                "field": "period",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ],
+            "Subsections": [
+              {
+                "name": "clock/muldiv",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "multiplier",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  },
+                  {
+                    "field": "divider",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  }
+                ]
+              }
+            ]
+          }
+        }
+      ]
+    }
+  },
+  "fw_cfg_mem": {
+    "Name": "fw_cfg_mem",
+    "version_id": 2,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "fw_cfg",
+      "version_id": 2,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "cur_entry",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 0,
+          "field_exists": true,
+          "size": 4
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 2,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "fw_cfg/dma",
+          "version_id": 0,
+          "minimum_version_id": 0,
+          "Fields": [
+            {
+              "field": "dma_addr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        },
+        {
+          "name": "fw_cfg/acpi_mr",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "table_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "linker_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "rsdp_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "pl031": {
+    "Name": "pl031",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "pl031",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "tick_offset_vmstate",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "mr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "lr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "cr",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "im",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "is",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "pl031/tick-offset",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "tick_offset",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "fw_cfg_io": {
+    "Name": "fw_cfg_io",
+    "version_id": 2,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "fw_cfg",
+      "version_id": 2,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "cur_entry",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 0,
+          "field_exists": true,
+          "size": 4
+        },
+        {
+          "field": "cur_offset",
+          "version_id": 2,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "fw_cfg/dma",
+          "version_id": 0,
+          "minimum_version_id": 0,
+          "Fields": [
+            {
+              "field": "dma_addr",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        },
+        {
+          "name": "fw_cfg/acpi_mr",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "table_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "linker_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            },
+            {
+              "field": "rsdp_mr_size",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 8
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "virtio-serial-device": {
+    "Name": "virtio-serial-device",
+    "version_id": 3,
+    "minimum_version_id": 3,
+    "Description": {
+      "name": "virtio-console",
+      "version_id": 3,
+      "minimum_version_id": 3,
+      "Fields": [
+        {
+          "field": "virtio",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 0
+        }
+      ]
+    }
+  },
+  "acpi-ged": {
+    "Name": "acpi-ged",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "acpi-ged",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "ged_state",
+          "version_id": 1,
+          "field_exists": false,
+          "size": 560,
+          "Description": {
+            "name": "acpi-ged-state",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "sel",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              }
+            ]
+          }
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "acpi-ged/memhp",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "memhp_state",
+              "version_id": 1,
+              "field_exists": false,
+              "size": 304,
+              "Description": {
+                "name": "memory hotplug state",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "selector",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  },
+                  {
+                    "field": "devs",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 24,
+                    "Description": {
+                      "name": "memory hotplug device state",
+                      "version_id": 1,
+                      "minimum_version_id": 1,
+                      "Fields": [
+                        {
+                          "field": "is_enabled",
+                          "version_id": 0,
+                          "field_exists": false,
+                          "size": 1
+                        },
+                        {
+                          "field": "is_inserting",
+                          "version_id": 0,
+                          "field_exists": false,
+                          "size": 1
+                        },
+                        {
+                          "field": "ost_event",
+                          "version_id": 0,
+                          "field_exists": false,
+                          "size": 4
+                        },
+                        {
+                          "field": "ost_status",
+                          "version_id": 0,
+                          "field_exists": false,
+                          "size": 4
+                        }
+                      ]
+                    }
+                  }
+                ]
+              }
+            }
+          ]
+        },
+        {
+          "name": "acpi-ged/ghes",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "ghes_state",
+              "version_id": 1,
+              "field_exists": false,
+              "size": 16,
+              "Description": {
+                "name": "acpi-ghes",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "ghes_addr_le",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 8
+                  }
+                ]
+              }
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "pcie-host-bridge": {
+    "Name": "pcie-host-bridge",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "PCIHost",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "config_reg",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ]
+    }
+  },
+  "gpio-key": {
+    "Name": "gpio-key",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "gpio-key",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "timer",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        }
+      ]
+    }
+  },
+  "armv7m_nvic": {
+    "Name": "armv7m_nvic",
+    "version_id": 4,
+    "minimum_version_id": 4,
+    "Description": {
+      "name": "armv7m_nvic",
+      "version_id": 4,
+      "minimum_version_id": 4,
+      "Fields": [
+        {
+          "field": "vectors",
+          "version_id": 1,
+          "field_exists": false,
+          "size": 6,
+          "Description": {
+            "name": "armv7m_nvic_info",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "prio",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 2
+              },
+              {
+                "field": "enabled",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "pending",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "active",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "level",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              }
+            ]
+          }
+        },
+        {
+          "field": "prigroup[M_REG_NS]",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ],
+      "Subsections": [
+        {
+          "name": "armv7m_nvic/m-security",
+          "version_id": 1,
+          "minimum_version_id": 1,
+          "Fields": [
+            {
+              "field": "sec_vectors",
+              "version_id": 1,
+              "field_exists": false,
+              "size": 6,
+              "Description": {
+                "name": "armv7m_nvic_info",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "prio",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 2
+                  },
+                  {
+                    "field": "enabled",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 1
+                  },
+                  {
+                    "field": "pending",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 1
+                  },
+                  {
+                    "field": "active",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 1
+                  },
+                  {
+                    "field": "level",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 1
+                  }
+                ]
+              }
+            },
+            {
+              "field": "prigroup[M_REG_S]",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 4
+            },
+            {
+              "field": "itns",
+              "version_id": 0,
+              "field_exists": false,
+              "size": 1
+            }
+          ]
+        }
+      ]
+    }
+  },
+  "pci-host-bridge": {
+    "Name": "pci-host-bridge",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "PCIHost",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "config_reg",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        }
+      ]
+    }
+  },
+  "gpex-root": {
+    "Name": "gpex-root",
+    "version_id": 1,
+    "minimum_version_id": 1,
+    "Description": {
+      "name": "gpex_root",
+      "version_id": 1,
+      "minimum_version_id": 1,
+      "Fields": [
+        {
+          "field": "parent_obj",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 2608,
+          "Description": {
+            "name": "PCIDevice",
+            "version_id": 2,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "version_id",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "config",
+                "version_id": 0,
+                "field_exists": true,
+                "size": 256
+              },
+              {
+                "field": "config",
+                "version_id": 0,
+                "field_exists": true,
+                "size": 4096
+              },
+              {
+                "field": "irq_state",
+                "version_id": 2,
+                "field_exists": false,
+                "size": 16
+              }
+            ]
+          }
+        }
+      ]
+    }
+  },
+  "armv7m_systick": {
+    "Name": "armv7m_systick",
+    "version_id": 3,
+    "minimum_version_id": 3,
+    "Description": {
+      "name": "armv7m_systick",
+      "version_id": 3,
+      "minimum_version_id": 3,
+      "Fields": [
+        {
+          "field": "refclk",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8,
+          "Description": {
+            "name": "clock",
+            "version_id": 0,
+            "minimum_version_id": 0,
+            "Fields": [
+              {
+                "field": "period",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ],
+            "Subsections": [
+              {
+                "name": "clock/muldiv",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "multiplier",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  },
+                  {
+                    "field": "divider",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  }
+                ]
+              }
+            ]
+          }
+        },
+        {
+          "field": "cpuclk",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8,
+          "Description": {
+            "name": "clock",
+            "version_id": 0,
+            "minimum_version_id": 0,
+            "Fields": [
+              {
+                "field": "period",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ],
+            "Subsections": [
+              {
+                "name": "clock/muldiv",
+                "version_id": 1,
+                "minimum_version_id": 1,
+                "Fields": [
+                  {
+                    "field": "multiplier",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  },
+                  {
+                    "field": "divider",
+                    "version_id": 0,
+                    "field_exists": false,
+                    "size": 4
+                  }
+                ]
+              }
+            ]
+          }
+        },
+        {
+          "field": "control",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 4
+        },
+        {
+          "field": "tick",
+          "version_id": 0,
+          "field_exists": false,
+          "size": 8
+        },
+        {
+          "field": "ptimer",
+          "version_id": 1,
+          "field_exists": false,
+          "size": 8,
+          "Description": {
+            "name": "ptimer",
+            "version_id": 1,
+            "minimum_version_id": 1,
+            "Fields": [
+              {
+                "field": "enabled",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 1
+              },
+              {
+                "field": "limit",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "delta",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "period_frac",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 4
+              },
+              {
+                "field": "period",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "last_event",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "next_event",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              },
+              {
+                "field": "timer",
+                "version_id": 0,
+                "field_exists": false,
+                "size": 8
+              }
+            ]
+          }
+        }
+      ]
+    }
+  }
+}
tests/data/vmstate-static-checker/m68k/virt-7.2.json new file +2936 -0

429 lines not on this page · raw message

tests/data/vmstate-static-checker/ppc64/pseries-7.2.json new file +1068 -0

1,068 lines not on this page · raw message

tests/data/vmstate-static-checker/s390x/s390-ccw-virtio-7.2.json new file +475 -0

475 lines not on this page · raw message

tests/data/vmstate-static-checker/x86_64/pc-q35-7.2.json new file +3297 -0

3,297 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.49.0

Part of the diff is not shown here. View the raw message.

Acked-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] tests/data/vmstate-static-checker: Add dump files from QEMU 7.2.17

Quoted 9 lines · Thomas Huth

From: Thomas Huth <[email protected]>

For automatic tests, we need reference files from older QEMU versions. QEMU 7.2 is a long term stable release, so it's a good candidate for checking whether the migration could still work correctly. Let's add the files from that version that have been taken with the "-dump-vmstate" parameter of QEMU (compiled with single machines and the configure switch "--without-default-devices" to keep the json files reasonable small).

Quoted 7 lines

Some devices also have been removed manually from the json files, e.g. the "pci-bridge" (which can be disabled in later QEMU versions via Kconfig), and some Linux-related devices like "scsi-block" and "scsi-generic" and KVM-related devices. Without removing them, we might get errors otherwise if these devices have not been compiled into the destination QEMU build.

Signature · 1 line
Peter Xu
#5 lore raw

PATCH v2 3/4 tests/functional: Test with scripts/vmstate-static-checker.py

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

We've got this nice vmstate-static-checker.py script that can help to detect screw-ups in the migration states. Unfortunately, it's currently only run manually, so there are regressions that nobody notices immediately. Let's run it from a functional test automatically so that we got at least a basic coverage in each CI run.

---
 MAINTAINERS                      |  1 +
 tests/functional/meson.build     | 13 ++++++-
 tests/functional/test_vmstate.py | 59 ++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100755 tests/functional/test_vmstate.py
MAINTAINERS +1 -0
index 55735de4e4e..e92c60f891d 100644
@@ -3548,6 +3548,7 @@ F: migration/
 F: scripts/vmstate-static-checker.py
 F: tests/data/vmstate-static-checker/
 F: tests/functional/test_migration.py
+F: tests/functional/test_vmstate.py
 F: tests/qtest/migration/
 F: tests/qtest/migration-*
 F: docs/devel/migration/
tests/functional/meson.build +12 -1
index 52b4706cfe8..81fc26ca3d5 100644
@@ -78,6 +78,7 @@ tests_generic_bsduser = [
 
 tests_aarch64_system_quick = [
   'migration',
+  'vmstate',
 ]
 
 tests_aarch64_system_thorough = [
@@ -168,6 +169,10 @@ tests_loongarch64_system_thorough = [
   'loongarch64_virt',
 ]
 
+tests_m68k_system_quick = [
+  'vmstate',
+]
+
 tests_m68k_system_thorough = [
   'm68k_mcf5208evb',
   'm68k_nextcube',
@@ -234,6 +239,7 @@ tests_ppc_system_thorough = [
 
 tests_ppc64_system_quick = [
   'migration',
+  'vmstate',
 ]
 
 tests_ppc64_system_thorough = [
@@ -269,6 +275,10 @@ tests_rx_system_thorough = [
   'rx_gdbsim',
 ]
 
+tests_s390x_system_quick = [
+  'vmstate',
+]
+
 tests_s390x_system_thorough = [
   's390x_ccw_virtio',
   's390x_replay',
@@ -309,8 +319,9 @@ tests_x86_64_system_quick = [
   'migration',
   'pc_cpu_hotplug_props',
   'virtio_version',
-  'x86_cpu_model_versions',
+  'vmstate',
   'vnc',
+  'x86_cpu_model_versions',
 ]
 
 tests_x86_64_system_thorough = [
tests/functional/test_vmstate.py new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.49.0
#6 lore raw

On Thu, May 22, 2025 at 03:37:55PM +0200, Thomas Huth wrote:

[...]

Quoted 22 lines
tests/functional/test_vmstate.py new file +22 -0
+    def test_vmstate(self):
+        target_machine = {
+            'aarch64': 'virt-7.2',
+            'm68k': 'virt-7.2',
+            'ppc64': 'pseries-7.2',
+            's390x': 's390-ccw-virtio-7.2',
+            'x86_64': 'pc-q35-7.2',
+        }
+        self.set_machine(target_machine[self.arch])
+
+        # Run QEMU to get the current vmstate json file:
+        dst_json = self.scratch_file('dest.json')
+        self.log.info('Dumping vmstate from ' + self.qemu_bin)
+        cp = subprocess.run([self.qemu_bin, '-nodefaults',
+                             '-M', target_machine[self.arch],
+                             '-dump-vmstate', dst_json],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT,
+                            text=True)
+        if cp.returncode != 0:
+            self.fail('Running QEMU failed:\n' + cp.stdout)
+        if cp.stdout:

tests/functional/test_vmstate.py line 53

Quoted 10 lines
tests/functional/test_vmstate.py new file +10 -0
+            self.log.info('QEMU output: ' + cp.stdout)
+
+        # Check whether the old vmstate json file is still compatible:
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  self.arch,
+                                  target_machine[self.arch] + '.json')
+        self.log.info('Comparing vmstate with ' + src_json)
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 0:
+            self.fail('Running vmstate-static-checker failed:\n' + cp.stdout)

Would false positives happen here? Would it fail "make check" and CI, even if the change was intended?

Quoted 9 lines
tests/functional/test_vmstate.py new file +6 -0
+        if cp.stdout:
+            self.log.warning('vmstate-static-checker output: ' + cp.stdout)
+
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
Signature · 1 line
2.49.0
Signature · 1 line
Peter Xu
#7 lore raw
Quoted 31 lines · Peter Xu

On Thu, May 22, 2025 at 03:37:55PM +0200, Thomas Huth wrote:

[...]

Quoted 27 lines
tests/functional/test_vmstate.py new file +27 -0
+    def test_vmstate(self):
+        target_machine = {
+            'aarch64': 'virt-7.2',
+            'm68k': 'virt-7.2',
+            'ppc64': 'pseries-7.2',
+            's390x': 's390-ccw-virtio-7.2',
+            'x86_64': 'pc-q35-7.2',
+        }
+        self.set_machine(target_machine[self.arch])
+
+        # Run QEMU to get the current vmstate json file:
+        dst_json = self.scratch_file('dest.json')
+        self.log.info('Dumping vmstate from ' + self.qemu_bin)
+        cp = subprocess.run([self.qemu_bin, '-nodefaults',
+                             '-M', target_machine[self.arch],
+                             '-dump-vmstate', dst_json],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT,
+                            text=True)
+        if cp.returncode != 0:
+            self.fail('Running QEMU failed:\n' + cp.stdout)
+        if cp.stdout:
+            self.log.info('QEMU output: ' + cp.stdout)
+
+        # Check whether the old vmstate json file is still compatible:
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  self.arch,
Quoted 8 lines

tests/functional/test_vmstate.py line 53

Quoted 5 lines
tests/functional/test_vmstate.py new file +5 -0
+                                  target_machine[self.arch] + '.json')
+        self.log.info('Comparing vmstate with ' + src_json)
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 0:
+            self.fail('Running vmstate-static-checker failed:\n' + cp.stdout)

Would false positives happen here? Would it fail "make check" and CI, even if the change was intended?

Yes. In that case, the quick fix is to remove the problematic piece from the 7.2 json files. Or we could try to improve the vmstate-static-checker script. At least we now notice it immediately, not only after a long delay until someone runs the script manually again.

But yes, this can be confusing for the who runs into this problem for the first time. I guess I should at least add some friendly words here with instructions what has to be done?

Thomas

Quoted 10 lines
Quoted 9 lines
tests/functional/test_vmstate.py new file +6 -0
+        if cp.stdout:
+            self.log.warning('vmstate-static-checker output: ' + cp.stdout)
+
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
Signature · 1 line
2.49.0
#8 lore raw
Quoted 41 lines · Thomas Huth
Quoted 31 lines · Peter Xu

On Thu, May 22, 2025 at 03:37:55PM +0200, Thomas Huth wrote:

[...]

Quoted 27 lines
tests/functional/test_vmstate.py new file +27 -0
+    def test_vmstate(self):
+        target_machine = {
+            'aarch64': 'virt-7.2',
+            'm68k': 'virt-7.2',
+            'ppc64': 'pseries-7.2',
+            's390x': 's390-ccw-virtio-7.2',
+            'x86_64': 'pc-q35-7.2',
+        }
+        self.set_machine(target_machine[self.arch])
+
+        # Run QEMU to get the current vmstate json file:
+        dst_json = self.scratch_file('dest.json')
+        self.log.info('Dumping vmstate from ' + self.qemu_bin)
+        cp = subprocess.run([self.qemu_bin, '-nodefaults',
+                             '-M', target_machine[self.arch],
+                             '-dump-vmstate', dst_json],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.STDOUT,
+                            text=True)
+        if cp.returncode != 0:
+            self.fail('Running QEMU failed:\n' + cp.stdout)
+        if cp.stdout:
+            self.log.info('QEMU output: ' + cp.stdout)
+
+        # Check whether the old vmstate json file is still compatible:
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  self.arch,
Quoted 8 lines

tests/functional/test_vmstate.py line 53

Quoted 5 lines
tests/functional/test_vmstate.py new file +5 -0
+                                  target_machine[self.arch] + '.json')
+        self.log.info('Comparing vmstate with ' + src_json)
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 0:
+            self.fail('Running vmstate-static-checker failed:\n' + cp.stdout)

Would false positives happen here? Would it fail "make check" and CI, even if the change was intended?

Quoted 4 lines

Yes. In that case, the quick fix is to remove the problematic piece from the 7.2 json files. Or we could try to improve the vmstate-static-checker script. At least we now notice it immediately, not only after a long delay until someone runs the script manually again.

Yes, the thing is I worry it'll almost always be false positives (from statistical POV.. unfortunately). Then in that case it's actually better to be found later because otherwise it means we're adding overhead to every developer who might cause the false positive and each of them doing this work with no real gain.. :(

Quoted 4 lines

But yes, this can be confusing for the who runs into this problem for the first time. I guess I should at least add some friendly words here with instructions what has to be done?

Some instructions would be helpful for sure. Though do we have easy way to whitelist any false positives? As this test compares the dumps so there's no diff to fix or work around.

Signature · 1 line
Peter Xu
#9 lore raw

PATCH v2 4/4 tests/functional/test_vmstate: Test whether the checker script works as expected

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

We've got two vmstate dump files in the repository which are meant for verifying whether the vmstate-static-checker.py works as expected. Since running this manually is a cumbersome job, let's add an automated test for this instead that runs the script with the two dump files and checks for the expected output.

---
 tests/functional/test_vmstate.py | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
tests/functional/test_vmstate.py +37 -0
index cc988987481..19a62e8a17e 100755
@@ -9,6 +9,22 @@
 from qemu_test import QemuSystemTest
 
 
+expected_output='''Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
+Section "fw_cfg" does not exist in dest
+Section "fusbh200-ehci-usb" version error: 2 > 1
+Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
+Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
+Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
+Section "cfi.pflash01": Entry "Description" missing
+Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
+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 "sun-fdtwo" Description "fdc": version error: 2 > 1
+Section "sun-fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
+Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
+'''
+
 class VmStateTest(QemuSystemTest):
 
     def run_vmstate_checker(self, src_json, dst_json):
@@ -19,6 +35,27 @@ def run_vmstate_checker(self, src_json, dst_json):
                               stderr=subprocess.STDOUT,
                               text=True)
 
+    def test_checker(self):
+        """
+        Test whether the checker script correctly detects the changes
+        between dump1.json and dump2.json.
+        """
+        if self.arch != 'x86_64':
+            self.skipTest('for x86 only')
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump1.json')
+        dst_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump2.json')
+        self.log.info(f'Comparing {src_json} with {dst_json}')
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 13:
+            self.fail('Unexpected return code of vmstate-static-checker: ' +
+                      cp.returncode)
+        if cp.stdout != expected_output:
+            self.log.info('vmstate-static-checker output:\n' + cp.stdout)
+            self.log.info('expected output:\n' + expected_output)
+            self.fail('Unexpected vmstate-static-checker output!')
+
     def test_vmstate(self):
         target_machine = {
             'aarch64': 'virt-7.2',
Signature · 1 line
2.49.0
#10 lore raw

Re: [PATCH v2 4/4] tests/functional/test_vmstate: Test whether the checker script works as expected

Quoted 55 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We've got two vmstate dump files in the repository which are meant for verifying whether the vmstate-static-checker.py works as expected. Since running this manually is a cumbersome job, let's add an automated test for this instead that runs the script with the two dump files and checks for the expected output.

---
 tests/functional/test_vmstate.py | 37 ++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
tests/functional/test_vmstate.py +27 -0
index cc988987481..19a62e8a17e 100755
@@ -9,6 +9,22 @@
 from qemu_test import QemuSystemTest
 
 
+expected_output='''Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
+Section "fw_cfg" does not exist in dest
+Section "fusbh200-ehci-usb" version error: 2 > 1
+Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
+Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
+Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
+Section "cfi.pflash01": Entry "Description" missing
+Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
+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 "sun-fdtwo" Description "fdc": version error: 2 > 1
+Section "sun-fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
+Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
+'''
+
 class VmStateTest(QemuSystemTest):
 
     def run_vmstate_checker(self, src_json, dst_json):
@@ -19,6 +35,27 @@ def run_vmstate_checker(self, src_json, dst_json):
                               stderr=subprocess.STDOUT,
                               text=True)
 
+    def test_checker(self):
+        """
+        Test whether the checker script correctly detects the changes
+        between dump1.json and dump2.json.
+        """
+        if self.arch != 'x86_64':
+            self.skipTest('for x86 only')
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump1.json')
+        dst_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump2.json')

tests/functional/test_vmstate.py def run_vmstate_checker(self, src_json, dst_json): · line 58

Quoted 10 lines
tests/functional/test_vmstate.py +10 -0
+        self.log.info(f'Comparing {src_json} with {dst_json}')
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 13:
+            self.fail('Unexpected return code of vmstate-static-checker: ' +
+                      cp.returncode)
+        if cp.stdout != expected_output:
+            self.log.info('vmstate-static-checker output:\n' + cp.stdout)
+            self.log.info('expected output:\n' + expected_output)
+            self.fail('Unexpected vmstate-static-checker output!')
+

Would this run for every make check and every CI run?

Since the script almost never change, I wonder whether this test should be triggered only if manually. But maybe I totally missed how the functional framework works..

Quoted 6 lines
tests/functional/test_vmstate.py +0 -0
     def test_vmstate(self):
         target_machine = {
             'aarch64': 'virt-7.2',
Signature · 1 line
2.49.0
Signature · 1 line
Peter Xu
#11 lore raw

Re: [PATCH v2 4/4] tests/functional/test_vmstate: Test whether the checker script works as expected

Quoted 60 lines · Peter Xu
Quoted 59 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We've got two vmstate dump files in the repository which are meant for verifying whether the vmstate-static-checker.py works as expected. Since running this manually is a cumbersome job, let's add an automated test for this instead that runs the script with the two dump files and checks for the expected output.

---
  tests/functional/test_vmstate.py | 37 ++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
tests/functional/test_vmstate.py +31 -0
index cc988987481..19a62e8a17e 100755
@@ -9,6 +9,22 @@
  from qemu_test import QemuSystemTest
 
 
+expected_output='''Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
+Section "fw_cfg" does not exist in dest
+Section "fusbh200-ehci-usb" version error: 2 > 1
+Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
+Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
+Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
+Section "cfi.pflash01": Entry "Description" missing
+Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
+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 "sun-fdtwo" Description "fdc": version error: 2 > 1
+Section "sun-fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
+Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
+'''
+
  class VmStateTest(QemuSystemTest):
 
      def run_vmstate_checker(self, src_json, dst_json):
@@ -19,6 +35,27 @@ def run_vmstate_checker(self, src_json, dst_json):
                                stderr=subprocess.STDOUT,
                                text=True)
 
+    def test_checker(self):
+        """
+        Test whether the checker script correctly detects the changes
+        between dump1.json and dump2.json.
+        """
+        if self.arch != 'x86_64':
+            self.skipTest('for x86 only')
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump1.json')
+        dst_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump2.json')
+        self.log.info(f'Comparing {src_json} with {dst_json}')
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 13:
+            self.fail('Unexpected return code of vmstate-static-checker: ' +
Quoted 8 lines

tests/functional/test_vmstate.py def run_vmstate_checker(self, src_json, dst_json): · line 58

Quoted 6 lines
tests/functional/test_vmstate.py +6 -0
+                      cp.returncode)
+        if cp.stdout != expected_output:
+            self.log.info('vmstate-static-checker output:\n' + cp.stdout)
+            self.log.info('expected output:\n' + expected_output)
+            self.fail('Unexpected vmstate-static-checker output!')
+

Would this run for every make check and every CI run?

Yes.

Quoted 2 lines

Since the script almost never change, I wonder whether this test should be triggered only if manually.

We could disable it by default with a @skip... decorator, but I think it's not really worth the effort: The runtime of test_checker() is about 100 ms, that's really nothing compared to the hunders of seconds that some other tests take.

Thomas

#12 lore raw

Re: [PATCH v2 4/4] tests/functional/test_vmstate: Test whether the checker script works as expected

Quoted 68 lines · Thomas Huth
Quoted 56 lines · Peter Xu
Quoted 55 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We've got two vmstate dump files in the repository which are meant for verifying whether the vmstate-static-checker.py works as expected. Since running this manually is a cumbersome job, let's add an automated test for this instead that runs the script with the two dump files and checks for the expected output.

---
  tests/functional/test_vmstate.py | 37 ++++++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
tests/functional/test_vmstate.py +31 -0
index cc988987481..19a62e8a17e 100755
@@ -9,6 +9,22 @@
  from qemu_test import QemuSystemTest
+expected_output='''Warning: checking incompatible machine types: "pc-i440fx-2.1", "pc-i440fx-2.2"
+Section "fw_cfg" does not exist in dest
+Section "fusbh200-ehci-usb" version error: 2 > 1
+Section "fusbh200-ehci-usb", Description "ehci-core": expected field "usbsts", got "usbsts_pending"; skipping rest
+Section "pci-serial-4x" Description "pci-serial-multi": Entry "Fields" missing
+Section "intel-hda-generic", Description "intel-hda", Field "pci": missing description
+Section "cfi.pflash01": Entry "Description" missing
+Section "megasas", Description "PCIDevice": expected field "irq_state", while dest has no further fields
+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 "sun-fdtwo" Description "fdc": version error: 2 > 1
+Section "sun-fdtwo", Description "fdrive": Subsection "fdrive/media_rate" not found
+Section "usb-kbd" Description "usb-kbd" Field "kbd.keycodes" size mismatch: 4 , 2
+'''
+
  class VmStateTest(QemuSystemTest):
      def run_vmstate_checker(self, src_json, dst_json):
@@ -19,6 +35,27 @@ def run_vmstate_checker(self, src_json, dst_json):
                                stderr=subprocess.STDOUT,
                                text=True)
+    def test_checker(self):
+        """
+        Test whether the checker script correctly detects the changes
+        between dump1.json and dump2.json.
+        """
+        if self.arch != 'x86_64':
+            self.skipTest('for x86 only')
+        src_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump1.json')
+        dst_json = self.data_file('..', 'data', 'vmstate-static-checker',
+                                  'dump2.json')
+        self.log.info(f'Comparing {src_json} with {dst_json}')
+        cp = self.run_vmstate_checker(src_json, dst_json)
+        if cp.returncode != 13:
+            self.fail('Unexpected return code of vmstate-static-checker: ' +
Quoted 8 lines

tests/functional/test_vmstate.py def run_vmstate_checker(self, src_json, dst_json): · line 58

Quoted 6 lines
tests/functional/test_vmstate.py +6 -0
+                      cp.returncode)
+        if cp.stdout != expected_output:
+            self.log.info('vmstate-static-checker output:\n' + cp.stdout)
+            self.log.info('expected output:\n' + expected_output)
+            self.fail('Unexpected vmstate-static-checker output!')
+

Would this run for every make check and every CI run?

Yes.

Quoted 7 lines
Quoted 2 lines

Since the script almost never change, I wonder whether this test should be triggered only if manually.

We could disable it by default with a @skip... decorator, but I think it's not really worth the effort: The runtime of test_checker() is about 100 ms, that's really nothing compared to the hunders of seconds that some other tests take.

Right, not a concern of time used but only CPU burns.

Meanwhile, this is not part of the QEMU function that the repo delivers, but the infra to test QEMU, hence here we're always running this check script for everyone testing yet another almost not-changing (and may not be helpful, not anymore?) script to test QEMU..

I think we should save the cycles, but no strong opinions.

Thanks,

Signature · 1 line
Peter Xu