From: "Daniel P. Berrange" <berrange@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, amit.shah@redhat.com, dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PULL 07/12] migration: Start of multiple fd work
Date: Tue, 14 Feb 2017 11:17:37 +0000 [thread overview]
Message-ID: <20170214111737.GC467@redhat.com> (raw)
In-Reply-To: <1487006388-7966-8-git-send-email-quintela@redhat.com>
On Mon, Feb 13, 2017 at 06:19:43PM +0100, Juan Quintela wrote:
> We create new channels for each new thread created. We only send through
> them a character to be sure that we are creating the channels in the
> right order.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> include/migration/migration.h | 7 +++++
> migration/ram.c | 33 ++++++++++++++++++++++
> migration/socket.c | 64 +++++++++++++++++++++++++++++++++++++++++--
> 3 files changed, 101 insertions(+), 3 deletions(-)
[snip]
> diff --git a/migration/socket.c b/migration/socket.c
> index 13966f1..1c764f1 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -24,6 +24,62 @@
> #include "io/channel-socket.h"
> #include "trace.h"
>
> +struct SocketArgs {
> + QIOChannelSocket *ioc;
> + SocketAddress *saddr;
> + Error **errp;
> +} socket_args;
> +
> +QIOChannel *socket_recv_channel_create(void)
> +{
> + QIOChannelSocket *sioc;
> + Error *err = NULL;
> +
> + sioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(socket_args.ioc),
> + &err);
> + if (!sioc) {
> + error_report("could not accept migration connection (%s)",
> + error_get_pretty(err));
> + return NULL;
> + }
> + return QIO_CHANNEL(sioc);
> +}
> +
> +int socket_recv_channel_destroy(QIOChannel *recv)
> +{
> + /* Remove channel */
> + object_unref(OBJECT(send));
> + return 0;
> +}
> +
> +/* we have created all the recv channels, we can close the main one */
> +int socket_recv_channel_close_listening(void)
> +{
> + /* Close listening socket as its no longer needed */
> + qio_channel_close(QIO_CHANNEL(socket_args.ioc), NULL);
> + return 0;
> +}
> +
> +QIOChannel *socket_send_channel_create(void)
> +{
> + QIOChannelSocket *sioc = qio_channel_socket_new();
> +
> + qio_channel_socket_connect_sync(sioc, socket_args.saddr,
> + socket_args.errp);
> + qio_channel_set_delay(QIO_CHANNEL(sioc), false);
> + return QIO_CHANNEL(sioc);
> +}
> +
> +int socket_send_channel_destroy(QIOChannel *send)
> +{
> + /* Remove channel */
> + object_unref(OBJECT(send));
> + if (socket_args.saddr) {
> + qapi_free_SocketAddress(socket_args.saddr);
> + socket_args.saddr = NULL;
> + }
> + return 0;
> +}
>
> static SocketAddress *tcp_build_address(const char *host_port, Error **errp)
> {
> @@ -97,6 +153,10 @@ static void socket_start_outgoing_migration(MigrationState *s,
> struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
>
> data->s = s;
> +
> + socket_args.saddr = saddr;
> + socket_args.errp = errp;
> +
> if (saddr->type == SOCKET_ADDRESS_KIND_INET) {
> data->hostname = g_strdup(saddr->u.inet.data->host);
> }
> @@ -107,7 +167,6 @@ static void socket_start_outgoing_migration(MigrationState *s,
> socket_outgoing_migration,
> data,
> socket_connect_data_free);
> - qapi_free_SocketAddress(saddr);
> }
>
> void tcp_start_outgoing_migration(MigrationState *s,
> @@ -154,8 +213,6 @@ static gboolean socket_accept_incoming_migration(QIOChannel *ioc,
> object_unref(OBJECT(sioc));
>
> out:
> - /* Close listening socket as its no longer needed */
> - qio_channel_close(ioc, NULL);
> return FALSE; /* unregister */
> }
>
> @@ -164,6 +221,7 @@ static void socket_start_incoming_migration(SocketAddress *saddr,
> Error **errp)
> {
> QIOChannelSocket *listen_ioc = qio_channel_socket_new();
> + socket_args.ioc = listen_ioc;
>
> qio_channel_set_name(QIO_CHANNEL(listen_ioc),
> "migration-socket-listener");
FYI I put some comments against v3 on this patch just as you sent this v4,
as I don't think the changes here are desirable in this format.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
next prev parent reply other threads:[~2017-02-14 11:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-13 17:19 [Qemu-devel] [PATCH 00/12] Multifd v4 Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 01/12] migration: Test for disabled features on reception Juan Quintela
2017-02-15 13:12 ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 02/12] migration: Don't create decompression threads if not enabled Juan Quintela
2017-02-15 13:17 ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 03/12] migration: Add multifd capability Juan Quintela
2017-02-15 13:04 ` Dr. David Alan Gilbert
2017-02-13 17:19 ` [Qemu-devel] [PULL 04/12] migration: Create x-multifd-threads parameter Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 05/12] migration: Create x-multifd-group parameter Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 06/12] migration: Create multifd migration threads Juan Quintela
2017-02-14 13:02 ` Paolo Bonzini
2017-02-13 17:19 ` [Qemu-devel] [PULL 07/12] migration: Start of multiple fd work Juan Quintela
2017-02-14 11:17 ` Daniel P. Berrange [this message]
2017-02-14 12:57 ` Paolo Bonzini
2017-02-14 13:12 ` Juan Quintela
2017-02-14 13:37 ` Paolo Bonzini
2017-02-14 13:52 ` Juan Quintela
2017-02-14 14:08 ` Paolo Bonzini
2017-02-13 17:19 ` [Qemu-devel] [PULL 08/12] migration: Create ram_multifd_page Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 09/12] migration: Create thread infrastructure for multifd send side Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 10/12] migration: Really use multiple pages at a time Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 11/12] migration: Send the fd number which we are going to use for this page Juan Quintela
2017-02-14 13:02 ` Paolo Bonzini
2017-02-14 13:16 ` Juan Quintela
2017-02-13 17:19 ` [Qemu-devel] [PULL 12/12] migration: Test new fd infrastructure Juan Quintela
2017-02-14 9:55 ` [Qemu-devel] [PATCH 00/12] Multifd v4 Peter Maydell
2017-02-14 12:38 ` Juan Quintela
2017-02-14 13:03 ` Paolo Bonzini
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=20170214111737.GC467@redhat.com \
--to=berrange@redhat.com \
--cc=amit.shah@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).