[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/22] migration: Add a semaphore to count PONGs
From: |
Xxx Xx |
Subject: |
[PULL 16/22] migration: Add a semaphore to count PONGs |
Date: |
Mon, 13 Feb 2023 03:29:05 +0100 |
From: Peter Xu <peterx@redhat.com>
This is mostly useless, but useful for us to know whether the main channel
is correctly established without changing the migration protocol.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/migration.h | 6 ++++++
migration/migration.c | 3 +++
2 files changed, 9 insertions(+)
diff --git a/migration/migration.h b/migration/migration.h
index c351872360..4cb1cb6fa8 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -276,6 +276,12 @@ struct MigrationState {
*/
bool rp_thread_created;
QemuSemaphore rp_sem;
+ /*
+ * We post to this when we got one PONG from dest. So far it's an
+ * easy way to know the main channel has successfully established
+ * on dest QEMU.
+ */
+ QemuSemaphore rp_pong_acks;
} rp_state;
double mbps;
diff --git a/migration/migration.c b/migration/migration.c
index fb0ecf5649..a2e362541d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3025,6 +3025,7 @@ retry:
case MIG_RP_MSG_PONG:
tmp32 = ldl_be_p(buf);
trace_source_return_path_thread_pong(tmp32);
+ qemu_sem_post(&ms->rp_state.rp_pong_acks);
break;
case MIG_RP_MSG_REQ_PAGES:
@@ -4524,6 +4525,7 @@ static void migration_instance_finalize(Object *obj)
qemu_sem_destroy(&ms->postcopy_pause_sem);
qemu_sem_destroy(&ms->postcopy_pause_rp_sem);
qemu_sem_destroy(&ms->rp_state.rp_sem);
+ qemu_sem_destroy(&ms->rp_state.rp_pong_acks);
qemu_sem_destroy(&ms->postcopy_qemufile_src_sem);
error_free(ms->error);
}
@@ -4570,6 +4572,7 @@ static void migration_instance_init(Object *obj)
qemu_sem_init(&ms->postcopy_pause_sem, 0);
qemu_sem_init(&ms->postcopy_pause_rp_sem, 0);
qemu_sem_init(&ms->rp_state.rp_sem, 0);
+ qemu_sem_init(&ms->rp_state.rp_pong_acks, 0);
qemu_sem_init(&ms->rate_limit_sem, 0);
qemu_sem_init(&ms->wait_unplug_sem, 0);
qemu_sem_init(&ms->postcopy_qemufile_src_sem, 0);
--
2.39.1
- [PULL 08/22] migration: Split ram_bytes_total_common() in two functions, (continued)
- [PULL 08/22] migration: Split ram_bytes_total_common() in two functions, Xxx Xx, 2023/02/12
- [PULL 07/22] migration: Make find_dirty_block() return a single parameter, Xxx Xx, 2023/02/12
- [PULL 06/22] migration: Simplify ram_find_and_save_block(), Xxx Xx, 2023/02/12
- [PULL 10/22] migration: Make ram_save_target_page() a pointer, Xxx Xx, 2023/02/12
- [PULL 11/22] migration: I messed state_pending_exact/estimate, Xxx Xx, 2023/02/12
- [PULL 12/22] AVX512 support for xbzrle_encode_buffer, Xxx Xx, 2023/02/12
- [PULL 09/22] migration: Calculate ram size once, Xxx Xx, 2023/02/12
- [PULL 13/22] Update bench-code for addressing CI problem, Xxx Xx, 2023/02/12
- [PULL 14/22] migration: Rework multi-channel checks on URI, Xxx Xx, 2023/02/12
- [PULL 15/22] migration: Cleanup postcopy_preempt_setup(), Xxx Xx, 2023/02/12
- [PULL 16/22] migration: Add a semaphore to count PONGs,
Xxx Xx <=
- [PULL 17/22] migration: Postpone postcopy preempt channel to be after main, Xxx Xx, 2023/02/12
- [PULL 19/22] migration/multifd: Remove unnecessary assignment on multifd_load_cleanup(), Xxx Xx, 2023/02/12
- [PULL 20/22] migration/multifd: Join all multifd threads in order to avoid leaks, Xxx Xx, 2023/02/12
- [PULL 21/22] migration/multifd: Move load_cleanup inside incoming_state_destroy, Xxx Xx, 2023/02/12
- [PULL 22/22] ram: Document migration ram flags, Xxx Xx, 2023/02/12
- [PULL 18/22] migration/multifd: Change multifd_load_cleanup() signature and usage, Xxx Xx, 2023/02/12
- Re: [PULL 00/22] Migration 20230213 patches, Juan Quintela, 2023/02/12
- [PULL 00/22] Migration 20230213 patches, Juan Quintela, 2023/02/12