qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alexey Perevalov <a.perevalov@samsung.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	peterx@redhat.com
Subject: [Qemu-devel] [PATCH v8 01/24] migration: let incoming side use thread context
Date: Wed,  2 May 2018 18:47:17 +0800	[thread overview]
Message-ID: <20180502104740.12123-2-peterx@redhat.com> (raw)
In-Reply-To: <20180502104740.12123-1-peterx@redhat.com>

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: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/exec.c   | 9 ++++-----
 migration/fd.c     | 9 ++++-----
 migration/socket.c | 7 ++++---
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/migration/exec.c b/migration/exec.c
index 0bc5a427dd..9d0f82f1f0 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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,
-                          exec_accept_incoming_migration,
-                          NULL,
-                          NULL);
+    qio_channel_add_watch_full(ioc, G_IO_IN,
+                               exec_accept_incoming_migration,
+                               NULL, NULL,
+                               g_main_context_get_thread_default());
 }
diff --git a/migration/fd.c b/migration/fd.c
index cd06182d1e..9a380bbbc4 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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,
-                          fd_accept_incoming_migration,
-                          NULL,
-                          NULL);
+    qio_channel_add_watch_full(ioc, G_IO_IN,
+                               fd_accept_incoming_migration,
+                               NULL, NULL,
+                               g_main_context_get_thread_default());
 }
diff --git a/migration/socket.c b/migration/socket.c
index 122d8ccfbe..8d4cf76295 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -160,9 +160,10 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
         return;
     }
 
-    qio_net_listener_set_client_func(listener,
-                                     socket_accept_incoming_migration,
-                                     NULL, NULL);
+    qio_net_listener_set_client_func_full(listener,
+                                          socket_accept_incoming_migration,
+                                          NULL, NULL,
+                                          g_main_context_get_thread_default());
 }
 
 void tcp_start_incoming_migration(const char *host_port, Error **errp)
-- 
2.14.3

  reply	other threads:[~2018-05-02 10:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 10:47 [Qemu-devel] [PATCH v8 00/24] Migration: postcopy failure recovery Peter Xu
2018-05-02 10:47 ` Peter Xu [this message]
2018-05-08 14:36   ` [Qemu-devel] [PATCH v8 01/24] migration: let incoming side use thread context Juan Quintela
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 02/24] migration: new postcopy-pause state Peter Xu
2018-05-08 15:16   ` Juan Quintela
2018-05-09  4:05     ` Peter Xu
2018-05-09  6:59       ` Juan Quintela
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 03/24] migration: implement "postcopy-pause" src logic Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 04/24] migration: allow dst vm pause on postcopy Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 05/24] migration: allow src return path to pause Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 06/24] migration: allow fault thread " Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 07/24] qmp: hmp: add migrate "resume" option Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 08/24] migration: rebuild channel on source Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 09/24] migration: new state "postcopy-recover" Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 10/24] migration: wakeup dst ram-load-thread for recover Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 11/24] migration: new cmd MIG_CMD_RECV_BITMAP Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 12/24] migration: new message MIG_RP_MSG_RECV_BITMAP Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 13/24] migration: new cmd MIG_CMD_POSTCOPY_RESUME Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 14/24] migration: new message MIG_RP_MSG_RESUME_ACK Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 15/24] migration: introduce SaveVMHandlers.resume_prepare Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 16/24] migration: synchronize dirty bitmap for resume Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 17/24] migration: setup ramstate " Peter Xu
2018-05-08 10:54   ` Dr. David Alan Gilbert
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 18/24] migration: final handshake for the resume Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 19/24] migration: init dst in migration_object_init too Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 20/24] qmp/migration: new command migrate-recover Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 21/24] hmp/migration: add migrate_recover command Peter Xu
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 22/24] migration: introduce lock for to_dst_file Peter Xu
2018-05-08 11:31   ` Dr. David Alan Gilbert
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 23/24] migration/qmp: add command migrate-pause Peter Xu
2018-05-08 13:20   ` Dr. David Alan Gilbert
2018-05-02 10:47 ` [Qemu-devel] [PATCH v8 24/24] migration/hmp: add migrate_pause command Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180502104740.12123-2-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=a.perevalov@samsung.com \
    --cc=aarcange@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).