[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/15] migration: avoid divide by zero in xbzrle cach
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 15/15] migration: avoid divide by zero in xbzrle cache miss rate |
Date: |
Wed, 6 May 2015 19:50:04 +0200 |
From: Michael Chapman <address@hidden>
This bug manifested itself as a VM that could not be resumed by libvirt
following a migration:
# virsh resume example
error: Failed to resume domain example
error: internal error: cannot parse json {"return":
{"xbzrle-cache":
{..., "cache-miss-rate": -nan, ...},
...
}
}: lexical error: malformed number, a digit is required after the minus sign.
This patch also ensures xbzrle_cache_miss_prev and iterations_prev are
cleared at the start of the migration.
Signed-off-by: Michael Chapman <address@hidden>
Reviewed-by: Amit Shah <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 6a0d709..099e63f 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -663,12 +663,16 @@ static void migration_bitmap_sync_range(ram_addr_t start,
ram_addr_t length)
static int64_t start_time;
static int64_t bytes_xfer_prev;
static int64_t num_dirty_pages_period;
+static uint64_t xbzrle_cache_miss_prev;
+static uint64_t iterations_prev;
static void migration_bitmap_sync_init(void)
{
start_time = 0;
bytes_xfer_prev = 0;
num_dirty_pages_period = 0;
+ xbzrle_cache_miss_prev = 0;
+ iterations_prev = 0;
}
/* Called with iothread lock held, to protect ram_list.dirty_memory[] */
@@ -679,8 +683,6 @@ static void migration_bitmap_sync(void)
MigrationState *s = migrate_get_current();
int64_t end_time;
int64_t bytes_xfer_now;
- static uint64_t xbzrle_cache_miss_prev;
- static uint64_t iterations_prev;
bitmap_sync_count++;
@@ -728,7 +730,7 @@ static void migration_bitmap_sync(void)
mig_throttle_on = false;
}
if (migrate_use_xbzrle()) {
- if (iterations_prev != 0) {
+ if (iterations_prev != acct_info.iterations) {
acct_info.xbzrle_cache_miss_rate =
(double)(acct_info.xbzrle_cache_miss -
xbzrle_cache_miss_prev) /
--
2.4.0
- [Qemu-devel] [PULL 05/15] arch_init: Alloc and free data struct for compression, (continued)
- [Qemu-devel] [PULL 05/15] arch_init: Alloc and free data struct for compression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 02/15] migration: Add the framework of multi-thread compression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 06/15] arch_init: Add and free data struct for decompression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 03/15] migration: Add the framework of multi-thread decompression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 07/15] migration: Split save_zero_page from ram_save_page, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 08/15] migration: Add the core code of multi-thread compression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 09/15] migration: Make compression co-work with xbzrle, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 10/15] migration: Add the core code for decompression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 11/15] migration: Add interface to control compression, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 15/15] migration: avoid divide by zero in xbzrle cache miss rate,
Juan Quintela <=
- [Qemu-devel] [PULL 13/15] migration: Add qmp commands to set and query parameters, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 12/15] migration: Use an array instead of 3 parameters, Juan Quintela, 2015/05/06
- [Qemu-devel] [PULL 14/15] migration: Add hmp interface to set and query parameters, Juan Quintela, 2015/05/06
- Re: [Qemu-devel] [PULL 00/15] migration pull request, Peter Maydell, 2015/05/06