From patchwork Thu Jun 1 22:15:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 770004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wf1xq3M5Zz9sN8 for ; Fri, 2 Jun 2017 08:20:31 +1000 (AEST) Received: from localhost ([::1]:46899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGYSD-0006y9-2c for incoming@patchwork.ozlabs.org; Thu, 01 Jun 2017 18:20:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGYOJ-00041y-Ey for qemu-devel@nongnu.org; Thu, 01 Jun 2017 18:16:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGYOI-00063t-9a for qemu-devel@nongnu.org; Thu, 01 Jun 2017 18:16:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37548) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dGYOI-00063A-0b for qemu-devel@nongnu.org; Thu, 01 Jun 2017 18:16:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 194BA804F7 for ; Thu, 1 Jun 2017 22:16:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 194BA804F7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 194BA804F7 Received: from secure.mitica (ovpn-117-3.ams2.redhat.com [10.36.117.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7425787957; Thu, 1 Jun 2017 22:16:19 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 2 Jun 2017 00:15:52 +0200 Message-Id: <20170601221552.30628-6-quintela@redhat.com> In-Reply-To: <20170601221552.30628-1-quintela@redhat.com> References: <20170601221552.30628-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 01 Jun 2017 22:16:25 +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] [PATCH 5/5] 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, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Once there, be consistent and use compress_thread_{save,load}_{setup,cleanup}. Signed-off-by: Juan Quintela --- 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 b75aebc..4040b33 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); } @@ -823,7 +820,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; } @@ -1974,7 +1970,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 3349116..e9d97d9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -299,7 +299,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; @@ -322,7 +322,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; @@ -1383,6 +1383,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; } @@ -1915,6 +1916,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); @@ -2220,7 +2222,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; @@ -2241,7 +2243,7 @@ void migrate_decompress_threads_create(void) } } -void migrate_decompress_threads_join(void) +static void compress_threads_load_cleanup(void) { int i, thread_count; @@ -2304,12 +2306,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 e49dd3f..bfb7b04 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -38,11 +38,6 @@ extern XBZRLECacheStats xbzrle_counters; int64_t xbzrle_cache_resize(int64_t new_size); 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);