@samitouri / QOSamiQemu / commits / 0e83d68945

migration/rdma: annotate and simplify wait_comp_channel()

The function calls yield_until_fd_readable() (coroutine_fn) when in coroutine context, and polls with qemu_poll_ns() otherwise. Replace the migration-state proxy check with qemu_in_coroutine(), which directly tests what matters. Fixes: 2da776db4846 ("rdma: core logic") Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Jul 20, 2026 at 10:55 UTC 0e83d6894534cfe4cf071381ea8466cc689e044e
1 file changed +4 -8
migration/rdma.c
+4 -8
@@ -1348,17 +1348,13 @@ static int qemu_rdma_poll(RDMAContext *rdma, struct ibv_cq *cq,
1348 /* Wait for activity on the completion channel.
1349 * Returns 0 on success, none-0 on error.
1350 */
1351 -static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
1352 - struct ibv_comp_channel *comp_channel)
1351 +static int coroutine_mixed_fn
1352 +qemu_rdma_wait_comp_channel(RDMAContext *rdma,
1353 + struct ibv_comp_channel *comp_channel)
1354 {
1355 struct rdma_cm_event *cm_event;
1356
1356 - /*
1357 - * Coroutine doesn't start until migration_fd_process_incoming()
1358 - * so don't yield unless we know we're running inside of a coroutine.
1359 - */
1360 - if (rdma->migration_started_on_destination &&
1361 - migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {
1357 + if (qemu_in_coroutine()) {
1358 yield_until_fd_readable(comp_channel->fd);
1359 } else {
1360 /* This is the source side, we're in a separate thread