migration queue for 3.0
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit 3bae150448dbd888a480f892ebbf01caec0d8329:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-07-24 15:26:01 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.git tags/pull-migration-20180724a
for you to fetch changes up to 4b3fb65db973b51346e3456987ba80b15c1fc75c:
migration: fix duplicate initialization for expected_downtime and cleanup_bh (2018-07-24 17:28:57 +0100)
----------------------------------------------------------------
Migration pull for 3.0
Fixes only
----------------------------------------------------------------
Dr. David Alan Gilbert (2):
migrate: Fix cancelling state warning
audio/hda: Fix migration
Lidong Chen (1):
migration: fix duplicate initialization for expected_downtime and cleanup_bh
Peter Xu (4):
migration: fix potential overflow in multifd send
migration: update recv bitmap only on dest vm
migration: disallow recovery for release-ram
tests: only update last_byte when at the edge
hw/audio/hda-codec.c | 2 +- migration/migration.c | 22 ++++++++++++++++++++-- migration/ram.c | 13 ++++++++++--- tests/migration-test.c | 2 +- 4 files changed, 32 insertions(+), 7 deletions(-)
[Qemu-devel] [PULL 1/7] migration: fix potential overflow in multifd send
From: Peter Xu <[email protected]>
I would guess it won't happen normally, but this should ease Coverity.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1394385: Integer handling issues (
OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression "pages->used* 8192U" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t" (64 bits, unsigned).
854 transferred = pages->used * TARGET_PAGE_SIZE + p->packet_len;
Message-Id: <[email protected]>
--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/ram.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 2/7] migrate: Fix cancelling state warning
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
We've been getting the warning:
migration_iteration_finish: Unknown ending state 2
on a cancel.
I think that's originally due to 39b9e17905c; although I've only seen the warning, I think that in some cases that we could find the VM stays paused after a cancel where it should restart.
Message-Id: <[email protected]>
--- migration/migration.c | 1 + 1 file changed, 1 insertion(+)
migration/migration.c +1 -0
@@ -2877,6 +2877,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 {
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 3/7] audio/hda: Fix migration
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Fix outgoing migration which was crashing in vmstate_hda_audio_stream_buf_needed, I think the problem is that we have room for upto 4 streams in the array but only use 2, when we come to try and save the state of the unused streams we hit st->state == NULL.
Message-Id: <[email protected]>
--- hw/audio/hda-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/audio/hda-codec.c +1 -1
@@ -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 = {
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 4/7] migration: update recv bitmap only on dest vm
In reply to Dr. David Alan Gilbert (git)From: Peter Xu <[email protected]>
We shouldn't update the received bitmap if we're the source VM. This fixes a breakage when release-ram is enabled on postcopy.
Message-Id: <[email protected]>
--- migration/ram.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
migration/ram.c +9 -2
@@ -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:
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 5/7] migration: disallow recovery for release-ram
In reply to Dr. David Alan Gilbert (git)From: Peter Xu <[email protected]>
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.
Message-Id: <[email protected]>
--- migration/migration.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
migration/migration.c +19 -0
@@ -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; }
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 6/7] tests: only update last_byte when at the edge
In reply to Dr. David Alan Gilbert (git)From: Peter Xu <[email protected]>
The only possible change of last_byte is when it reaches the edge. Setting it every time might let last_byte contain an invalid data when memory corruption is detected, then the check of the next byte will be incorrect. For example, a single page corruption at address 0x14ad000 will also lead to a "fake" corruption at 0x14ae000:
Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0 Memory content inconsistency at 14ae000 first_byte = 44 last_byte = ef current = 44 hit_edge = 0
After the patch, it'll only report the corrputed page:
Memory content inconsistency at 14ad000 first_byte = 44 last_byte = 44 current = ef hit_edge = 0
Message-Id: <[email protected]>
--- tests/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/migration-test.c +1 -1
@@ -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); }
Signature · 1 line
2.17.1
[Qemu-devel] [PULL 7/7] migration: fix duplicate initialization for expected_downtime and cleanup_bh
In reply to Dr. David Alan Gilbert (git)From: Lidong Chen <[email protected]>
migrate_fd_connect duplicate initialize expected_downtime and cleanup_bh.
Message-Id: <[email protected]>
--- migration/migration.c | 2 -- 1 file changed, 2 deletions(-)
migration/migration.c +0 -2
@@ -3052,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);
Signature · 1 line
2.17.1
Peter Maydell
AppliedQuoted 12 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit
3bae150448dbd888a480f892ebbf01caec0d8329:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-07-24 15:26:01 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.gittags/pull-migration-20180724afor you to fetch changes up to
4b3fb65db973b51346e3456987ba80b15c1fc75c:
Quoted 8 lines
migration: fix duplicate initialization for
expected_downtimeandcleanup_bh(2018-07-24 17:28:57 +0100)----------------------------------------------------------------
Migration pull for 3.0Fixes only
----------------------------------------------------------------
Applied, thanks.
-- PMM