It's almost there, except that currently it relies on a global flag showing
that it's in incoming migration.

Change it to detect coroutine instead.

Signed-off-by: Peter Xu <pet...@redhat.com>
---
 migration/rdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index e6837184c8..ed4e20b988 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1357,7 +1357,8 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma,
      * so don't yield unless we know we're running inside of a coroutine.
      */
     if (rdma->migration_started_on_destination &&
-        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {
+        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE &&
+        qemu_in_coroutine()) {
         yield_until_fd_readable(comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread
-- 
2.50.1


Reply via email to