From: Peter Maydell Date: Thu, 15 Dec 2022 14:52:12 +0000 (+0000) Subject: Merge tag 'next-8.0-pull-request' of https://gitlab.com/juan.quintela/qemu into staging X-Git-Tag: v8.0.0~171 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=928eac953918cbd9b237d7cb8b937a6fc575d009;hp=-c;p=mirror_qemu.git Merge tag 'next-8.0-pull-request' of https://gitlab.com/juan.quintela/qemu into staging Migration patches for 8.0 Hi This are the patches that I had to drop form the last PULL request because they werent fixes: - AVX2 is dropped, intel posted a fix, I have to redo it - Fix for out of order channels is out Daniel nacked it and I need to redo it # gpg: Signature made Thu 15 Dec 2022 09:38:29 GMT # gpg: using RSA key 1899FF8EDEBF58CCEE034B82F487EF185872D723 # gpg: Good signature from "Juan Quintela " [full] # gpg: aka "Juan Quintela " [full] # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * tag 'next-8.0-pull-request' of https://gitlab.com/juan.quintela/qemu: migration: Drop rs->f migration: Remove old preempt code around state maintainance migration: Send requested page directly in rp-return thread migration: Move last_sent_block into PageSearchStatus migration: Make PageSearchStatus part of RAMState migration: Add pss_init() migration: Introduce pss_channel migration: Teach PSS about host page migration: Use atomic ops properly for page accountings migration: Yield bitmap_mutex properly when sending/sleeping migration: Remove RAMState.f references in compression code migration: Trivial cleanup save_page_header() on same block check migration: Cleanup xbzrle zero page cache update logic migration: Add postcopy_preempt_active() migration: Take bitmap mutex when completing ram migration migration: Export ram_release_page() migration: Export ram_transferred_ram() multifd: Create page_count fields into both MultiFD{Recv,Send}Params multifd: Create page_size fields into both MultiFD{Recv,Send}Params Signed-off-by: Peter Maydell --- 928eac953918cbd9b237d7cb8b937a6fc575d009 diff --combined migration/migration.c index 78a0b010d4,c3490c495d..52b5d39244 --- a/migration/migration.c +++ b/migration/migration.c @@@ -918,8 -918,11 +918,8 @@@ MigrationParameters *qmp_query_migrate_ params->cpu_throttle_increment = s->parameters.cpu_throttle_increment; params->has_cpu_throttle_tailslow = true; params->cpu_throttle_tailslow = s->parameters.cpu_throttle_tailslow; - params->has_tls_creds = true; params->tls_creds = g_strdup(s->parameters.tls_creds); - params->has_tls_hostname = true; params->tls_hostname = g_strdup(s->parameters.tls_hostname); - params->has_tls_authz = true; params->tls_authz = g_strdup(s->parameters.tls_authz ? s->parameters.tls_authz : ""); params->has_max_bandwidth = true; @@@ -1044,14 -1047,15 +1044,14 @@@ static void populate_ram_info(Migration { size_t page_size = qemu_target_page_size(); - info->has_ram = true; info->ram = g_malloc0(sizeof(*info->ram)); - info->ram->transferred = ram_counters.transferred; + info->ram->transferred = stat64_get(&ram_atomic_counters.transferred); info->ram->total = ram_bytes_total(); - info->ram->duplicate = ram_counters.duplicate; + info->ram->duplicate = stat64_get(&ram_atomic_counters.duplicate); /* legacy value. It is not used anymore */ info->ram->skipped = 0; - info->ram->normal = ram_counters.normal; - info->ram->normal_bytes = ram_counters.normal * page_size; + info->ram->normal = stat64_get(&ram_atomic_counters.normal); + info->ram->normal_bytes = info->ram->normal * page_size; info->ram->mbps = s->mbps; info->ram->dirty_sync_count = ram_counters.dirty_sync_count; info->ram->dirty_sync_missed_zero_copy = @@@ -1062,9 -1066,10 +1062,9 @@@ info->ram->pages_per_second = s->pages_per_second; info->ram->precopy_bytes = ram_counters.precopy_bytes; info->ram->downtime_bytes = ram_counters.downtime_bytes; - info->ram->postcopy_bytes = ram_counters.postcopy_bytes; + info->ram->postcopy_bytes = stat64_get(&ram_atomic_counters.postcopy_bytes); if (migrate_use_xbzrle()) { - info->has_xbzrle_cache = true; info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache)); info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size(); info->xbzrle_cache->bytes = xbzrle_counters.bytes; @@@ -1076,6 -1081,7 +1076,6 @@@ } if (migrate_use_compression()) { - info->has_compression = true; info->compression = g_malloc0(sizeof(*info->compression)); info->compression->pages = compression_counters.pages; info->compression->busy = compression_counters.busy; @@@ -1100,6 -1106,7 +1100,6 @@@ static void populate_disk_info(MigrationInfo *info) { if (blk_mig_active()) { - info->has_disk = true; info->disk = g_malloc0(sizeof(*info->disk)); info->disk->transferred = blk_mig_bytes_transferred(); info->disk->remaining = blk_mig_bytes_remaining(); @@@ -1164,6 -1171,7 +1164,6 @@@ static void fill_source_migration_info( case MIGRATION_STATUS_FAILED: info->has_status = true; if (s->error) { - info->has_error_desc = true; info->error_desc = g_strdup(error_get_pretty(s->error)); } break; @@@ -1567,7 -1575,7 +1567,7 @@@ static bool migrate_params_check(Migrat #ifdef CONFIG_LINUX if (migrate_use_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) || - (params->has_tls_creds && params->tls_creds && *params->tls_creds))) { + (params->tls_creds && *params->tls_creds))) { error_setg(errp, "Zero copy only available for non-compressed non-TLS multifd migration"); return false; @@@ -1616,12 -1624,12 +1616,12 @@@ static void migrate_params_test_apply(M dest->cpu_throttle_tailslow = params->cpu_throttle_tailslow; } - if (params->has_tls_creds) { + if (params->tls_creds) { assert(params->tls_creds->type == QTYPE_QSTRING); dest->tls_creds = params->tls_creds->u.s; } - if (params->has_tls_hostname) { + if (params->tls_hostname) { assert(params->tls_hostname->type == QTYPE_QSTRING); dest->tls_hostname = params->tls_hostname->u.s; } @@@ -1713,19 -1721,19 +1713,19 @@@ static void migrate_params_apply(Migrat s->parameters.cpu_throttle_tailslow = params->cpu_throttle_tailslow; } - if (params->has_tls_creds) { + if (params->tls_creds) { g_free(s->parameters.tls_creds); assert(params->tls_creds->type == QTYPE_QSTRING); s->parameters.tls_creds = g_strdup(params->tls_creds->u.s); } - if (params->has_tls_hostname) { + if (params->tls_hostname) { g_free(s->parameters.tls_hostname); assert(params->tls_hostname->type == QTYPE_QSTRING); s->parameters.tls_hostname = g_strdup(params->tls_hostname->u.s); } - if (params->has_tls_authz) { + if (params->tls_authz) { g_free(s->parameters.tls_authz); assert(params->tls_authz->type == QTYPE_QSTRING); s->parameters.tls_authz = g_strdup(params->tls_authz->u.s); @@@ -1802,14 -1810,14 +1802,14 @@@ void qmp_migrate_set_parameters(Migrate MigrationParameters tmp; /* TODO Rewrite "" to null instead */ - if (params->has_tls_creds + if (params->tls_creds && params->tls_creds->type == QTYPE_QNULL) { qobject_unref(params->tls_creds->u.n); params->tls_creds->type = QTYPE_QSTRING; params->tls_creds->u.s = strdup(""); } /* TODO Rewrite "" to null instead */ - if (params->has_tls_hostname + if (params->tls_hostname && params->tls_hostname->type == QTYPE_QNULL) { qobject_unref(params->tls_hostname->u.n); params->tls_hostname->type = QTYPE_QSTRING; @@@ -2840,8 -2848,11 +2840,11 @@@ static int migrate_handle_rp_resume_ack return 0; } - /* Release ms->rp_state.from_dst_file in a safe way */ - static void migration_release_from_dst_file(MigrationState *ms) + /* + * Release ms->rp_state.from_dst_file (and postcopy_qemufile_src if + * existed) in a safe way. + */ + static void migration_release_dst_files(MigrationState *ms) { QEMUFile *file; @@@ -2854,6 -2865,18 +2857,18 @@@ ms->rp_state.from_dst_file = NULL; } + /* + * Do the same to postcopy fast path socket too if there is. No + * locking needed because this qemufile should only be managed by + * return path thread. + */ + if (ms->postcopy_qemufile_src) { + migration_ioc_unregister_yank_from_file(ms->postcopy_qemufile_src); + qemu_file_shutdown(ms->postcopy_qemufile_src); + qemu_fclose(ms->postcopy_qemufile_src); + ms->postcopy_qemufile_src = NULL; + } + qemu_fclose(file); } @@@ -2998,7 -3021,7 +3013,7 @@@ out * Maybe there is something we can do: it looks like a * network down issue, and we pause for a recovery. */ - migration_release_from_dst_file(ms); + migration_release_dst_files(ms); rp = NULL; if (postcopy_pause_return_path_thread(ms)) { /* @@@ -3016,7 -3039,7 +3031,7 @@@ } trace_source_return_path_thread_end(); - migration_release_from_dst_file(ms); + migration_release_dst_files(ms); rcu_unregister_thread(); return NULL; } @@@ -3539,18 -3562,6 +3554,6 @@@ static MigThrError postcopy_pause(Migra qemu_file_shutdown(file); qemu_fclose(file); - /* - * Do the same to postcopy fast path socket too if there is. No - * locking needed because no racer as long as we do this before setting - * status to paused. - */ - if (s->postcopy_qemufile_src) { - migration_ioc_unregister_yank_from_file(s->postcopy_qemufile_src); - qemu_file_shutdown(s->postcopy_qemufile_src); - qemu_fclose(s->postcopy_qemufile_src); - s->postcopy_qemufile_src = NULL; - } - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_POSTCOPY_PAUSED); @@@ -4391,8 -4402,6 +4394,6 @@@ static Property migration_properties[] DEFINE_PROP_SIZE("announce-step", MigrationState, parameters.announce_step, DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_BOOL("x-postcopy-preempt-break-huge", MigrationState, - postcopy_preempt_break_huge, true), DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_hostname), DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), @@@ -4484,6 -4493,9 +4485,6 @@@ static void migration_instance_init(Obj params->has_announce_max = true; params->has_announce_rounds = true; params->has_announce_step = true; - params->has_tls_creds = true; - params->has_tls_hostname = true; - params->has_tls_authz = true; qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->postcopy_pause_rp_sem, 0);