[RFC PATCH v1 00/17] migration: vmstate_save|load changes for peterx

Fabiano Rosas posted 17 patches 1 week, 2 days ago
Failed in applying to current master (apply log)
include/migration/vmstate.h |  21 +-
migration/savevm.c          |  28 +--
migration/vmstate.c         | 451 ++++++++++++++++++------------------
3 files changed, 245 insertions(+), 255 deletions(-)
[RFC PATCH v1 00/17] migration: vmstate_save|load changes for peterx
Posted by Fabiano Rosas 1 week, 2 days ago
Too much stuff to mention inline on the series, here's some patches on
top. Let me know what you think! Feel free to drop it all or
incorporate or whatever.

Based-on: [PATCH RFC 00/10] vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC
20260317232332.15209-1-peterx@redhat.com
https://lore.kernel.org/r/20260317232332.15209-1-peterx@redhat.com

which is in turn based on https://gitlab.com/farosas/qemu/-/commits/migration-staging

I pushed it all to https://gitlab.com/farosas/qemu/-/commits/migration-rfc-auto-alloc

CI run: https://gitlab.com/farosas/qemu/-/pipelines/2406278684

Fabiano Rosas (17):
  vmstate: fixup the use of AUTO_ALLOC flag
  vmstate: Remove vmstate_use_marker_field
  vmstate: Stop checking size for nullptr compression
  vmstate: Set error inside of vmstate_save_field_with_vmdesc
  vmstate: Remove vmdesc_loop
  vmstate: Put array of pointers code together
  vmstate: Create and save ptr marker in same function
  vmstate: Don't recompute size and n_elems in vmstate_size
  vmstate: Increase scope of vmstate_handle_alloc
  vmstate: Remove curr_elem_p
  vmstate: Introduce vmstate_first
  vmstate: Introduce vmstate_next
  vmstate: Drop VMS_ARRAY_OF_POINTER_AUTO_ALLOC
  vmstate: Move VMS_MUST_EXIST check
  vmstate: Invert exists check
  vmstate: Declare variables at the top
  vmstate: Reduce indentation levels

 include/migration/vmstate.h |  21 +-
 migration/savevm.c          |  28 +--
 migration/vmstate.c         | 451 ++++++++++++++++++------------------
 3 files changed, 245 insertions(+), 255 deletions(-)

-- 
2.51.0
Re: [RFC PATCH v1 00/17] migration: vmstate_save|load changes for peterx
Posted by Peter Xu 1 week, 1 day ago
On Tue, Mar 24, 2026 at 04:43:15PM -0300, Fabiano Rosas wrote:
> Too much stuff to mention inline on the series, here's some patches on
> top. Let me know what you think! Feel free to drop it all or
> incorporate or whatever.
> 
> Based-on: [PATCH RFC 00/10] vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC
> 20260317232332.15209-1-peterx@redhat.com
> https://lore.kernel.org/r/20260317232332.15209-1-peterx@redhat.com
> 
> which is in turn based on https://gitlab.com/farosas/qemu/-/commits/migration-staging
> 
> I pushed it all to https://gitlab.com/farosas/qemu/-/commits/migration-rfc-auto-alloc
> 
> CI run: https://gitlab.com/farosas/qemu/-/pipelines/2406278684
> 
> Fabiano Rosas (17):
>   vmstate: fixup the use of AUTO_ALLOC flag
>   vmstate: Remove vmstate_use_marker_field
>   vmstate: Stop checking size for nullptr compression
>   vmstate: Set error inside of vmstate_save_field_with_vmdesc
>   vmstate: Remove vmdesc_loop
>   vmstate: Put array of pointers code together
>   vmstate: Create and save ptr marker in same function
>   vmstate: Don't recompute size and n_elems in vmstate_size
>   vmstate: Increase scope of vmstate_handle_alloc
>   vmstate: Remove curr_elem_p
>   vmstate: Introduce vmstate_first
>   vmstate: Introduce vmstate_next
>   vmstate: Drop VMS_ARRAY_OF_POINTER_AUTO_ALLOC
>   vmstate: Move VMS_MUST_EXIST check
>   vmstate: Invert exists check
>   vmstate: Declare variables at the top
>   vmstate: Reduce indentation levels

Considering that this prior series may block the nvme series, I'll be
slightly conservative on what to collect, but I'll collect as much as I can
that makes me still feel confident when I repost; we'll see.

Thanks for this work, Fabiano.

-- 
Peter Xu
Re: [RFC PATCH v1 00/17] migration: vmstate_save|load changes for peterx
Posted by Fabiano Rosas 1 week, 1 day ago
Peter Xu <peterx@redhat.com> writes:

