From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzF9V-0003Xb-Ma for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzF9Q-0004pc-Li for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:17 -0500 Received: from mga02.intel.com ([134.134.136.20]:57118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzF9Q-0004pP-F8 for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:12 -0500 From: Liang Li Date: Fri, 12 Dec 2014 09:28:59 +0800 Message-Id: <1418347746-15829-7-git-send-email-liang.z.li@intel.com> In-Reply-To: <1418347746-15829-1-git-send-email-liang.z.li@intel.com> References: <1418347746-15829-1-git-send-email-liang.z.li@intel.com> Subject: [Qemu-devel] [v3 06/13] arch_init: Add data struct used by decompression List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: quintela@redhat.com, Liang Li , armbru@redhat.com, lcapitulino@redhat.com, yang.z.zhang@intel.com, dgilbert@redhat.com Define the data structure and varibles used when doing multiple thread decompression, and add the code to initialize and free them. Signed-off-by: Liang Li Signed-off-by: Yang Zhang --- arch_init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch_init.c b/arch_init.c index f21a8ea..71cc756 100644 --- a/arch_init.c +++ b/arch_init.c @@ -355,7 +355,12 @@ enum { }; struct decompress_param { - /* To be done */ + int state; + QemuMutex mutex; + QemuCond cond; + void *des; + uint8 compbuf[COMPRESS_BUF_SIZE]; + int len; }; typedef struct decompress_param decompress_param; @@ -1186,6 +1191,8 @@ void migrate_decompress_threads_create(int count) decomp_param = g_malloc0(sizeof(decompress_param) * count); quit_thread = false; for (i = 0; i < count; i++) { + qemu_mutex_init(&decomp_param[i].mutex); + qemu_cond_init(&decomp_param[i].cond); qemu_thread_create(decompress_threads + i, "decompress", do_data_decompress, decomp_param + i, QEMU_THREAD_JOINABLE); } @@ -1199,6 +1206,8 @@ void migrate_decompress_threads_join(void) thread_count = migrate_decompress_threads(); for (i = 0; i < thread_count; i++) { qemu_thread_join(decompress_threads + i); + qemu_mutex_destroy(&decomp_param[i].mutex); + qemu_cond_destroy(&decomp_param[i].cond); } g_free(decompress_threads); g_free(decomp_param); -- 1.8.3.1