mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration pull: 2020-10-26
Another go at Peter's postcopy fixes Cleanups from Bihong Yu and Peter Maydell. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEERfXHG0oMt/uXep+pBRYzHrxb/ecFAl+W9n8ACgkQBRYzHrxb /ef2uRAAqWTFLXuBF8+evEd1mMq2SM3ZYTuc7QKTY3MzAH6J/OMvJbZ112itqWOb iZ5NuuWH4PvzOhlR/PNNf1Yv3hTfv36HinG+OCh6s+6aqVx9yHOAfdBgmJIdYAeg Sk1jx43dvCyN2FwPs31ir3L6mwsrtfkRsS+2FeyrvRoEl4WE9mOoypCft3vdd9Dw zZea0Pw7vIs454D4n1vpJiQtq6B4eSAlQKpTLfQbglpTm4MgqLERzGvpT6hbQXJR eQyTOqRe08viIOZ+oN0B/+RVO6T9jc4Y1bEl2NSak1v4Tf7NNfDkFpLAjFm07V/1 tIhL/NOOsHdzfHQtrZpzKQgwaceb1N5qo0PfxD6/tRf9HlXY54iw6yY75+5c5Y89 UK8VSIYKnM2yXeVDLShxixIr3A1Z+zA41XydDwaLZczjeV7+nwrAXAjO8a+j6Dox zj4IyN2g5elEOmarC8qkvbDZ+TVvA2tookhWVwoz+D8ChYkcRDKP9eoYomfRwg+e NKRFuLBkyVPb0eEhyOV6HqJbMfTLpHneTM94v6HGz8tiK8IlMZfTTnC2Mr5gTXuS /cgOVhsY7+l+pKpxpGJmU3aUCYRk1CuK6MhXgjYEFMh5Siba8s0ZPZVaEm/BUyO1 rD+tVup87xMiJq3xnmLX+opblYE9G+b67hH1KuPc5vZXiSwuTkQ= =OL0Q -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20201026a' into staging migration pull: 2020-10-26 Another go at Peter's postcopy fixes Cleanups from Bihong Yu and Peter Maydell. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> # gpg: Signature made Mon 26 Oct 2020 16:17:03 GMT # gpg: using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7 # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full] # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A 9FA9 0516 331E BC5B FDE7 * remotes/dgilbert/tags/pull-migration-20201026a: migration-test: Only hide error if !QTEST_LOG migration/postcopy: Release fd before going into 'postcopy-pause' migration: Sync requested pages after postcopy recovery migration: Maintain postcopy faulted addresses migration: Introduce migrate_send_rp_message_req_pages() migration: Pass incoming state into qemu_ufd_copy_ioctl() migration: using trace_ to replace DPRINTF migration: Delete redundant spaces migration: Open brace '{' following function declarations go on the next line migration: Do not initialise statics and globals to 0 or NULL migration: Add braces {} for if statement migration: Open brace '{' following struct go on the same line migration: Add spaces around operator migration: Don't use '#' flag of printf format migration: Do not use C99 // comments migration: Drop unused VMSTATE_FLOAT64 support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
d55450df99
13 changed files with 213 additions and 103 deletions
|
@ -143,6 +143,13 @@ static int migration_maybe_pause(MigrationState *s,
|
|||
int new_state);
|
||||
static void migrate_fd_cancel(MigrationState *s);
|
||||
|
||||
static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp)
|
||||
{
|
||||
uintptr_t a = (uintptr_t) ap, b = (uintptr_t) bp;
|
||||
|
||||
return (a > b) - (a < b);
|
||||
}
|
||||
|
||||
void migration_object_init(void)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
@ -164,6 +171,8 @@ void migration_object_init(void)
|
|||
qemu_event_init(¤t_incoming->main_thread_load_event, false);
|
||||
qemu_sem_init(¤t_incoming->postcopy_pause_sem_dst, 0);
|
||||
qemu_sem_init(¤t_incoming->postcopy_pause_sem_fault, 0);
|
||||
qemu_mutex_init(¤t_incoming->page_request_mutex);
|
||||
current_incoming->page_requested = g_tree_new(page_request_addr_cmp);
|
||||
|
||||
if (!migration_object_check(current_migration, &err)) {
|
||||
error_report_err(err);
|
||||
|
@ -230,6 +239,11 @@ void migration_incoming_state_destroy(void)
|
|||
|
||||
qemu_event_reset(&mis->main_thread_load_event);
|
||||
|
||||
if (mis->page_requested) {
|
||||
g_tree_destroy(mis->page_requested);
|
||||
mis->page_requested = NULL;
|
||||
}
|
||||
|
||||
if (mis->socket_address_list) {
|
||||
qapi_free_SocketAddressList(mis->socket_address_list);
|
||||
mis->socket_address_list = NULL;
|
||||
|
@ -306,8 +320,8 @@ error:
|
|||
* Start: Address offset within the RB
|
||||
* Len: Length in bytes required - must be a multiple of pagesize
|
||||
*/
|
||||
int migrate_send_rp_req_pages(MigrationIncomingState *mis, RAMBlock *rb,
|
||||
ram_addr_t start)
|
||||
int migrate_send_rp_message_req_pages(MigrationIncomingState *mis,
|
||||
RAMBlock *rb, ram_addr_t start)
|
||||
{
|
||||
uint8_t bufc[12 + 1 + 255]; /* start (8), len (4), rbname up to 256 */
|
||||
size_t msglen = 12; /* start + len */
|
||||
|
@ -343,6 +357,37 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis, RAMBlock *rb,
|
|||
return migrate_send_rp_message(mis, msg_type, msglen, bufc);
|
||||
}
|
||||
|
||||
int migrate_send_rp_req_pages(MigrationIncomingState *mis,
|
||||
RAMBlock *rb, ram_addr_t start, uint64_t haddr)
|
||||
{
|
||||
void *aligned = (void *)(uintptr_t)(haddr & (-qemu_ram_pagesize(rb)));
|
||||
bool received;
|
||||
|
||||
WITH_QEMU_LOCK_GUARD(&mis->page_request_mutex) {
|
||||
received = ramblock_recv_bitmap_test_byte_offset(rb, start);
|
||||
if (!received && !g_tree_lookup(mis->page_requested, aligned)) {
|
||||
/*
|
||||
* The page has not been received, and it's not yet in the page
|
||||
* request list. Queue it. Set the value of element to 1, so that
|
||||
* things like g_tree_lookup() will return TRUE (1) when found.
|
||||
*/
|
||||
g_tree_insert(mis->page_requested, aligned, (gpointer)1);
|
||||
mis->page_requested_count++;
|
||||
trace_postcopy_page_req_add(aligned, mis->page_requested_count);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the page is there, skip sending the message. We don't even need the
|
||||
* lock because as long as the page arrived, it'll be there forever.
|
||||
*/
|
||||
if (received) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return migrate_send_rp_message_req_pages(mis, rb, start);
|
||||
}
|
||||
|
||||
static bool migration_colo_enabled;
|
||||
bool migration_incoming_colo_enabled(void)
|
||||
{
|
||||
|
@ -2468,8 +2513,8 @@ static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname,
|
|||
* Since we currently insist on matching page sizes, just sanity check
|
||||
* we're being asked for whole host pages.
|
||||
*/
|
||||
if (start & (our_host_ps-1) ||
|
||||
(len & (our_host_ps-1))) {
|
||||
if (start & (our_host_ps - 1) ||
|
||||
(len & (our_host_ps - 1))) {
|
||||
error_report("%s: Misaligned page request, start: " RAM_ADDR_FMT
|
||||
" len: %zd", __func__, start, len);
|
||||
mark_source_rp_bad(ms);
|
||||
|
@ -3123,9 +3168,6 @@ static MigThrError postcopy_pause(MigrationState *s)
|
|||
while (true) {
|
||||
QEMUFile *file;
|
||||
|
||||
migrate_set_state(&s->state, s->state,
|
||||
MIGRATION_STATUS_POSTCOPY_PAUSED);
|
||||
|
||||
/* Current channel is possibly broken. Release it. */
|
||||
assert(s->to_dst_file);
|
||||
qemu_mutex_lock(&s->qemu_file_lock);
|
||||
|
@ -3136,6 +3178,9 @@ static MigThrError postcopy_pause(MigrationState *s)
|
|||
qemu_file_shutdown(file);
|
||||
qemu_fclose(file);
|
||||
|
||||
migrate_set_state(&s->state, s->state,
|
||||
MIGRATION_STATUS_POSTCOPY_PAUSED);
|
||||
|
||||
error_report("Detected IO failure for postcopy. "
|
||||
"Migration paused.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue