All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com,
	famz@redhat.com, stefanha@redhat.com, amit.shah@redhat.com,
	quintela@redhat.com, mreitz@redhat.com, kwolf@redhat.com,
	peter.maydell@linaro.org, den@openvz.org, jsnow@redhat.com,
	lirans@il.ibm.com
Subject: Re: [Qemu-devel] [PATCH v10 05/12] migration: introduce postcopy-only pending
Date: Mon, 12 Mar 2018 15:30:21 +0000	[thread overview]
Message-ID: <20180312153020.GI3219@work-vm> (raw)
In-Reply-To: <20180207155837.92351-6-vsementsov@virtuozzo.com>

* Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) 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 <vsementsov@virtuozzo.com>
> ---
>  include/migration/register.h | 17 +++++++++++++++--
>  migration/savevm.h           |  5 +++--
>  hw/s390x/s390-stattrib.c     |  7 ++++---
>  migration/block.c            |  7 ++++---
>  migration/migration.c        | 16 +++++++++-------
>  migration/ram.c              |  9 +++++----
>  migration/savevm.c           | 13 ++++++++-----
>  migration/trace-events       |  2 +-
>  8 files changed, 49 insertions(+), 27 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/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index 2902f54f11..dd3fbfd1eb 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -183,15 +183,16 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)
>  }
>  
>  static void cmma_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)
>  {
>      S390StAttribState *sas = S390_STATTRIB(opaque);
>      S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
>      long long res = sac->get_dirtycount(sas);
>  
>      if (res >= 0) {
> -        *non_postcopiable_pending += res;
> +        *res_precopy_only += res;
>      }
>  }
>  
> diff --git a/migration/block.c b/migration/block.c
> index 1f03946797..5652ca3337 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -866,8 +866,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;
> @@ -888,7 +889,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 c99a4e62d7..3beedd676e 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2215,21 +2215,23 @@ typedef enum {
>   */
>  static MigIterateState migration_iteration_run(MigrationState *s)
>  {
> -    uint64_t pending_size, pend_post, pend_nonpost;
> +    uint64_t pending_size, pend_pre, pend_compat, pend_post;
>      bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
>  
> -    qemu_savevm_state_pending(s->to_dst_file, s->threshold_size,
> -                              &pend_nonpost, &pend_post);
> -    pending_size = pend_nonpost + pend_post;
> +    qemu_savevm_state_pending(s->to_dst_file, s->threshold_size, &pend_pre,
> +                              &pend_compat, &pend_post);
> +    pending_size = pend_pre + pend_compat + pend_post;
>  
>      trace_migrate_pending(pending_size, s->threshold_size,
> -                          pend_post, pend_nonpost);
> +                          pend_pre, pend_compat, pend_post);
>  
>      if (pending_size && pending_size >= s->threshold_size) {
>          /* Still a significant amount to transfer */
>          if (migrate_postcopy() && !in_postcopy &&
> -            pend_nonpost <= s->threshold_size &&
> -            atomic_read(&s->start_postcopy)) {
> +            pend_pre <= s->threshold_size &&
> +            (atomic_read(&s->start_postcopy) ||
> +             (pend_pre + pend_compat <= s->threshold_size)))

This change does something different from the description;
it causes a postcopy_start even if the user never ran the postcopy-start
command; so sorry, we can't do that; because postcopy for RAM is
something that users can enable but only switch into when they've given
up on it completing normally.

However, I guess that leaves you with a problem; which is what happens
to the system when you've run out of pend_pre+pend_compat but can't
complete because pend_post is non-0; so I don't know the answer to that.

Dave

> +        {
>              if (postcopy_start(s)) {
>                  error_report("%s: postcopy failed to start", __func__);
>              }
> diff --git a/migration/ram.c b/migration/ram.c
> index cb1950f3eb..38b1b2486a 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -2359,8 +2359,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;
> @@ -2380,9 +2381,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 b7908f62be..c3c60a15e3 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 / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-03-12 15:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 15:58 [Qemu-devel] [PATCH v10 00/12] Dirty bitmaps postcopy migration Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 01/12] block/dirty-bitmap: add bdrv_dirty_bitmap_enable_successor() Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 02/12] block/dirty-bitmap: fix locking in bdrv_reclaim_dirty_bitmap Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 03/12] block/dirty-bitmap: add _locked version of bdrv_reclaim_dirty_bitmap Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 04/12] dirty-bitmap: add locked state Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 05/12] migration: introduce postcopy-only pending Vladimir Sementsov-Ogievskiy
2018-03-12 15:30   ` Dr. David Alan Gilbert [this message]
2018-03-13  5:38     ` John Snow
2018-03-13 12:17       ` Dr. David Alan Gilbert
2018-03-13  7:47     ` Vladimir Sementsov-Ogievskiy
2018-03-13 10:30       ` Dr. David Alan Gilbert
2018-03-13 13:11         ` Vladimir Sementsov-Ogievskiy
2018-03-13 13:32           ` Vladimir Sementsov-Ogievskiy
2018-03-13 15:35           ` Dr. David Alan Gilbert
2018-03-13 16:14             ` Vladimir Sementsov-Ogievskiy
2018-03-13 16:16               ` John Snow
2018-03-13 16:33                 ` Vladimir Sementsov-Ogievskiy
2018-03-13 17:10                   ` John Snow
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 06/12] qapi: add dirty-bitmaps migration capability Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 07/12] migration: include migrate_dirty_bitmaps in migrate_postcopy Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 08/12] migration/qemu-file: add qemu_put_counted_string() Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 09/12] migration: add is_active_iterate handler Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 10/12] migration: add postcopy migration of dirty bitmaps Vladimir Sementsov-Ogievskiy
2018-03-12 16:09   ` Dr. David Alan Gilbert
2018-03-13 16:59     ` Vladimir Sementsov-Ogievskiy
2018-03-13 18:02       ` Dr. David Alan Gilbert
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 11/12] iotests: add dirty bitmap migration test Vladimir Sementsov-Ogievskiy
2018-03-12 16:19   ` Dr. David Alan Gilbert
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 12/12] iotests: add dirty bitmap postcopy test Vladimir Sementsov-Ogievskiy
2018-03-12 16:24   ` Dr. David Alan Gilbert
2018-02-15  9:38 ` [Qemu-devel] ping Re: [PATCH v10 00/12] Dirty bitmaps postcopy migration Vladimir Sementsov-Ogievskiy
2018-02-16 15:03 ` [Qemu-devel] " Vladimir Sementsov-Ogievskiy
2018-03-02 13:05 ` [Qemu-devel] ping " Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180312153020.GI3219@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lirans@il.ibm.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.