From: Michael Chapman <mike@very.puzzling.org>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>, Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH] migration: avoid divide by zero in xbzrle cache miss rate
Date: Wed, 15 Apr 2015 13:59:14 +1000 [thread overview]
Message-ID: <1429070355-19862-1-git-send-email-mike@very.puzzling.org> (raw)
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 <mike@very.puzzling.org>
---
arch_init.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 4c8fcee..ca45c7a 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -520,12 +520,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[] */
@@ -536,8 +540,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++;
@@ -585,7 +587,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.1.0
next reply other threads:[~2015-04-15 4:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 3:59 Michael Chapman [this message]
2015-04-20 7:10 ` [Qemu-devel] [PATCH] migration: avoid divide by zero in xbzrle cache miss rate Amit Shah
2015-04-22 11:39 ` Juan Quintela
2015-05-06 15:35 ` Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429070355-19862-1-git-send-email-mike@very.puzzling.org \
--to=mike@very.puzzling.org \
--cc=amit.shah@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).