[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v8 05/14] migration: introduce postcopy-only pen
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-block] [PATCH v8 05/14] migration: introduce postcopy-only pending |
Date: |
Mon, 30 Oct 2017 17:31:59 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
* Vladimir Sementsov-Ogievskiy (address@hidden) wrote:
> There would be savevm states (dirty-bitmap) which can migrate only in
> postcopy stage. The corresponding pending is introduced here.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> Reviewed-by: Juan Quintela <address@hidden>
Note the error patchew picked up on this for s390 which has
cmma_save_pending.
Dave
> ---
> include/migration/register.h | 17 +++++++++++++++--
> migration/savevm.h | 5 +++--
> migration/block.c | 7 ++++---
> migration/migration.c | 15 ++++++++-------
> migration/ram.c | 9 +++++----
> migration/savevm.c | 13 ++++++++-----
> migration/trace-events | 2 +-
> 7 files changed, 44 insertions(+), 24 deletions(-)
>
> diff --git a/include/migration/register.h b/include/migration/register.h
> index f4f7bdc177..9436a87678 100644
> --- a/include/migration/register.h
> +++ b/include/migration/register.h
> @@ -37,8 +37,21 @@ typedef struct SaveVMHandlers {
> int (*save_setup)(QEMUFile *f, void *opaque);
> void (*save_live_pending)(QEMUFile *f, void *opaque,
> uint64_t threshold_size,
> - uint64_t *non_postcopiable_pending,
> - uint64_t *postcopiable_pending);
> + uint64_t *res_precopy_only,
> + uint64_t *res_compatible,
> + uint64_t *res_postcopy_only);
> + /* Note for save_live_pending:
> + * - res_precopy_only is for data which must be migrated in precopy phase
> + * or in stopped state, in other words - before target vm start
> + * - res_compatible is for data which may be migrated in any phase
> + * - res_postcopy_only is for data which must be migrated in postcopy
> phase
> + * or in stopped state, in other words - after source vm stop
> + *
> + * Sum of res_postcopy_only, res_compatible and res_postcopy_only is the
> + * whole amount of pending data.
> + */
> +
> +
> LoadStateHandler *load_state;
> int (*load_setup)(QEMUFile *f, void *opaque);
> int (*load_cleanup)(void *opaque);
> diff --git a/migration/savevm.h b/migration/savevm.h
> index 295c4a1f2c..cf4f0d37ca 100644
> --- a/migration/savevm.h
> +++ b/migration/savevm.h
> @@ -38,8 +38,9 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f);
> int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
> bool inactivate_disks);
> void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size,
> - uint64_t *res_non_postcopiable,
> - uint64_t *res_postcopiable);
> + uint64_t *res_precopy_only,
> + uint64_t *res_compatible,
> + uint64_t *res_postcopy_only);
> void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
> void qemu_savevm_send_open_return_path(QEMUFile *f);
> int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
> diff --git a/migration/block.c b/migration/block.c
> index 3282809583..39dfa567e8 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -865,8 +865,9 @@ static int block_save_complete(QEMUFile *f, void *opaque)
> }
>
> static void block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size,
> - uint64_t *non_postcopiable_pending,
> - uint64_t *postcopiable_pending)
> + uint64_t *res_precopy_only,
> + uint64_t *res_compatible,
> + uint64_t *res_postcopy_only)
> {
> /* Estimate pending number of bytes to send */
> uint64_t pending;
> @@ -887,7 +888,7 @@ static void block_save_pending(QEMUFile *f, void *opaque,
> uint64_t max_size,
>
> DPRINTF("Enter save live pending %" PRIu64 "\n", pending);
> /* We don't do postcopy */
> - *non_postcopiable_pending += pending;
> + *res_precopy_only += pending;
> }
>
> static int block_load(QEMUFile *f, void *opaque, int version_id)
> diff --git a/migration/migration.c b/migration/migration.c
> index 4de3b551fe..e6c9be3cca 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2216,20 +2216,21 @@ static void *migration_thread(void *opaque)
> uint64_t pending_size;
>
> if (!qemu_file_rate_limit(s->to_dst_file)) {
> - uint64_t pend_post, pend_nonpost;
> + uint64_t pend_pre, pend_compat, pend_post;
>
> - qemu_savevm_state_pending(s->to_dst_file, threshold_size,
> - &pend_nonpost, &pend_post);
> - pending_size = pend_nonpost + pend_post;
> + qemu_savevm_state_pending(s->to_dst_file, threshold_size,
> &pend_pre,
> + &pend_compat, &pend_post);
> + pending_size = pend_pre + pend_compat + pend_post;
> trace_migrate_pending(pending_size, threshold_size,
> - pend_post, pend_nonpost);
> + pend_pre, pend_compat, pend_post);
> if (pending_size && pending_size >= threshold_size) {
> /* Still a significant amount to transfer */
>
> if (migrate_postcopy() &&
> s->state != MIGRATION_STATUS_POSTCOPY_ACTIVE &&
> - pend_nonpost <= threshold_size &&
> - atomic_read(&s->start_postcopy)) {
> + pend_pre <= threshold_size &&
> + (atomic_read(&s->start_postcopy) ||
> + (pend_pre + pend_compat <= threshold_size))) {
>
> if (!postcopy_start(s, &old_vm_running)) {
> current_active_state =
> MIGRATION_STATUS_POSTCOPY_ACTIVE;
> diff --git a/migration/ram.c b/migration/ram.c
> index 8620aa400a..1b664a2d9a 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2358,8 +2358,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
> }
>
> static void ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size,
> - uint64_t *non_postcopiable_pending,
> - uint64_t *postcopiable_pending)
> + uint64_t *res_precopy_only,
> + uint64_t *res_compatible,
> + uint64_t *res_postcopy_only)
> {
> RAMState **temp = opaque;
> RAMState *rs = *temp;
> @@ -2379,9 +2380,9 @@ static void ram_save_pending(QEMUFile *f, void *opaque,
> uint64_t max_size,
>
> if (migrate_postcopy_ram()) {
> /* We can do postcopy, and all the data is postcopiable */
> - *postcopiable_pending += remaining_size;
> + *res_compatible += remaining_size;
> } else {
> - *non_postcopiable_pending += remaining_size;
> + *res_precopy_only += remaining_size;
> }
> }
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 4a88228614..f6b62cb202 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1218,13 +1218,15 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f,
> bool iterable_only,
> * for units that can't do postcopy.
> */
> void qemu_savevm_state_pending(QEMUFile *f, uint64_t threshold_size,
> - uint64_t *res_non_postcopiable,
> - uint64_t *res_postcopiable)
> + uint64_t *res_precopy_only,
> + uint64_t *res_compatible,
> + uint64_t *res_postcopy_only)
> {
> SaveStateEntry *se;
>
> - *res_non_postcopiable = 0;
> - *res_postcopiable = 0;
> + *res_precopy_only = 0;
> + *res_compatible = 0;
> + *res_postcopy_only = 0;
>
>
> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> @@ -1237,7 +1239,8 @@ void qemu_savevm_state_pending(QEMUFile *f, uint64_t
> threshold_size,
> }
> }
> se->ops->save_live_pending(f, se->opaque, threshold_size,
> - res_non_postcopiable, res_postcopiable);
> + res_precopy_only, res_compatible,
> + res_postcopy_only);
> }
> }
>
> diff --git a/migration/trace-events b/migration/trace-events
> index 6f29fcc686..a04fffb877 100644
> --- a/migration/trace-events
> +++ b/migration/trace-events
> @@ -86,7 +86,7 @@ migrate_fd_cleanup(void) ""
> migrate_fd_error(const char *error_desc) "error=%s"
> migrate_fd_cancel(void) ""
> migrate_handle_rp_req_pages(const char *rbname, size_t start, size_t len)
> "in %s at 0x%zx len 0x%zx"
> -migrate_pending(uint64_t size, uint64_t max, uint64_t post, uint64_t
> nonpost) "pending size %" PRIu64 " max %" PRIu64 " (post=%" PRIu64 "
> nonpost=%" PRIu64 ")"
> +migrate_pending(uint64_t size, uint64_t max, uint64_t pre, uint64_t compat,
> uint64_t post) "pending size %" PRIu64 " max %" PRIu64 " (pre = %" PRIu64 "
> compat=%" PRIu64 " post=%" PRIu64 ")"
> migrate_send_rp_message(int msg_type, uint16_t len) "%d: len %d"
> migration_completion_file_err(void) ""
> migration_completion_postcopy_end(void) ""
> --
> 2.11.1
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- [Qemu-block] [PATCH v8 03/14] block/dirty-bitmap: add bdrv_dirty_bitmap_release_successor, (continued)
- [Qemu-block] [PATCH v8 03/14] block/dirty-bitmap: add bdrv_dirty_bitmap_release_successor, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 01/14] block/dirty-bitmap: add bdrv_dirty_bitmap_enable_successor(), Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 04/14] block/dirty-bitmap: add bdrv_dirty_bitmap_set_frozen, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 09/14] migration: add is_active_iterate handler, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 07/14] migration: include migrate_dirty_bitmaps in migrate_postcopy, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 14/14] iotests: add persistent bitmap migration test, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 12/14] iotests: add dirty bitmap migration test, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 02/14] block/dirty-bitmap: add locked version of bdrv_release_dirty_bitmap, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 10/14] migration: add postcopy migration of dirty bitmaps, Vladimir Sementsov-Ogievskiy, 2017/10/30
- [Qemu-block] [PATCH v8 05/14] migration: introduce postcopy-only pending, Vladimir Sementsov-Ogievskiy, 2017/10/30
- Re: [Qemu-block] [Qemu-devel] [PATCH v8 00/14] Dirty bitmaps postcopy migration, no-reply, 2017/10/30
- Re: [Qemu-block] [PATCH v8 00/14] Dirty bitmaps postcopy migration, Vladimir Sementsov-Ogievskiy, 2017/10/30