qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, amit.shah@redhat.com
Subject: Re: [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time
Date: Fri, 22 Apr 2016 12:27:52 +0100	[thread overview]
Message-ID: <20160422112751.GG2239@work-vm> (raw)
In-Reply-To: <1461163481-11439-2-git-send-email-quintela@redhat.com>

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/migration.c | 38 +++++++++++++++++---------------------
>  migration/savevm.c    |  3 ++-
>  2 files changed, 19 insertions(+), 22 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 991313a..314c5c0 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -100,32 +100,28 @@ MigrationState *migrate_get_current(void)
>      return &current_migration;
>  }
> 
> -/* For incoming */
> -static MigrationIncomingState *mis_current;
> -
>  MigrationIncomingState *migration_incoming_get_current(void)
>  {
> -    return mis_current;
> -}
> +    static bool once;
> +    static MigrationIncomingState mis_current;
> 
> -MigrationIncomingState *migration_incoming_state_new(QEMUFile* f)
> -{
> -    mis_current = g_new0(MigrationIncomingState, 1);
> -    mis_current->from_src_file = f;
> -    mis_current->state = MIGRATION_STATUS_NONE;
> -    QLIST_INIT(&mis_current->loadvm_handlers);
> -    qemu_mutex_init(&mis_current->rp_mutex);
> -    qemu_event_init(&mis_current->main_thread_load_event, false);
> -
> -    return mis_current;
> +    if (!once) {
> +        mis_current.state = MIGRATION_STATUS_NONE;
> +        memset(&mis_current, 0, sizeof(MigrationIncomingState));
> +        QLIST_INIT(&mis_current.loadvm_handlers);
> +        qemu_mutex_init(&mis_current.rp_mutex);
> +        qemu_event_init(&mis_current.main_thread_load_event, false);
> +        once = true;
> +    }
> +    return &mis_current;
>  }
> 
>  void migration_incoming_state_destroy(void)
>  {
> -    qemu_event_destroy(&mis_current->main_thread_load_event);
> -    loadvm_free_handlers(mis_current);
> -    g_free(mis_current);
> -    mis_current = NULL;
> +    struct MigrationIncomingState *mis = migration_incoming_get_current();
> +
> +    qemu_event_destroy(&mis->main_thread_load_event);
> +    loadvm_free_handlers(mis);
>  }
> 
> 
> @@ -373,11 +369,11 @@ static void process_incoming_migration_bh(void *opaque)
>  static void process_incoming_migration_co(void *opaque)
>  {
>      QEMUFile *f = opaque;
> -    MigrationIncomingState *mis;
> +    MigrationIncomingState *mis = migration_incoming_get_current();
>      PostcopyState ps;
>      int ret;
> 
> -    mis = migration_incoming_state_new(f);
> +    mis->from_src_file = f;
>      postcopy_state_set(POSTCOPY_INCOMING_NONE);
>      migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
>                        MIGRATION_STATUS_ACTIVE);
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 16ba443..49137a1 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2091,6 +2091,7 @@ int load_vmstate(const char *name)
>      QEMUFile *f;
>      int ret;
>      AioContext *aio_context;
> +    MigrationIncomingState *mis = migration_incoming_get_current();
> 
>      if (!bdrv_all_can_snapshot(&bs)) {
>          error_report("Device '%s' is writable but does not support snapshots.",
> @@ -2141,7 +2142,7 @@ int load_vmstate(const char *name)
>      }
> 
>      qemu_system_reset(VMRESET_SILENT);
> -    migration_incoming_state_new(f);
> +    mis->from_src_file = f;
> 
>      aio_context_acquire(aio_context);
>      ret = qemu_loadvm_state(f);
> -- 
> 2.5.5
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-04-22 11:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 14:44 [Qemu-devel] [RFC 00/13] Multiple fd migration support Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time Juan Quintela
2016-04-22 11:27   ` Dr. David Alan Gilbert [this message]
2016-04-20 14:44 ` [Qemu-devel] [PATCH 02/13] migration: Pass TCP args in an struct Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 03/13] migration: [HACK] Don't create decompression threads if not enabled Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 04/13] migration: Add multifd capability Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 05/13] migration: Create x-multifd-threads parameter Juan Quintela
2016-04-22 11:37   ` Dr. David Alan Gilbert
2016-04-20 14:44 ` [Qemu-devel] [PATCH 06/13] migration: create multifd migration threads Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 07/13] migration: Start of multiple fd work Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 08/13] migration: create ram_multifd_page Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 09/13] migration: Create thread infrastructure for multifd send side Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 10/13] migration: Send the fd number which we are going to use for this page Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 11/13] migration: Create thread infrastructure for multifd recv side Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 12/13] migration: Test new fd infrastructure Juan Quintela
2016-04-20 14:44 ` [Qemu-devel] [PATCH 13/13] migration: [HACK]Transfer pages over new channels Juan Quintela
2016-04-22 12:09   ` Dr. David Alan Gilbert
2016-04-20 15:46 ` [Qemu-devel] [RFC 00/13] Multiple fd migration support Michael S. Tsirkin
2016-04-22 12:26 ` Dr. David Alan Gilbert
2016-04-25 16:53   ` Juan Quintela
2016-04-26 12:38     ` Dr. David Alan Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2016-10-21 19:42 [Qemu-devel] [RFC 00/13] Multifd v2 Juan Quintela
2016-10-21 19:42 ` [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time Juan Quintela
2016-10-26 18:05   ` Dr. David Alan Gilbert

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=20160422112751.GG2239@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).