This is an RFC series.  It is based on Fabiano's migration-staging branch.
I've pushed this tree here for easier reference:

https://gitlab.com/peterx/qemu/-/tree/vmstate-array-null

This series implements a new vmstate flag that allows real dynamic array of
pointers to be migrated, so that QEMU vmstate core will be able to identify
NULL and non-NULL pointers pointing to any kind of VMSD (or base types),
then properly allocate memory for them on dest QEMU.

The first planned user of such is Alexander's NVMe migration series here:

https://lore.kernel.org/r/[email protected]

This is another alternative to solve this problem.

Note that I haven't had time to test anything more than the qtests/unit
tests provided.  Neither did I tested analyze-migration script, likely
that'll need some touch up when we plan to do this.  However I'm sending
this out first so to collect some early comments.

Alexander: sorry I renamed the flag once more because I just found it not
proper to call it _ALLOW_NULL if we already have that existing NULL use
case.. So I changed it to _AUTO_ALLOC.  I hope this series will also work
for your NVMe series, note that I removed two macros you introduced there
since you didn't use them (and we'd better not introduce unsed macros).  I
kept the two that your series used.

Thanks,

Alexander Mikhalitsyn (1):
  tests/unit/test-vmstate: add tests for VMS_ARRAY_OF_POINTER_ALLOW_NULL

Peter Xu (9):
  vmstate: Pass in struct itself for VMSTATE_ARRAY_OF_POINTER
  vmstate: Pass in struct itself for VMSTATE_VARRAY_OF_POINTER_UINT32
  vmstate: Do not set size for VMS_ARRAY_OF_POINTER
  vmstate: Limit the vmdesc_loop dedup trick to compressable field
  vmstate: Rename VMS_NULLPTR_MARKER to VMS_MARKER_PTR_NULL
  vmstate: Introduce vmstate_save_field_with_vmdesc()
  vmstate: Allow vmstate_info_nullptr to emit non-NULL markers
  vmstate: Implement load of ptr marker in vmstate core
  vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC

 include/hw/intc/riscv_aclint.h |   6 +-
 include/migration/vmstate.h    |  86 +++++++++++--
 migration/savevm.c             |  32 +++++
 migration/vmstate-types.c      |  36 +++---
 migration/vmstate.c            | 218 +++++++++++++++++++++++++--------
 tests/unit/test-vmstate.c      |  90 +++++++++++++-
 6 files changed, 380 insertions(+), 88 deletions(-)

-- 
2.50.1


Reply via email to