[PATCH v2 0/8] migration: Remove extra type-checking from vmstate macros

Fabiano Rosas posted 8 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260818182441.404790-1-farosas@suse.de
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
hw/pci/msix.c                      |   6 +-
hw/scsi/scsi-bus.c                 |   6 +-
include/migration/vmstate.h        | 388 +++++++++++++----------------
migration/savevm.c                 |  29 ++-
migration/vmstate.c                | 103 +++++---
rust/bindings/migration-sys/lib.rs |  17 +-
rust/migration/src/vmstate.rs      |  32 ++-
rust/tests/tests/vmstate_tests.rs  |  32 +--
8 files changed, 331 insertions(+), 282 deletions(-)
[PATCH v2 0/8] migration: Remove extra type-checking from vmstate macros
Posted by Fabiano Rosas 1 month, 1 week ago
Changes in v2:

- Removed more unused vmstate macros
- Fixed the type check macro
- Renamed the new structure to something more explicit
- Added a new flag to indicate an empty vmstate
- Added the overflow and overallocation checks

CI run: https://gitlab.com/farosas/qemu/-/pipelines/2769617319
Also tested:
- migration-test --full --thorough
- x86_64 compat run forward and backwards for previous 3 QEMU releases
- s390x compat run forward and backwards for previous 2 QEMU releases
- ppc64 compat run forward and backwards for previous QEMU release
- migration-test smoke ASAN/UBSAN run

v1:
https://lore.kernel.org/r/20260729225227.1170574-1-farosas@suse.de

Hi, this is basically what I ranted about in:
https://lore.kernel.org/r/87jyqeomqz.fsf@suse.de

I'm replacing the per-integer-size type checks with a single "int that
fits in 32bit" check. This allows several lines of duplicated code to
be removed.

I haven't changed the macro names in the device code yet. If this
series gets positive feedback then I'll send per-subsystem patches
doing that.

CI run: https://gitlab.com/farosas/qemu/-/pipelines/2716814081
Also tested:
- migration-test --full --thorough
- x86_64 compat run forwards and backwards for previous 3 QEMU releases
- s390x compat run forwards and backwards for previous 2 QEMU releases
- ppc64 compat run forwards and backwards for previous QEMU release
- migration-test smoke ASAN/UBSAN run

Fabiano Rosas (8):
  migration: Remove unused vmstate macros
  migration: Introduce VMStateStructMember
  migration: Remove redundant flags
  migration: Remove duplicate vmstate macros
  migration: Add VMS_NO_STATE flag
  migration: Check more vmstate flags
  migration: Harden vmstate_handle_alloc
  migration: Harden vmstate_size

 hw/pci/msix.c                      |   6 +-
 hw/scsi/scsi-bus.c                 |   6 +-
 include/migration/vmstate.h        | 388 +++++++++++++----------------
 migration/savevm.c                 |  29 ++-
 migration/vmstate.c                | 103 +++++---
 rust/bindings/migration-sys/lib.rs |  17 +-
 rust/migration/src/vmstate.rs      |  32 ++-
 rust/tests/tests/vmstate_tests.rs  |  32 +--
 8 files changed, 331 insertions(+), 282 deletions(-)

-- 
2.53.0
Re: [PATCH v2 0/8] migration: Remove extra type-checking from vmstate macros
Posted by Peter Xu 1 month, 1 week ago
On Tue, Aug 18, 2026 at 03:24:33PM -0300, Fabiano Rosas wrote:
> Changes in v2:
> 
> - Removed more unused vmstate macros
> - Fixed the type check macro
> - Renamed the new structure to something more explicit
> - Added a new flag to indicate an empty vmstate
> - Added the overflow and overallocation checks
> 
> CI run: https://gitlab.com/farosas/qemu/-/pipelines/2769617319
> Also tested:
> - migration-test --full --thorough
> - x86_64 compat run forward and backwards for previous 3 QEMU releases
> - s390x compat run forward and backwards for previous 2 QEMU releases
> - ppc64 compat run forward and backwards for previous QEMU release
> - migration-test smoke ASAN/UBSAN run
> 
> v1:
> https://lore.kernel.org/r/20260729225227.1170574-1-farosas@suse.de
> 
> Hi, this is basically what I ranted about in:
> https://lore.kernel.org/r/87jyqeomqz.fsf@suse.de
> 
> I'm replacing the per-integer-size type checks with a single "int that
> fits in 32bit" check. This allows several lines of duplicated code to
> be removed.
> 
> I haven't changed the macro names in the device code yet. If this
> series gets positive feedback then I'll send per-subsystem patches
> doing that.
> 
> CI run: https://gitlab.com/farosas/qemu/-/pipelines/2716814081
> Also tested:
> - migration-test --full --thorough
> - x86_64 compat run forwards and backwards for previous 3 QEMU releases
> - s390x compat run forwards and backwards for previous 2 QEMU releases
> - ppc64 compat run forwards and backwards for previous QEMU release
> - migration-test smoke ASAN/UBSAN run
> 
> Fabiano Rosas (8):
>   migration: Remove unused vmstate macros
>   migration: Introduce VMStateStructMember
>   migration: Remove redundant flags
>   migration: Remove duplicate vmstate macros
>   migration: Add VMS_NO_STATE flag
>   migration: Check more vmstate flags
>   migration: Harden vmstate_handle_alloc
>   migration: Harden vmstate_size
> 
>  hw/pci/msix.c                      |   6 +-
>  hw/scsi/scsi-bus.c                 |   6 +-
>  include/migration/vmstate.h        | 388 +++++++++++++----------------
>  migration/savevm.c                 |  29 ++-
>  migration/vmstate.c                | 103 +++++---
>  rust/bindings/migration-sys/lib.rs |  17 +-
>  rust/migration/src/vmstate.rs      |  32 ++-
>  rust/tests/tests/vmstate_tests.rs  |  32 +--
>  8 files changed, 331 insertions(+), 282 deletions(-)

For anything that is non-Rust:

Acked-by: Peter Xu <peterx@redhat.com>

One typo I'll comment inline, can be touched up when you queue.

-- 
Peter Xu