[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM) |
Date: |
Thu, 12 Jan 2023 17:56:35 +0000 |
User-agent: |
Mutt/2.2.9 (2022-11-12) |
* David Hildenbrand (david@redhat.com) wrote:
> For virtio-mem, we want to have the plugged/unplugged state of memory
> blocks available before migrating any actual RAM content, and perform
> sanity checks before touching anything on the destination. This
> information is immutable on the migration source while migration is active,
>
> We want to use this information for proper preallocation support with
> migration: currently, we don't preallocate memory on the migration target,
> and especially with hugetlb, we can easily run out of hugetlb pages during
> RAM migration and will crash (SIGBUS) instead of catching this gracefully
> via preallocation.
>
> Migrating device state via a vmsd before we start iterating is currently
> impossible: the only approach that would be possible is avoiding a vmsd
> and migrating state manually during save_setup(), to be restored during
> load_state().
>
> Let's allow for migrating device state via a vmsd early, during the
> setup phase in qemu_savevm_state_setup(). To keep it simple, we
> indicate applicable vmds's using an "immutable" flag.
>
> Note that only very selected devices (i.e., ones seriously messing with
> RAM setup) are supposed to make use of such early state migration.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> include/migration/vmstate.h | 5 +++++
> migration/savevm.c | 14 ++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index ad24aa1934..dd06c3abad 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -179,6 +179,11 @@ struct VMStateField {
> struct VMStateDescription {
> const char *name;
> int unmigratable;
> + /*
> + * The state is immutable while migration is active and is saved
> + * during the setup phase, to be restored early on the destination.
> + */
> + int immutable;
A bool would be nicer (as it would for unmigratable above)
> int version_id;
> int minimum_version_id;
> MigrationPriority priority;
> diff --git a/migration/savevm.c b/migration/savevm.c
> index ff2b8d0064..536d6f662b 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1200,6 +1200,15 @@ void qemu_savevm_state_setup(QEMUFile *f)
>
> trace_savevm_state_setup();
> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> + if (se->vmsd && se->vmsd->immutable) {
> + ret = vmstate_save(f, se, ms->vmdesc);
> + if (ret) {
> + qemu_file_set_error(f, ret);
> + break;
> + }
> + continue;
> + }
> +
Does this give you the ordering you want? i.e. there's no guarantee here
that immutables come first?
Dave
> if (!se->ops || !se->ops->save_setup) {
> continue;
> }
> @@ -1402,6 +1411,11 @@ int
> qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f,
> int ret;
>
> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> + if (se->vmsd && se->vmsd->immutable) {
> + /* Already saved during qemu_savevm_state_setup(). */
> + continue;
> + }
> +
> ret = vmstate_save(f, se, vmdesc);
> if (ret) {
> qemu_file_set_error(f, ret);
> --
> 2.39.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
- Re: [PATCH v3 1/8] migration/savevm: Move more savevm handling into vmstate_save(), (continued)
[PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), David Hildenbrand, 2023/01/12
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Dr. David Alan Gilbert, 2023/01/12
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), David Hildenbrand, 2023/01/12
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Dr. David Alan Gilbert, 2023/01/12
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), Peter Xu, 2023/01/12
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), David Hildenbrand, 2023/01/13
- Re: [PATCH v3 2/8] migration/savevm: Prepare vmdesc json writer in qemu_savevm_state_setup(), David Hildenbrand, 2023/01/13
[PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM),
Dr. David Alan Gilbert <=
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Dr. David Alan Gilbert, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/12
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/13
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/16
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), Peter Xu, 2023/01/16
- Re: [PATCH v3 3/8] migration/savevm: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2023/01/16