From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, lvivier@redhat.com, peterx@redhat.com,
kwolf@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 5/5] migration: Make compression_threads use save/load_setup/cleanup()
Date: Fri, 16 Jun 2017 19:04:36 +0100 [thread overview]
Message-ID: <20170616180435.GF19805@work-vm> (raw)
In-Reply-To: <20170613095338.11560-6-quintela@redhat.com>
* Juan Quintela (quintela@redhat.com) wrote:
> Once there, be consistent and use
> compress_thread_{save,load}_{setup,cleanup}.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> migration/migration.c | 5 -----
> migration/ram.c | 12 ++++++++----
> migration/ram.h | 5 -----
> 3 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 98f2ee1..dc96021 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -284,7 +284,6 @@ static void process_incoming_migration_bh(void *opaque)
> } else {
> runstate_set(global_state_get_runstate());
> }
> - migrate_decompress_threads_join();
> /*
> * This must happen after any state changes since as soon as an external
> * observer sees this event they might start to prod at the VM assuming
> @@ -347,7 +346,6 @@ static void process_incoming_migration_co(void *opaque)
> migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
> MIGRATION_STATUS_FAILED);
> error_report("load of migration failed: %s", strerror(-ret));
> - migrate_decompress_threads_join();
> exit(EXIT_FAILURE);
> }
> mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);
> @@ -358,7 +356,6 @@ void migration_fd_process_incoming(QEMUFile *f)
> {
> Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, f);
>
> - migrate_decompress_threads_create();
> qemu_file_set_blocking(f, false);
> qemu_coroutine_enter(co);
> }
> @@ -825,7 +822,6 @@ static void migrate_fd_cleanup(void *opaque)
> }
> qemu_mutex_lock_iothread();
>
> - migrate_compress_threads_join();
> qemu_fclose(s->to_dst_file);
> s->to_dst_file = NULL;
> }
> @@ -1979,7 +1975,6 @@ void migrate_fd_connect(MigrationState *s)
> }
> }
>
> - migrate_compress_threads_create();
> qemu_thread_create(&s->thread, "live_migration", migration_thread, s,
> QEMU_THREAD_JOINABLE);
> s->migration_thread_running = true;
> diff --git a/migration/ram.c b/migration/ram.c
> index 7040809..f35d65a 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -306,7 +306,7 @@ static inline void terminate_compression_threads(void)
> }
> }
>
> -void migrate_compress_threads_join(void)
> +static void compress_threads_save_cleanup(void)
> {
> int i, thread_count;
>
> @@ -329,7 +329,7 @@ void migrate_compress_threads_join(void)
> comp_param = NULL;
> }
>
> -void migrate_compress_threads_create(void)
> +static void compress_threads_save_setup(void)
> {
> int i, thread_count;
>
> @@ -1390,6 +1390,7 @@ static void ram_save_cleanup(void *opaque)
> }
> XBZRLE_cache_unlock();
> migration_page_queue_free(*rsp);
> + compress_threads_save_cleanup();
> g_free(*rsp);
> *rsp = NULL;
> }
> @@ -1923,6 +1924,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
> }
>
> rcu_read_unlock();
> + compress_threads_save_setup();
>
> ram_control_before_iterate(f, RAM_CONTROL_SETUP);
> ram_control_after_iterate(f, RAM_CONTROL_SETUP);
> @@ -2228,7 +2230,7 @@ static void wait_for_decompress_done(void)
> qemu_mutex_unlock(&decomp_done_lock);
> }
>
> -void migrate_decompress_threads_create(void)
> +static void compress_threads_load_setup(void)
> {
> int i, thread_count;
>
> @@ -2249,7 +2251,7 @@ void migrate_decompress_threads_create(void)
> }
> }
>
> -void migrate_decompress_threads_join(void)
> +static void compress_threads_load_cleanup(void)
> {
> int i, thread_count;
>
> @@ -2312,12 +2314,14 @@ static void decompress_data_with_multi_threads(QEMUFile *f,
> static int ram_load_setup(QEMUFile *f, void *opaque)
> {
> xbzrle_load_setup();
> + compress_threads_load_setup();
> return 0;
> }
>
> static int ram_load_cleanup(void *opaque)
> {
> xbzrle_load_cleanup();
> + compress_threads_load_cleanup();
> return 0;
> }
>
> diff --git a/migration/ram.h b/migration/ram.h
> index a8b79a4..c081fde 100644
> --- a/migration/ram.h
> +++ b/migration/ram.h
> @@ -39,11 +39,6 @@ int64_t xbzrle_cache_resize(int64_t new_size);
> uint64_t ram_bytes_remaining(void);
> uint64_t ram_bytes_total(void);
>
> -void migrate_compress_threads_create(void);
> -void migrate_compress_threads_join(void);
> -void migrate_decompress_threads_create(void);
> -void migrate_decompress_threads_join(void);
> -
> uint64_t ram_pagesize_summary(void);
> int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
> void acct_update_position(QEMUFile *f, size_t size, bool zero);
> --
> 2.9.4
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2017-06-16 18:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-13 9:53 [Qemu-devel] [PATCH v2 0/5] Create setup/cleanup methods for migration incoming side Juan Quintela
2017-06-13 9:53 ` [Qemu-devel] [PATCH v2 1/5] migration: Rename save_live_setup() to save_setup() Juan Quintela
2017-06-16 17:30 ` Dr. David Alan Gilbert
2017-06-13 9:53 ` [Qemu-devel] [PATCH v2 2/5] migration: Rename cleanup() to save_cleanup() Juan Quintela
2017-06-16 17:33 ` Dr. David Alan Gilbert
2017-06-13 9:53 ` [Qemu-devel] [PATCH v2 3/5] migration: Create load_setup()/cleanup() methods Juan Quintela
2017-06-16 17:54 ` Dr. David Alan Gilbert
2017-06-13 9:53 ` [Qemu-devel] [PATCH v2 4/5] migration: Convert ram to use new load_setup()/load_cleanup() Juan Quintela
2017-06-16 18:00 ` Dr. David Alan Gilbert
2017-06-21 11:33 ` Juan Quintela
2017-06-13 9:53 ` [Qemu-devel] [PATCH v2 5/5] migration: Make compression_threads use save/load_setup/cleanup() Juan Quintela
2017-06-16 18:04 ` Dr. David Alan Gilbert [this message]
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=20170616180435.GF19805@work-vm \
--to=dgilbert@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@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).