From patchwork Wed Sep 6 18:41:26 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: 810760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXWT3cpsz9sRY for ; Thu, 7 Sep 2017 04:42:28 +1000 (AEST) Received: from localhost ([::1]:37465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfHN-00030K-Va for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:42:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGk-0002z3-Sj for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGg-0001bR-Cn for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56876) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGg-0001a6-73 for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:42 -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 36C5B81DEF for ; Wed, 6 Sep 2017 18:41:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 36C5B81DEF 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=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id E04955D6A4; Wed, 6 Sep 2017 18:41:39 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:26 +0100 Message-Id: <20170906184133.25524-2-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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]); Wed, 06 Sep 2017 18:41:41 +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 1/8] migration: Report when bdrv_inactivate_all fails 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" If the bdrv_inactivate_all fails near the end of the migration, the migration will fail and often the only diagnostics in the log are an I/O error which you can't distinguish from an error on the socket connection. Add an error so we know when it's actually a block problem. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170822170212.27347-1-dgilbert@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Stefan Hajnoczi Signed-off-by: Dr. David Alan Gilbert --- migration/savevm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index fdd15fa0a7..7a55023d1a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1157,6 +1157,8 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, * bdrv_invalidate_cache_all() on the other end won't fail. */ ret = bdrv_inactivate_all(); if (ret) { + error_report("%s: bdrv_inactivate_all() failed (%d)", + __func__, ret); qemu_file_set_error(f, ret); return ret; } From patchwork Wed Sep 6 18:41:27 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: 810761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXWX1jX6z9t2W for ; Thu, 7 Sep 2017 04:42:32 +1000 (AEST) Received: from localhost ([::1]:37466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfHS-000323-7M for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:42:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGm-00030C-J3 for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGh-0001eM-VW for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGh-0001cc-NA for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:43 -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 A894FC049E31 for ; Wed, 6 Sep 2017 18:41:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A894FC049E31 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F5B861F21; Wed, 6 Sep 2017 18:41:41 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:27 +0100 Message-Id: <20170906184133.25524-3-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.31]); Wed, 06 Sep 2017 18:41:42 +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 2/8] xbzrle: Drop unused cache_resize() 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster Unused since commit fd8cec XBZRLE: Fix qemu crash when resize the xbzrle cache. Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Reviewed-by: Amit Shah Reviewed-by: Juan Quintela Signed-off-by: Markus Armbruster Message-Id: <1501148776-16890-2-git-send-email-armbru@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- migration/page_cache.c | 56 -------------------------------------------------- migration/page_cache.h | 11 ---------- 2 files changed, 67 deletions(-) diff --git a/migration/page_cache.c b/migration/page_cache.c index 5f8578736e..ba984c4858 100644 --- a/migration/page_cache.c +++ b/migration/page_cache.c @@ -178,59 +178,3 @@ int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata, return 0; } - -int64_t cache_resize(PageCache *cache, int64_t new_num_pages) -{ - PageCache *new_cache; - int64_t i; - - CacheItem *old_it, *new_it; - - g_assert(cache); - - /* cache was not inited */ - if (cache->page_cache == NULL) { - return -1; - } - - /* same size */ - if (pow2floor(new_num_pages) == cache->max_num_items) { - return cache->max_num_items; - } - - new_cache = cache_init(new_num_pages, cache->page_size); - if (!(new_cache)) { - DPRINTF("Error creating new cache\n"); - return -1; - } - - /* move all data from old cache */ - for (i = 0; i < cache->max_num_items; i++) { - old_it = &cache->page_cache[i]; - if (old_it->it_addr != -1) { - /* check for collision, if there is, keep MRU page */ - new_it = cache_get_by_addr(new_cache, old_it->it_addr); - if (new_it->it_data && new_it->it_age >= old_it->it_age) { - /* keep the MRU page */ - g_free(old_it->it_data); - } else { - if (!new_it->it_data) { - new_cache->num_items++; - } - g_free(new_it->it_data); - new_it->it_data = old_it->it_data; - new_it->it_age = old_it->it_age; - new_it->it_addr = old_it->it_addr; - } - } - } - - g_free(cache->page_cache); - cache->page_cache = new_cache->page_cache; - cache->max_num_items = new_cache->max_num_items; - cache->num_items = new_cache->num_items; - - g_free(new_cache); - - return cache->max_num_items; -} diff --git a/migration/page_cache.h b/migration/page_cache.h index 10ed53274c..4fadd0c501 100644 --- a/migration/page_cache.h +++ b/migration/page_cache.h @@ -72,15 +72,4 @@ uint8_t *get_cached_data(const PageCache *cache, uint64_t addr); int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata, uint64_t current_age); -/** - * cache_resize: resize the page cache. In case of size reduction the extra - * pages will be freed - * - * Returns -1 on error new cache size on success - * - * @cache pointer to the PageCache struct - * @num_pages: new page cache size (in pages) - */ -int64_t cache_resize(PageCache *cache, int64_t num_pages); - #endif From patchwork Wed Sep 6 18:41:28 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: 810765 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXbd17hfz9sRY for ; Thu, 7 Sep 2017 04:46:05 +1000 (AEST) Received: from localhost ([::1]:37482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfKt-0006Qh-7i for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:46:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGk-0002z1-NN for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGj-0001ia-HH for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39890) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGj-0001gX-9A for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:45 -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 52850155DF for ; Wed, 6 Sep 2017 18:41:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 52850155DF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1F395D6A0; Wed, 6 Sep 2017 18:41:42 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:28 +0100 Message-Id: <20170906184133.25524-4-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.29]); Wed, 06 Sep 2017 18:41:44 +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 3/8] host-utils: Proactively fix pow2floor(), switch to unsigned 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster The function's stated contract is simple enough: "round down to the nearest power of 2". Suggests the domain is the representable numbers >= 1, because that's the smallest power of two. The implementation doesn't check for domain errors, but returns garbage instead: * For negative arguments, pow2floor() returns -2^63, which is not even a power of two, let alone the nearest one. What sort of works is passing *unsigned* arguments >= 2^63. The implicit conversion to signed is implementation defined, but commonly yields the (negative) two's complement. pow2floor() then returns -2^63. Callers that convert that back to unsigned get the correct value 2^63. * For a zero argument, pow2floor() shifts right by 64. Undefined behavior. Common actual behavior is to shift by 0, yielding -2^63. Fix by switching from int64_t to uint64_t and amending the contract to map zero to zero. Callers are fine with that: * memory_access_size() This function makes no sense unless the argument is positive and the return value fits into int. * raw_refresh_limits() Passes an int between 1 and BDRV_REQUEST_MAX_BYTES. * iscsi_refresh_limits() Passes an integer between 0 and INT_MAX, converts the result to uint32_t. Passing zero would be undefined behavior, but commonly yield zero. The patch gives us the zero without the undefined behavior. * cache_init() Passes a positive int64_t argument. * xbzrle_cache_resize() Passes a positive int64_t argument (>= TARGET_PAGE_SIZE, actually). * spapr_node0_size() Passes a positive uint64_t argument, and converts the result to hwaddr, i.e. uint64_t. * spapr_populate_memory() Passes a positive hwaddr argument, and converts the result to hwaddr. Cc: Juan Quintela Cc: Dr. David Alan Gilbert Cc: Eric Blake Cc: Peter Maydell Cc: Alexey Kardashevskiy Signed-off-by: Markus Armbruster Message-Id: <1501148776-16890-3-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Dr. David Alan Gilbert --- include/qemu/host-utils.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 95cf4f4163..6c6005f5cf 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -369,13 +369,16 @@ static inline bool is_power_of_2(uint64_t value) return !(value & (value - 1)); } -/* round down to the nearest power of 2*/ -static inline int64_t pow2floor(int64_t value) +/** + * Return @value rounded down to the nearest power of two or zero. + */ +static inline uint64_t pow2floor(uint64_t value) { - if (!is_power_of_2(value)) { - value = 0x8000000000000000ULL >> clz64(value); + if (!value) { + /* Avoid undefined shift by 64 */ + return 0; } - return value; + return 0x8000000000000000ull >> clz64(value); } /* round up to the nearest power of 2 (0 if overflow) */ From patchwork Wed Sep 6 18:41:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 810768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXfD4dXnz9sRV for ; Thu, 7 Sep 2017 04:48:20 +1000 (AEST) Received: from localhost ([::1]:37489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfN4-0008Oi-Op for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:48:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGm-0002zu-82 for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGl-0001n7-CB for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGl-0001lJ-6J for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:47 -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 39DB88553D for ; Wed, 6 Sep 2017 18:41:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 39DB88553D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BD0C5D6A0; Wed, 6 Sep 2017 18:41:44 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:29 +0100 Message-Id: <20170906184133.25524-5-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-1-dgilbert@redhat.com> MIME-Version: 1.0 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.28]); Wed, 06 Sep 2017 18:41:46 +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 4/8] host-utils: Simplify pow2ceil() 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster Cc: Radim Krčmář Signed-off-by: Markus Armbruster Message-Id: <1501148776-16890-4-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Dr. David Alan Gilbert --- include/qemu/host-utils.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 6c6005f5cf..5ac621cf1f 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -381,18 +381,23 @@ static inline uint64_t pow2floor(uint64_t value) return 0x8000000000000000ull >> clz64(value); } -/* round up to the nearest power of 2 (0 if overflow) */ +/* + * Return @value rounded up to the nearest power of two modulo 2^64. + * This is *zero* for @value > 2^63, so be careful. + */ static inline uint64_t pow2ceil(uint64_t value) { - uint8_t nlz = clz64(value); - - if (is_power_of_2(value)) { - return value; - } - if (!nlz) { - return 0; + int n = clz64(value - 1); + + if (!n) { + /* + * @value - 1 has no leading zeroes, thus @value - 1 >= 2^63 + * Therefore, either @value == 0 or @value > 2^63. + * If it's 0, return 1, else return 0. + */ + return !value; } - return 1ULL << (64 - nlz); + return 0x8000000000000000ull >> (n - 1); } /** From patchwork Wed Sep 6 18:41:30 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: 810764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXZR33xcz9sRY for ; Thu, 7 Sep 2017 04:45:03 +1000 (AEST) Received: from localhost ([::1]:37476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfJt-0005XY-Go for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:45:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGn-00031R-RO for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGm-0001pk-RV for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGm-0001na-Lh for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:48 -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 AD20E61460 for ; Wed, 6 Sep 2017 18:41:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AD20E61460 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81F8A5D6A0; Wed, 6 Sep 2017 18:41:46 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:30 +0100 Message-Id: <20170906184133.25524-6-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.39]); Wed, 06 Sep 2017 18:41:47 +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 5/8] runstate/migrate: Two more transitions 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" There's a race if someone does a 'stop' near the end of migrate; the migration process goes through two runstates: 'finish migrate' 'postmigrate' If the user issues a 'stop' between the two we end up with invalid state transitions. Add the transitions as valid. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170804175011.21944-1-dgilbert@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- vl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vl.c b/vl.c index e75757f977..fb1f05b937 100644 --- a/vl.c +++ b/vl.c @@ -621,6 +621,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_PAUSED, RUN_STATE_RUNNING }, { RUN_STATE_PAUSED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_PAUSED, RUN_STATE_POSTMIGRATE }, { RUN_STATE_PAUSED, RUN_STATE_PRELAUNCH }, { RUN_STATE_PAUSED, RUN_STATE_COLO}, @@ -633,6 +634,7 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING }, + { RUN_STATE_FINISH_MIGRATE, RUN_STATE_PAUSED }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_POSTMIGRATE }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_PRELAUNCH }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_COLO}, From patchwork Wed Sep 6 18:41:31 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: 810766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXct2BDsz9sRV for ; Thu, 7 Sep 2017 04:47:10 +1000 (AEST) Received: from localhost ([::1]:37484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfLw-0007Es-B6 for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:47:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGr-000359-I3 for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGo-0001rl-Ej for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGo-0001rF-8x for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:50 -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 29868C04B941 for ; Wed, 6 Sep 2017 18:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 29868C04B941 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00A905D6A0; Wed, 6 Sep 2017 18:41:47 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:31 +0100 Message-Id: <20170906184133.25524-7-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.31]); Wed, 06 Sep 2017 18:41:49 +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 6/8] migration: Reset rather than destroy main_thread_load_event 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" migration_incoming_state_destroy doesn't really destroy, it cleans up. After a loadvm it's called, but the loadvm command can be run twice, and so destroying an init-once mutex breaks on the second loadvm. Reported-by: Stafford Horne Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170825141940.20740-2-dgilbert@redhat.com> Reviewed-by: Peter Xu Tested-by: Stafford Horne Signed-off-by: Dr. David Alan Gilbert --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 1a2b3ebd1a..9838ccc885 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -166,7 +166,7 @@ void migration_incoming_state_destroy(void) mis->from_src_file = NULL; } - qemu_event_destroy(&mis->main_thread_load_event); + qemu_event_reset(&mis->main_thread_load_event); } static void migrate_generate_event(int new_state) From patchwork Wed Sep 6 18:41:32 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: 810770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXhN0b70z9t2W for ; Thu, 7 Sep 2017 04:50:12 +1000 (AEST) Received: from localhost ([::1]:37495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfOs-0001P8-6k for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:50:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGr-000358-Ho for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGq-0001tC-3d for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGp-0001s6-T7 for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:52 -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 DED6C5AFD9 for ; Wed, 6 Sep 2017 18:41:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DED6C5AFD9 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 764445D6A0; Wed, 6 Sep 2017 18:41:49 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:32 +0100 Message-Id: <20170906184133.25524-8-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.39]); Wed, 06 Sep 2017 18:41:51 +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 7/8] snapshot/tests: Try loadvm twice 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" It's legal to loadvm twice, modify the existing save/loadvm test to do it twice. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170825141940.20740-3-dgilbert@redhat.com> Reviewed-by: Peter Xu Signed-off-by: Dr. David Alan Gilbert --- tests/qemu-iotests/068 | 2 +- tests/qemu-iotests/068.out | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068 index cfa0f2aed5..e7fca6a494 100755 --- a/tests/qemu-iotests/068 +++ b/tests/qemu-iotests/068 @@ -78,7 +78,7 @@ for extra_args in \ # Give qemu some time to boot before saving the VM state { sleep 1; printf "savevm 0\nquit\n"; } | _qemu $extra_args # Now try to continue from that VM state (this should just work) - echo quit | _qemu $extra_args -loadvm 0 + { sleep 1; printf "loadvm 0\nloadvm 0\nquit\n"; } | _qemu $extra_args -S done # success, all done diff --git a/tests/qemu-iotests/068.out b/tests/qemu-iotests/068.out index aa063cf711..f07a938a38 100644 --- a/tests/qemu-iotests/068.out +++ b/tests/qemu-iotests/068.out @@ -7,6 +7,8 @@ QEMU X.Y.Z monitor - type 'help' for more information (qemu) savevm 0 (qemu) quit QEMU X.Y.Z monitor - type 'help' for more information +(qemu) loadvm 0 +(qemu) loadvm 0 (qemu) quit === Saving and reloading a VM state to/from a qcow2 image (-object iothread,id=iothread0 -set device.hba0.iothread=iothread0) === @@ -16,5 +18,7 @@ QEMU X.Y.Z monitor - type 'help' for more information (qemu) savevm 0 (qemu) quit QEMU X.Y.Z monitor - type 'help' for more information +(qemu) loadvm 0 +(qemu) loadvm 0 (qemu) quit *** done From patchwork Wed Sep 6 18:41:33 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: 810762 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 3xnXWt2SWBz9sRY for ; Thu, 7 Sep 2017 04:42:50 +1000 (AEST) Received: from localhost ([::1]:37467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfHk-0003Nw-Cp for incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:42:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpfGw-00039J-5D for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:42:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpfGr-0001wa-Fa for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpfGr-0001ue-9s for qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:41:53 -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 603766146E for ; Wed, 6 Sep 2017 18:41:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 603766146E Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dgilbert@redhat.com Received: from dgilbert-t530.redhat.com (ovpn-117-207.ams2.redhat.com [10.36.117.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33DF55D6A0; Wed, 6 Sep 2017 18:41:51 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 6 Sep 2017 19:41:33 +0100 Message-Id: <20170906184133.25524-9-dgilbert@redhat.com> In-Reply-To: <20170906184133.25524-1-dgilbert@redhat.com> References: <20170906184133.25524-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.39]); Wed, 06 Sep 2017 18:41:52 +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 8/8] migration: dump str in migrate_set_state trace 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: kwolf@redhat.com, armbru@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu Strings are more readable for debugging. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <1504081950-2528-5-git-send-email-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert Fixed up merge with 977c73 --- migration/migration.c | 3 ++- migration/trace-events | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9838ccc885..959e8ec88e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -913,8 +913,9 @@ void qmp_migrate_start_postcopy(Error **errp) void migrate_set_state(int *state, int old_state, int new_state) { + assert(new_state < MIGRATION_STATUS__MAX); if (atomic_cmpxchg(state, old_state, new_state) == old_state) { - trace_migrate_set_state(new_state); + trace_migrate_set_state(MigrationStatus_str(new_state)); migrate_generate_event(new_state); } } diff --git a/migration/trace-events b/migration/trace-events index 7a3b5144ff..d2910a6e7b 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -80,7 +80,7 @@ ram_save_queue_pages(const char *rbname, size_t start, size_t len) "%s: start: 0 # migration/migration.c await_return_path_close_on_source_close(void) "" await_return_path_close_on_source_joining(void) "" -migrate_set_state(int new_state) "new state %d" +migrate_set_state(const char *new_state) "new state %s" migrate_fd_cleanup(void) "" migrate_fd_error(const char *error_desc) "error=%s" migrate_fd_cancel(void) ""