From patchwork Mon Jul 10 17:10:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 786298 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x5sPF5dfwz9ryk for ; Tue, 11 Jul 2017 03:18:25 +1000 (AEST) Received: from localhost ([::1]:42211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUcKE-0002gI-Vp for incoming@patchwork.ozlabs.org; Mon, 10 Jul 2017 13:18:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUcD6-0004x9-O6 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 13:11:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUcD5-0008Vs-Fq for qemu-devel@nongnu.org; Mon, 10 Jul 2017 13:11:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40841) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUcD5-0008UC-65 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 13:10:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 471BA7F6A6 for ; Mon, 10 Jul 2017 17:10:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 471BA7F6A6 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dgilbert@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 471BA7F6A6 Received: from dgilbert-t530.redhat.com (ovpn-116-231.ams2.redhat.com [10.36.116.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BBEC5D6A6; Mon, 10 Jul 2017 17:10:56 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Mon, 10 Jul 2017 18:10:40 +0100 Message-Id: <20170710171040.21021-10-dgilbert@redhat.com> In-Reply-To: <20170710171040.21021-1-dgilbert@redhat.com> References: <20170710171040.21021-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 10 Jul 2017 17:10:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 9/9] migration: Make compression_threads use save/load_setup/cleanup() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Juan Quintela Once there, be consistent and use compress_thread_{save,load}_{setup,cleanup}. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Message-Id: <20170628095228.4661-6-quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- 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 7e5dbd9b92..a0db40d364 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -286,7 +286,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 @@ -349,7 +348,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); @@ -360,7 +358,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); } @@ -827,7 +824,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; } @@ -1990,7 +1986,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 73aec34161..1b08296d1b 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); @@ -2231,7 +2233,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; @@ -2255,7 +2257,7 @@ void migrate_decompress_threads_create(void) } } -void migrate_decompress_threads_join(void) +static void compress_threads_load_cleanup(void) { int i, thread_count; @@ -2321,12 +2323,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 a8b79a4d4c..c081fde86c 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);