[PATCH for-12.0 v2 0/9] migration: Remove VMSTATE_VALIDATE() and VMS_MUST_EXIST

Peter Xu posted 9 patches 1 day, 2 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261126231631.3392756-1-peterx@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
include/migration/vmstate.h       |  11 ---
hw/gpio/zaurus.c                  |  24 +++--
hw/pci/pcie_aer.c                 |  40 +++++++--
hw/timer/hpet.c                   |  18 ++--
migration/savevm.c                |   5 --
migration/vmstate.c               |  12 ---
target/arm/machine.c              | 142 ++++++++++++++----------------
rust/hw/timer/hpet/src/device.rs  |  45 +++++-----
rust/migration/src/prelude.rs     |   1 -
rust/migration/src/vmstate.rs     |  33 +++----
rust/tests/tests/vmstate_tests.rs |  72 +++++----------
11 files changed, 181 insertions(+), 222 deletions(-)
[PATCH for-12.0 v2 0/9] migration: Remove VMSTATE_VALIDATE() and VMS_MUST_EXIST
Posted by Peter Xu 1 day, 2 hours ago
CI: https://gitlab.com/peterx/qemu/-/pipelines/3120617486

v2:
- Patch "hw/gpio/zaurus: Move VMSTATE_VALIDATE() check into
  post_load_errp()":
  - Unwrap vmstate_scoop_validate() [PeterM]
- Patch "rust: Replace vmstate_validate with post_load"
  - Replaced by three patches from Zhao's v1 at the beginning as dependency
    https://lore.kernel.org/r/20261124095814.437738-1-zhao1.liu@intel.com
- Patch "arm/machine: Move all VMSTATE_VALIDATE() usages into post_load"
  - Move all checks into the cpu_post_load() [PeterM]
  - Added one more dependency patch to make cpu_post_load() take errp
- Patch "hpet: Move VMSTATE_VALIDATE() check into post_load"
  - NOTE: I didn't touch this patch, assuming what we check doesn't really
    matter.. I kept it to make it still aligned with Rust change.

This is for QEMU 12.0 material only.

===8<===

Peter Maydell reported an unwanted assertion on source QEMU due to a failed
check in VMSTATE_VALIDATE():

https://lore.kernel.org/r/20261119165546.3050013-1-peter.maydell@linaro.org

I decided to look at this in a slightly broader range, because I always
thought hijacking field_exists() is very error prone and hard to follow,
and VMSTATE_VALIDATE() is the only user of it (VMS_MUST_EXIST).  Meanwhile
it is the only VMSTATE_*() macro that does not carry a real entity of data
stream, so it's not really a FIELD, but some checker we added adhoc inline
into the VMSD fields.  It might be confusing to anyone new reading VMSD
code, including myself when reading it first time.

Instead of updating the source behavior, let's directly wipe that code out.
I think it's not making a lot of sense doing device state check in save(),
because those sanity check should be done in emulation code, not after
seding all RAM, which is extremely awkward.  post_load() OTOH still makes
some sense to sanity check fields, so I moved all VALIDATE there.

Any comment welcomed, thanks.

Peter Xu (6):
  pcie/aer: Remove the usage of VMSTATE_VALIDATE()
  hw/gpio/zaurus: Move VMSTATE_VALIDATE() check into post_load_errp()
  hpet: Move VMSTATE_VALIDATE() check into post_load
  arm/machine: Convert cpu_post_load() to take Error**
  arm/machine: Move all VMSTATE_VALIDATE() usages into post_load
  migration: Drop VMSTATE_VALIDATE() and VMS_MUST_EXIST

Zhao Liu (3):
  rust/migration: Allow usize as the length of a varray
  rust/hpet: Move vmstate_validate!() check into post_load
  rust/migration: Remove vmstate_validate!() macro and test

 include/migration/vmstate.h       |  11 ---
 hw/gpio/zaurus.c                  |  24 +++--
 hw/pci/pcie_aer.c                 |  40 +++++++--
 hw/timer/hpet.c                   |  18 ++--
 migration/savevm.c                |   5 --
 migration/vmstate.c               |  12 ---
 target/arm/machine.c              | 142 ++++++++++++++----------------
 rust/hw/timer/hpet/src/device.rs  |  45 +++++-----
 rust/migration/src/prelude.rs     |   1 -
 rust/migration/src/vmstate.rs     |  33 +++----
 rust/tests/tests/vmstate_tests.rs |  72 +++++----------
 11 files changed, 181 insertions(+), 222 deletions(-)

-- 
2.56.0