Commit e89f5ff2 authored by Peter Xu's avatar Peter Xu Committed by Juan Quintela
Browse files

migration: let incoming side use thread context



The old incoming migration is running in main thread and default
gcontext.  With the new qio_channel_add_watch_full() we can now let it
run in the thread's own gcontext (if there is one).

Currently this patch does nothing alone.  But when any of the incoming
migration is run in another iothread (e.g., the upcoming migrate-recover
command), this patch will bind the incoming logic to the iothread
instead of the main thread (which may already get page faulted and
hanged).

RDMA is not considered for now since it's not even using the QIO watch
framework at all.

Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
Message-Id: <20180502104740.12123-2-peterx@redhat.com>
Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
parent 8c4598f2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -65,9 +65,8 @@ void exec_start_incoming_migration(const char *command, Error **errp)
    }

    qio_channel_set_name(ioc, "migration-exec-incoming");
    qio_channel_add_watch(ioc,
                          G_IO_IN,
    qio_channel_add_watch_full(ioc, G_IO_IN,
                               exec_accept_incoming_migration,
                          NULL,
                          NULL);
                               NULL, NULL,
                               g_main_context_get_thread_default());
}
+4 −5
Original line number Diff line number Diff line
@@ -66,9 +66,8 @@ void fd_start_incoming_migration(const char *infd, Error **errp)
    }

    qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-incoming");
    qio_channel_add_watch(ioc,
                          G_IO_IN,
    qio_channel_add_watch_full(ioc, G_IO_IN,
                               fd_accept_incoming_migration,
                          NULL,
                          NULL);
                               NULL, NULL,
                               g_main_context_get_thread_default());
}
+4 −3
Original line number Diff line number Diff line
@@ -190,9 +190,10 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
        return;
    }

    qio_net_listener_set_client_func(listener,
    qio_net_listener_set_client_func_full(listener,
                                          socket_accept_incoming_migration,
                                     NULL, NULL);
                                          NULL, NULL,
                                          g_main_context_get_thread_default());
}

void tcp_start_incoming_migration(const char *host_port, Error **errp)