mbox series

[v3,0/6] migration: check required entries and sections are loaded

Message ID 20231106113601.2052601-1-marcandre.lureau@redhat.com (mailing list archive)
Headers show
Series migration: check required entries and sections are loaded | expand

Message

Marc-André Lureau Nov. 6, 2023, 11:35 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

Surprisingly, the migration code doesn't check that required migration entries
and subsections are loaded. Either optional or required sections are both
ignored when missing. According to the documentation a "newer QEMU that knows
about a subsection can (with care) load a stream from an older QEMU that didn't
send the subsection". I propose this behaviour to be limited to "optional"
sections only.

This series has a few preliminary fixes, add new checks that entries are
loaded once and required ones have been loaded, add some tests and
documentation update.

thanks

v3:
 - rebased, drop RFC status
 - switch from tracepoint + returning an error to report for missing
   subsections, as we worry about potential regressions
 - add r-b tags

v2:
 - add "migration: rename vmstate_save_needed->vmstate_section_needed"
 - add "migration: set file error on subsection loading"
 - add subsection tests
 - update the documentation

Marc-André Lureau (6):
  block/fdc: 'phase' is not needed on load
  virtio: make endian_needed() work during loading
  migration: check required subsections are loaded, once
  migration: check required entries are loaded, once
  test-vmstate: add some subsection tests
  docs/migration: reflect the changes about needed subsections

 docs/devel/migration.rst  |  17 +++---
 hw/block/fdc.c            |   5 ++
 hw/virtio/virtio.c        |   6 +-
 migration/savevm.c        |  43 ++++++++++++++
 migration/vmstate.c       |  40 ++++++++++++-
 tests/unit/test-vmstate.c | 116 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 215 insertions(+), 12 deletions(-)

Comments

Michael S. Tsirkin Nov. 6, 2023, 5:44 p.m. UTC | #1
On Mon, Nov 06, 2023 at 03:35:54PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Hi,
> 
> Surprisingly, the migration code doesn't check that required migration entries
> and subsections are loaded. Either optional or required sections are both
> ignored when missing. According to the documentation a "newer QEMU that knows
> about a subsection can (with care) load a stream from an older QEMU that didn't
> send the subsection". I propose this behaviour to be limited to "optional"
> sections only.
> 
> This series has a few preliminary fixes, add new checks that entries are
> loaded once and required ones have been loaded, add some tests and
> documentation update.
> 
> thanks

I think this kind of thing is better deferred to the next release -
unless you have something specific in mind this fixes?

> v3:
>  - rebased, drop RFC status
>  - switch from tracepoint + returning an error to report for missing
>    subsections, as we worry about potential regressions
>  - add r-b tags
> 
> v2:
>  - add "migration: rename vmstate_save_needed->vmstate_section_needed"
>  - add "migration: set file error on subsection loading"
>  - add subsection tests
>  - update the documentation
> 
> Marc-André Lureau (6):
>   block/fdc: 'phase' is not needed on load
>   virtio: make endian_needed() work during loading
>   migration: check required subsections are loaded, once
>   migration: check required entries are loaded, once
>   test-vmstate: add some subsection tests
>   docs/migration: reflect the changes about needed subsections
> 
>  docs/devel/migration.rst  |  17 +++---
>  hw/block/fdc.c            |   5 ++
>  hw/virtio/virtio.c        |   6 +-
>  migration/savevm.c        |  43 ++++++++++++++
>  migration/vmstate.c       |  40 ++++++++++++-
>  tests/unit/test-vmstate.c | 116 ++++++++++++++++++++++++++++++++++++++
>  6 files changed, 215 insertions(+), 12 deletions(-)
> 
> -- 
> 2.41.0
Juan Quintela Nov. 7, 2023, 12:03 p.m. UTC | #2
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Mon, Nov 06, 2023 at 03:35:54PM +0400, marcandre.lureau@redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>> 
>> Hi,
>> 
>> Surprisingly, the migration code doesn't check that required migration entries
>> and subsections are loaded. Either optional or required sections are both
>> ignored when missing. According to the documentation a "newer QEMU that knows
>> about a subsection can (with care) load a stream from an older QEMU that didn't
>> send the subsection". I propose this behaviour to be limited to "optional"
>> sections only.
>> 
>> This series has a few preliminary fixes, add new checks that entries are
>> loaded once and required ones have been loaded, add some tests and
>> documentation update.
>> 
>> thanks
>
> I think this kind of thing is better deferred to the next release -
> unless you have something specific in mind this fixes?

I agree with you.

Later, Juan.

>> v3:
>>  - rebased, drop RFC status
>>  - switch from tracepoint + returning an error to report for missing
>>    subsections, as we worry about potential regressions
>>  - add r-b tags
>> 
>> v2:
>>  - add "migration: rename vmstate_save_needed->vmstate_section_needed"
>>  - add "migration: set file error on subsection loading"
>>  - add subsection tests
>>  - update the documentation
>> 
>> Marc-André Lureau (6):
>>   block/fdc: 'phase' is not needed on load
>>   virtio: make endian_needed() work during loading
>>   migration: check required subsections are loaded, once
>>   migration: check required entries are loaded, once
>>   test-vmstate: add some subsection tests
>>   docs/migration: reflect the changes about needed subsections
>> 
>>  docs/devel/migration.rst  |  17 +++---
>>  hw/block/fdc.c            |   5 ++
>>  hw/virtio/virtio.c        |   6 +-
>>  migration/savevm.c        |  43 ++++++++++++++
>>  migration/vmstate.c       |  40 ++++++++++++-
>>  tests/unit/test-vmstate.c | 116 ++++++++++++++++++++++++++++++++++++++
>>  6 files changed, 215 insertions(+), 12 deletions(-)
>> 
>> -- 
>> 2.41.0
Michael S. Tsirkin Dec. 25, 2023, 3:56 p.m. UTC | #3
On Mon, Nov 06, 2023 at 03:35:54PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Hi,
> 
> Surprisingly, the migration code doesn't check that required migration entries
> and subsections are loaded. Either optional or required sections are both
> ignored when missing. According to the documentation a "newer QEMU that knows
> about a subsection can (with care) load a stream from an older QEMU that didn't
> send the subsection". I propose this behaviour to be limited to "optional"
> sections only.
> 
> This series has a few preliminary fixes, add new checks that entries are
> loaded once and required ones have been loaded, add some tests and
> documentation update.
> 
> thanks


series:

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

merge through migration tree.

> v3:
>  - rebased, drop RFC status
>  - switch from tracepoint + returning an error to report for missing
>    subsections, as we worry about potential regressions
>  - add r-b tags
> 
> v2:
>  - add "migration: rename vmstate_save_needed->vmstate_section_needed"
>  - add "migration: set file error on subsection loading"
>  - add subsection tests
>  - update the documentation
> 
> Marc-André Lureau (6):
>   block/fdc: 'phase' is not needed on load
>   virtio: make endian_needed() work during loading
>   migration: check required subsections are loaded, once
>   migration: check required entries are loaded, once
>   test-vmstate: add some subsection tests
>   docs/migration: reflect the changes about needed subsections
> 
>  docs/devel/migration.rst  |  17 +++---
>  hw/block/fdc.c            |   5 ++
>  hw/virtio/virtio.c        |   6 +-
>  migration/savevm.c        |  43 ++++++++++++++
>  migration/vmstate.c       |  40 ++++++++++++-
>  tests/unit/test-vmstate.c | 116 ++++++++++++++++++++++++++++++++++++++
>  6 files changed, 215 insertions(+), 12 deletions(-)
> 
> -- 
> 2.41.0