Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20…
Browse files Browse the repository at this point in the history
…180724a' 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>
  • Loading branch information
pm215 committed Jul 24, 2018
2 parents debe96f + 4b3fb65 commit 8ca2838
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hw/audio/hda-codec.c
Expand Up @@ -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 = {
Expand Down
22 changes: 20 additions & 2 deletions migration/migration.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 10 additions & 3 deletions migration/ram.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/migration-test.c
Expand Up @@ -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"
Expand All @@ -308,7 +309,6 @@ static void check_guests_ram(QTestState *who)
bad = true;
}
}
last_byte = b;
}
g_assert_false(bad);
}
Expand Down

0 comments on commit 8ca2838

Please sign in to comment.