aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-07-24 20:16:31 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-24 20:16:31 +0100
commit8ca2838de2d0c5e5166549e5d15448433efaf348 (patch)
tree44d3248bac7edc81fc231656bd942a19b5ffab08
parentdebe96fdeca911247d4b4862ce0a2a5bc27d6b35 (diff)
parent4b3fb65db973b51346e3456987ba80b15c1fc75c (diff)
downloadqemu-arm-8ca2838de2d0c5e5166549e5d15448433efaf348.tar.gz
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180724a' into staging
Migration pull for 3.0 Fixes only # gpg: Signature made Tue 24 Jul 2018 19:31:39 BST # gpg: using RSA key 0516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-migration-20180724a: migration: fix duplicate initialization for expected_downtime and cleanup_bh tests: only update last_byte when at the edge migration: disallow recovery for release-ram migration: update recv bitmap only on dest vm audio/hda: Fix migration migrate: Fix cancelling state warning migration: fix potential overflow in multifd send Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/audio/hda-codec.c2
-rw-r--r--migration/migration.c22
-rw-r--r--migration/ram.c13
-rw-r--r--tests/migration-test.c2
4 files changed, 32 insertions, 7 deletions
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 2b58c3505b..617a1c1016 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -786,7 +786,7 @@ static void hda_audio_reset(DeviceState *dev)
static bool vmstate_hda_audio_stream_buf_needed(void *opaque)
{
HDAAudioStream *st = opaque;
- return st->state->use_timer;
+ return st->state && st->state->use_timer;
}
static const VMStateDescription vmstate_hda_audio_stream_buf = {
diff --git a/migration/migration.c b/migration/migration.c
index 8d56d56930..b7d9854bda 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1629,6 +1629,25 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
"paused migration");
return false;
}
+
+ /*
+ * Postcopy recovery won't work well with release-ram
+ * capability since release-ram will drop the page buffer as
+ * long as the page is put into the send buffer. So if there
+ * is a network failure happened, any page buffers that have
+ * not yet reached the destination VM but have already been
+ * sent from the source VM will be lost forever. Let's refuse
+ * the client from resuming such a postcopy migration.
+ * Luckily release-ram was designed to only be used when src
+ * and destination VMs are on the same host, so it should be
+ * fine.
+ */
+ if (migrate_release_ram()) {
+ error_setg(errp, "Postcopy recovery cannot work "
+ "when release-ram capability is set");
+ return false;
+ }
+
/* This is a resume, skip init status */
return true;
}
@@ -2877,6 +2896,7 @@ static void migration_iteration_finish(MigrationState *s)
/* Fallthrough */
case MIGRATION_STATUS_FAILED:
case MIGRATION_STATUS_CANCELLED:
+ case MIGRATION_STATUS_CANCELLING:
if (s->vm_was_running) {
vm_start();
} else {
@@ -3032,8 +3052,6 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
} else {
/* This is a fresh new migration */
rate_limit = s->parameters.max_bandwidth / XFER_LIMIT_RATIO;
- s->expected_downtime = s->parameters.downtime_limit;
- s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
/* Notify before starting migration thread */
notifier_list_notify(&migration_state_notifiers, s);
diff --git a/migration/ram.c b/migration/ram.c
index 52dd678092..24dea2730c 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -851,7 +851,7 @@ static void multifd_send_pages(void)
p->pages->block = NULL;
multifd_send_state->pages = p->pages;
p->pages = pages;
- transferred = pages->used * TARGET_PAGE_SIZE + p->packet_len;
+ transferred = ((uint64_t) pages->used) * TARGET_PAGE_SIZE + p->packet_len;
ram_counters.multifd_bytes += transferred;
ram_counters.transferred += transferred;;
qemu_mutex_unlock(&p->mutex);
@@ -2827,8 +2827,15 @@ int ram_discard_range(const char *rbname, uint64_t start, size_t length)
goto err;
}
- bitmap_clear(rb->receivedmap, start >> qemu_target_page_bits(),
- length >> qemu_target_page_bits());
+ /*
+ * On source VM, we don't need to update the received bitmap since
+ * we don't even have one.
+ */
+ if (rb->receivedmap) {
+ bitmap_clear(rb->receivedmap, start >> qemu_target_page_bits(),
+ length >> qemu_target_page_bits());
+ }
+
ret = ram_block_discard_range(rb, start, length);
err:
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 086f727b34..e079e0bdb6 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -300,6 +300,7 @@ static void check_guests_ram(QTestState *who)
* to us yet.
*/
hit_edge = true;
+ last_byte = b;
} else {
fprintf(stderr, "Memory content inconsistency at %x"
" first_byte = %x last_byte = %x current = %x"
@@ -308,7 +309,6 @@ static void check_guests_ram(QTestState *who)
bad = true;
}
}
- last_byte = b;
}
g_assert_false(bad);
}