From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/5] migration: move income process out of multifd
Date: Wed, 27 Jun 2018 18:51:09 +0800 [thread overview]
Message-ID: <20180627105112.31401-3-peterx@redhat.com> (raw)
In-Reply-To: <20180627105112.31401-1-peterx@redhat.com>
Move the call to migration_incoming_process() out of multifd code. It's
a bit strange that we can migration generic calls in multifd code.
Instead, let multifd_recv_new_channel() return a boolean showing whether
it's ready to continue the incoming migration.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/ram.h | 2 +-
migration/migration.c | 5 ++++-
migration/ram.c | 11 +++++------
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/migration/ram.h b/migration/ram.h
index d386f4d641..457bf54b8c 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -46,7 +46,7 @@ int multifd_save_cleanup(Error **errp);
int multifd_load_setup(void);
int multifd_load_cleanup(Error **errp);
bool multifd_recv_all_channels_created(void);
-void multifd_recv_new_channel(QIOChannel *ioc);
+bool multifd_recv_new_channel(QIOChannel *ioc);
uint64_t ram_pagesize_summary(void);
int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
diff --git a/migration/migration.c b/migration/migration.c
index e1eaa97df4..6ecea2de30 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -507,7 +507,10 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
migration_incoming_setup(f);
return;
}
- multifd_recv_new_channel(ioc);
+
+ if (multifd_recv_new_channel(ioc)) {
+ migration_incoming_process();
+ }
}
/**
diff --git a/migration/ram.c b/migration/ram.c
index cd5f55117d..52167d5142 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -873,7 +873,8 @@ bool multifd_recv_all_channels_created(void)
return thread_count == atomic_read(&multifd_recv_state->count);
}
-void multifd_recv_new_channel(QIOChannel *ioc)
+/* Return true if multifd is ready for the migration, otherwise false */
+bool multifd_recv_new_channel(QIOChannel *ioc)
{
MultiFDRecvParams *p;
Error *local_err = NULL;
@@ -882,7 +883,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
id = multifd_recv_initial_packet(ioc, &local_err);
if (id < 0) {
multifd_recv_terminate_threads(local_err);
- return;
+ return false;
}
p = &multifd_recv_state->params[id];
@@ -890,7 +891,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
error_setg(&local_err, "multifd: received id '%d' already setup'",
id);
multifd_recv_terminate_threads(local_err);
- return;
+ return false;
}
p->c = ioc;
object_ref(OBJECT(ioc));
@@ -899,9 +900,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p,
QEMU_THREAD_JOINABLE);
atomic_inc(&multifd_recv_state->count);
- if (multifd_recv_state->count == migrate_multifd_channels()) {
- migration_incoming_process();
- }
+ return multifd_recv_state->count == migrate_multifd_channels();
}
/**
--
2.17.1
next prev parent reply other threads:[~2018-06-27 10:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 10:51 [Qemu-devel] [PATCH v2 0/5] migation: unbreak postcopy recovery Peter Xu
2018-06-27 10:51 ` [Qemu-devel] [PATCH v2 1/5] migration: delay postcopy paused state Peter Xu
2018-06-27 10:51 ` Peter Xu [this message]
2018-06-27 10:51 ` [Qemu-devel] [PATCH v2 3/5] migration: do explicit incoming setup for rdma Peter Xu
2018-06-27 12:25 ` Dr. David Alan Gilbert
2018-06-27 13:03 ` Peter Xu
2018-06-27 14:13 ` Dr. David Alan Gilbert
2018-06-29 6:58 ` Peter Xu
2018-06-27 10:51 ` [Qemu-devel] [PATCH v2 4/5] migration: unbreak postcopy recovery Peter Xu
2018-06-27 10:51 ` [Qemu-devel] [PATCH v2 5/5] migration: unify incoming processing 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=20180627105112.31401-3-peterx@redhat.com \
--to=peterx@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).