> On Tue, Mar 24, 2026 at 04:43:15PM -0300, Fabiano Rosas wrote:
>> Too much stuff to mention inline on the series, here's some patches on
>> top. Let me know what you think! Feel free to drop it all or
>> incorporate or whatever.
>> 
>> Based-on: [PATCH RFC 00/10] vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC
>> 20260317232332.15209-1-peterx@redhat.com
>> https://lore.kernel.org/r/20260317232332.15209-1-peterx@redhat.com
>> 
>> which is in turn based on https://gitlab.com/farosas/qemu/-/commits/migration-staging
>> 
>> I pushed it all to https://gitlab.com/farosas/qemu/-/commits/migration-rfc-auto-alloc
>> 
>> CI run: https://gitlab.com/farosas/qemu/-/pipelines/2406278684
>> 
>> Fabiano Rosas (17):
>>   vmstate: fixup the use of AUTO_ALLOC flag
>>   vmstate: Remove vmstate_use_marker_field
>>   vmstate: Stop checking size for nullptr compression
>>   vmstate: Set error inside of vmstate_save_field_with_vmdesc
>>   vmstate: Remove vmdesc_loop
>>   vmstate: Put array of pointers code together
>>   vmstate: Create and save ptr marker in same function
>>   vmstate: Don't recompute size and n_elems in vmstate_size
>>   vmstate: Increase scope of vmstate_handle_alloc
>>   vmstate: Remove curr_elem_p
>>   vmstate: Introduce vmstate_first
>>   vmstate: Introduce vmstate_next
>>   vmstate: Drop VMS_ARRAY_OF_POINTER_AUTO_ALLOC
>>   vmstate: Move VMS_MUST_EXIST check
>>   vmstate: Invert exists check
>>   vmstate: Declare variables at the top
>>   vmstate: Reduce indentation levels
>
> Considering that this prior series may block the nvme series, I'll be
> slightly conservative on what to collect, but I'll collect as much as I can
> that makes me still feel confident when I repost; we'll see.
>

Sure, if there's anything you still find valuable but won't take for the
repost let me know and I can send a separate series on top if that's the
case.
Re: [RFC PATCH v1 00/17] migration: vmstate_save|load changes for peterx
Posted by Peter Xu 1 week ago
On Wed, Mar 25, 2026 at 05:10:51PM -0300, Fabiano Rosas wrote:
> Sure, if there's anything you still find valuable but won't take for the
> repost let me know and I can send a separate series on top if that's the
> case.

I found that there're quite a few cleanups at latter patches, and it caused
some rebase pain if the base series still need frequent update.

So even if they look good in general to me, I want to leave them for later,
reducing scope of dependency.  After the API conslidated, we can do
cleanups on top.

Let me mention what I did and plan to post later:

> >>   vmstate: fixup the use of AUTO_ALLOC flag
> >>   vmstate: Remove vmstate_use_marker_field

I squashed these two.

> >>   vmstate: Stop checking size for nullptr compression

Picked.

> >>   vmstate: Set error inside of vmstate_save_field_with_vmdesc

Squashed.

> >>   vmstate: Remove vmdesc_loop

Starting from this one, I feel a bit uncertain, and maybe we can leave it
for later.

> >>   vmstate: Put array of pointers code together

This is a major cleanup, I left it and a few ones later aside for now.

> >>   vmstate: Create and save ptr marker in same function
> >>   vmstate: Don't recompute size and n_elems in vmstate_size
> >>   vmstate: Increase scope of vmstate_handle_alloc
> >>   vmstate: Remove curr_elem_p

I agree this is good, and..

> >>   vmstate: Introduce vmstate_first
> >>   vmstate: Introduce vmstate_next

.. despite that I feel like the current vmstate_next() impl might be
problematic (see my other reply), I also like this idea of having a _next
helper to hide some details on the ptr markers.  I'll adopt that idea,
thanks.

> >>   vmstate: Drop VMS_ARRAY_OF_POINTER_AUTO_ALLOC

Until I get corrected I think we'll need this flag, as said.  I feel like
it's better to keep VMS_ALLOC semantics as before (when set, it must alloc
the top field object ignoring stream data), then this one for the array
elements separate (meanwhile, this one is "optionally done", based on the
stream data).

We have plenty of space for VMS_* flags and it's not ABI.  IMHO when we're
not certain to merge flags we can always keep them separate until later too.

> >>   vmstate: Move VMS_MUST_EXIST check
> >>   vmstate: Invert exists check
> >>   vmstate: Declare variables at the top
> >>   vmstate: Reduce indentation levels

All these seem to be cleanups.  I plan to leave them separately.

I think it might be good I send another version directly, I'll do it very
soon and keep it RFC.  If I missed something while reading this series,
please then let me know.

-- 
Peter Xu